Greasy Fork

arxiv-extensions

HTML version of arxiv & AI chat for arxiv

目前为 2023-11-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         arxiv-extensions
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  HTML version of arxiv & AI chat for arxiv
// @author       [email protected]
// @match        https://arxiv.org/abs/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';
  const createLink = function(name, url) {
    const link = document.createElement('a');
    link.style.cssText = `display: inline-block; border-left: 2px solid #fff; padding-left: 10px; margin-left: 10px;`;
    link.target = '_blank';
    link.href = url;
    link.textContent = name;
    return link;
  };

  const href = window.location.href;
  const htmlVersionEntry = createLink('HTML Version', href.replace('arxiv.org', 'ar5iv.org'));
  const aiChatEntry = createLink('AI Chat', href.replace('arxiv.org', 'arxiw.org'));

  const target = document.querySelector('.header-breadcrumbs');
  target.appendChild(htmlVersionEntry);
  target.appendChild(aiChatEntry);
})();