Greasy Fork 还支持 简体中文。

CNKI PDF Download

中国知网PDF下载(搜索列表)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        CNKI PDF Download
// @description 中国知网PDF下载(搜索列表)
// @author      Jachin
// @version     0.4
// @license     MIT
// @grant       GM_registerMenuCommand
// @namespace   http://tampermonkey.net/
// @include     *://kns.cnki.net/kns8/defaultresult/index*
// @include     *://oversea.cnki.net/kns/defaultresult/index*
// @include     *://*.res.gxlib.org.cn/kns*
// @exclude     *://image.cnki.net/*
// @include     *://kns.cnki.net/kns8/defaultresult/index*
// @include     *://oversea.cnki.net/kns/defaultresult/index*
// @include     */kns/brief/*
// @include     */kns55/brief/*
// @include     */grid2008/brief/*
// @include     */kcms/detail/detail.aspx*
// @include     *://er.szlib.org.cn/rwt/331/*

// ==/UserScript==


function get_pdf_url(url){
    let url_obj = new URL(url);
    url_obj.searchParams.set('dflag', "pdfdown");
    return url_obj.toString();
}

function add_pdf_download(){
    var $ = selector => Array.from(document.querySelectorAll(selector));
    $(".operat").forEach(i => {
        if(i.querySelector(".icon-download-pdf") != null)
            return
        if(i.querySelectorAll("a.downloadlink").length >= 2)
            return
        let download_node = i.querySelector(".downloadlink");
        if(download_node == null)
            return
        let pdf_download_node = download_node.cloneNode(true);
        pdf_download_node.href = get_pdf_url(pdf_download_node.href);
        pdf_download_node.classList.add("icon-download-pdf");
        pdf_download_node.classList.remove("icon-download");
        pdf_download_node.title = "download_pdf"
        pdf_download_node.querySelector("i").style.backgroundPosition = "-2px -140px"

        i.insertBefore(pdf_download_node, download_node);
        i.style.minWidth = "112px";
    })
}

(function() {
    'use strict';
    let observer = new MutationObserver(add_pdf_download);
    let options = {
        'childList': true,
        'attributes':true
    };

    observer.observe(document.querySelector(".main"), options);

    GM_registerMenuCommand(`PDF`, add_pdf_download);
})();