CNKI Helper

在CNKI Grid2008版搜索结果页直接下载PDF(http://epub.cnki.net/grid2008/index/ZKCALD.htm)。

  1. // ==UserScript==
  2. // @name CNKI Helper
  3. // @description 在CNKI Grid2008版搜索结果页直接下载PDF(http://epub.cnki.net/grid2008/index/ZKCALD.htm)。
  4. // @author Damn
  5. // @namespace incast.info
  6. // @run-at document-start
  7. // @include http://epub.cnki.net/grid2008/brief/brief.aspx*
  8. // @match http://epub.cnki.net/grid2008/brief/brief.aspx*
  9. // @date 3/4/2017
  10. // @version 1.0.6
  11. // ==/UserScript==
  12.  
  13. document.addEventListener('DOMContentLoaded',proceed());
  14. var mo=new MutationObserver(function(){proceed();});
  15. mo.observe(document,{'childList':true,'subtree':true});
  16. function proceed(){
  17. if (document.body){
  18. [].forEach.call(document.querySelectorAll('a'), function(node) {
  19. if ((node.href.indexOf("download.aspx?filename")>0)*(node.href.indexOf("&dflag=pdfdown")<0)){
  20. node.href=node.href+"&dflag=pdfdown";
  21. }
  22. });
  23. }
  24. }