zoukankan      html  css  js  c++  java
  • 解决arxiv.org打开pdf缓慢问题

    由于之前在学校都是使用的校园网,在家了去arxiv.org看篇文章,结果中途就挂掉了,不加载了,综合百度的方法,提供一下方法:

    1、中科院有arxiv的镜像地址:cn.arxiv.org,备用地址:xxx.itp.ac.cn。我们可以将arxiv.org/pdf/2002.02256.pdf都转换成cn.arxiv.org/pdf/2002.02256.pdf或xxx.itp.ac.cn/pdf/2002.02256.pdf。第一种我试的时候不行,选择第二个地址。

    2、我们每次都要手动更改地址会很麻烦,可以利用tampermonkey+脚本的方式来解决。

    3、tampermonkey是一个管理浏览器脚本的插件,它可以做很多东西,具体怎么安装就不说明了。

    4、安装完成之后,以UC浏览器为例,可以看到右上角有个图标:,左键点击它:

    点击获取新脚本:

    将里面代码替换为:

    // ==UserScript==
    // @name        Redirect arxiv.org to CN.arxiv.org/pdf
    // @namespace   uso2usom
    // @description On any web page it will check if the clicked links goes to arxiv.org. If so, the link will be rewritten to point to cn.arxiv.org
    // @include     http://*.*
    // @include     https://*.*
    // @version     1.2
    // @grant       none
    // ==/UserScript==
    
    // This is a slightly brute force solution, but there is no other way to do it using only a userscript.
    
    // Release Notes
    
    // version 1.2
    // Focus on pdf link only!
    // Add '.pdf' link  automatically. Convenient for saving as pdf.
    
    // version 1.1
    // Redirect arxiv.org to CN.arxiv.org
    
    document.body.addEventListener('mousedown', function(e){
        var targ = e.target || e.srcElement;
        if ( targ && targ.href && targ.href.match(/https?://arxiv.org/pdf/) ) {
            targ.href = targ.href.replace(/https?://arxiv.org/, 'http:/xxx.itp.ac.cn');
        }
        if ( targ && targ.href && targ.href.match(/http?://arxiv.org/pdf/) ) {
            targ.href = targ.href.replace(/http?://arxiv.org/, 'http://xxx.itp.ac.cn');
        }
        if ( targ && targ.href && targ.href.match(/https?://arxiv.org/abs/) ) {
            targ.href = targ.href.replace(/https?://arxiv.org/abs/, 'http://xxx.itp.ac.cn/pdf');
        }
        if ( targ && targ.href && targ.href.match(/http?://arxiv.org/abs/) ) {
            targ.href = targ.href.replace(/http?://arxiv.org/abs/, 'http:/xxx.itp.ac.cn/pdf');
        }
        if (targ && targ.href && targ.href.match(/http?://xxx.itp.ac.cn/pdf/) && !targ.href.match(/.pdf/) )
        {
           targ.href = targ.href + '.pdf';
        }
    });

    该段代码会将arxiv.org之类的替换为xxx.itp.ac.cn。然后点击文件--保存即可。成功之后:

    之前的两个是我以前安装的百度网盘直接下载和破解爱奇艺、优酷、BILIBILI等会员时安的。我们注意第三个,是我们刚刚安装的。

    我们测试一篇文章:

    NIPS 2016 Tutorial: Generative Adversarial Networks

    点击pdf:

    完成。有时候还是不稳定,听天由命了。

    还有一种方式是使用URLRedirector - 重定向插件,我没试过,有想法的可以去试一下。

    参考了:

    https://www.jianshu.com/p/184799230f20

    https://blog.csdn.net/seasermy/article/details/95176357

    https://chromecj.com/productivity/2019-01/1697.html 

  • 相关阅读:
    移动前端开发之viewport的深入理解
    javascript的事件监听与捕获和冒泡
    AngularJS服务中serivce,factory,provider的区别
    使用shadow dom封装web组件
    Web Components之Custom Elements
    javascript 布尔类型值判断
    requestAnimationFrame()
    二十周年感言
    文件上传实例
    jhipster技术栈研究
  • 原文地址:https://www.cnblogs.com/xiximayou/p/12274820.html
Copyright © 2011-2022 走看看