您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
将任何网页内指向arxov.org的pdf链接重写为arxiv中文镜像站cn.arxov.org的对应链接,加速pdf加载。 Redirect arxiv.org to cn.arxiv.org/pdf.
当前为
- // ==UserScript==
- // @name Redirect arxiv.org to cn.arxiv.org/pdf
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description 将任何网页内指向arxov.org的pdf链接重写为arxiv中文镜像站cn.arxov.org的对应链接,加速pdf加载。 Redirect arxiv.org to cn.arxiv.org/pdf.
- // @author LTGuo
- // @include http://*.*
- // @include https://*.*
- // @require http://code.jquery.com/jquery-3.3.1.min.js
- // ==/UserScript==
- window.onload = function() {
- 'use strict';
- $('a[href*="arxiv.org"]').each(function() {
- console.log('Contains arxiv href');
- // console.log(this.href);
- if ( this.href.match(/http[s]?:\/\/arxiv.org\/(pdf|abs)/) ) {
- console.log("match")
- this.href = this.href.replace(/http[s]?:\/\/arxiv.org\/(pdf|abs)/, 'http://cn.arxiv.org/pdf');
- }
- if (this.href.match(/http?:\/\/cn.arxiv.org\/pdf/) && !this.href.match(/\.pdf/) )
- {
- this.href = this.href + '.pdf';
- }
- });
- //handle the pdf link in arxiv.org/abs page
- if (/arxiv\.org/i.test(window.location.href)){
- var ele = $(".full-text ul li a")[0];
- ele.href = ele.href.replace('https://arxiv.org/', 'http://cn.arxiv.org/')+'.pdf';
- }
- }