Greasy Fork

Greasy Fork is available in English.

中国知网(CNKI)硕博论文跳转至“海外版”下载 pdf 文件

将中国知网(CNKI)搜索列表中的硕博论文详情页自动跳转至“海外版”网站,以便下载 pdf 文件。

当前为 2022-03-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         中国知网(CNKI)硕博论文跳转至“海外版”下载 pdf 文件
// @namespace    https://xzonn.top/
// @version      1.0.2
// @description  将中国知网(CNKI)搜索列表中的硕博论文详情页自动跳转至“海外版”网站,以便下载 pdf 文件。
// @author       Xzonn
// @include      http*://kns.cnki.net/kns8/defaultresult/index
// @icon         https://www.cnki.net/favicon.ico
// @grant        none
// @supportURL   https://xzonn.top/posts/Download-Pdf-File-from-Cnki.html
// @license      cc by-nc-sa 4.0
// ==/UserScript==

(function() {
    'use strict';
    let changeLink = function (e) {
        let target = e.target;
        while (target.tagName.toLowerCase() != "a") {
            if (target.tagName.toLowerCase() == "body") {
                return;
            }
            target = target.parentNode;
        }
        if (target.href && target.href.match(/^https?:\/\/kns\.cnki\.net\/(.*=(?:CMFD|CDFD)(?:&.*)?)$/)) {
            target.href = target.href.replace(/^https?:\/\/kns\.cnki\.net\/(.*=(?:CMFD|CDFD)(?:&.*)?)$/, "https://chn.oversea.cnki.net/$1");
        }
    };
    document.body.addEventListener("mousedown", changeLink);
    document.body.addEventListener("click", changeLink);
})();