Last active
March 8, 2021 05:49
-
-
Save zhuth/c8b6cf110b2311ced006bbd20682ad33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id CNKI-PDF | |
// @name CNKI 中国知网 PDF 全文下载 | |
// @version 1.2.2 | |
// @namespace http://yuelong.info | |
// @author YUE Long, zhuth | |
// @description 点击 CNKI 检索结果界面中的下载按钮可以直接下载 PDF 格式文献 | |
// @include https://kns.cnki.net/* | |
// @include http://kns.cnki.net/* | |
// @run-at document-idle | |
// ==/UserScript== | |
(function() { | |
var allLinks = document.querySelectorAll('a.downloadlink,a[href*="download.aspx"]'); | |
function fix_link(li) { | |
var h = li.href; | |
if (h.indexOf('&dflag=') > 0) { | |
li.href = h.replace('&dflag=nhdown', '&dflag=pdfdown'); | |
} else { | |
li.href = h + '&dflag=pdfdown'; | |
} | |
} | |
for (var li of allLinks) fix_link(li); | |
jQuery(document).on('mouseover', 'a.downloadlink', function () { | |
fix_link(this); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment