Arxiv Old Author Search

Resets author links on the arxiv to use the old search

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Arxiv Old Author Search
// @namespace   https://greasyfork.org/en/scripts/367695-arxiv-old-author-search
// @description Resets author links on the arxiv to use the old search
// @include     http://arxiv.org/*
// @include     https://arxiv.org/*
// @version     3
// @license     MIT
// @grant       none
// ==/UserScript==

var i;
var link_target;
var argument_start;
var author_name, fixed_author_name;

var arxiv_context = "";
var links = document.getElementsByTagName("a");
var header_links = document.getElementById("header").getElementsByTagName("a");

// We first need the context: hep-th, cond-mat and so on
for (i = 0; i < header_links.length; i++) {
        link_target = header_links[i].getAttribute("href");
        argument_start = link_target.indexOf("recent");
        if (argument_start < 0) continue;
        arxiv_context = header_links[i].innerHTML;
}

for (i = 0; i < links.length; i++) {
        link_target = links[i].getAttribute("href");
        if (link_target == null) continue;
        argument_start = link_target.indexOf("?searchtype=author&query=");
        if (argument_start < 0) continue;
        author_name = link_target.substring(argument_start + 25).replace(",+", "_").replace("%2C+", "_");
        // Limit the number of initials to one
        fixed_author_name = author_name.replace(/\+.*/, "");
        // Replace the link
        links[i].setAttribute("href", "https://arxiv.org/find/" + arxiv_context + "/1/au:+" + fixed_author_name + "/0/1/0/all/0/1");
}