cnki辅助

自动给知网论文的网页添加标题、一键复制参考文献。本脚本永久开源免费,仅供合法使用,禁止用于任何商业的,侵权的,非法的用途.

  1. // ==UserScript==
  2. // @name cnki辅助
  3. // @description 自动给知网论文的网页添加标题、一键复制参考文献。本脚本永久开源免费,仅供合法使用,禁止用于任何商业的,侵权的,非法的用途.
  4. // @match *://*.cnki.net/KXReader/*
  5. // @match *://*.cnki.net/KCMS*/*
  6. // @match *://*.cnki.net/kcms*/*
  7. // @match *://*.cnki.net/KNS8/*
  8. // @match *://115.239.174.206:8081/*/KXReader/*
  9. // @match *://115.239.174.206:8081/*/KCMS*/*
  10. // @match *://115.239.174.206:8081/*/kcms*/*
  11. // @match *://115.239.174.206:8081/*/KNS8/*
  12. // @icon http://cnki.net/favicon.ico
  13. // @require https://gf.qytechs.cn/scripts/435697-myutils/code/myUtils.js?version=1142271
  14. // @grant GM_addStyle
  15. // @grant GM_setClipboard
  16. // @grant GM_notification
  17. // @compatible firefox
  18. // @license MIT
  19. // @namespace https://gf.qytechs.cn/users/718683
  20. // @author runwithfaith
  21. // @version 0.0.1.20231120044401
  22. // ==/UserScript==
  23. //重构:解耦后只保留拷贝ref功能.如果是ref页,click后复制并提示.否则如果是html页,提供按钮指向iframe
  24. ;(function(){
  25. const sc=GM_setClipboard,n=GM_notification,as=GM_addStyle,
  26. href=location.href,host=location.host,path=location.pathname;
  27. as(`*{
  28. user-select: text !important
  29. }#GLSearch{
  30. display:none!important;
  31. }`);
  32. if(path.includes("KNS8")){
  33. as(`html{display:none!important}`);
  34. onload=document.querySelector('[displaymode="GBTREFER"]').click();
  35. }else if(path.toLowerCase().includes('kcms')){//学位论文页
  36. setBottom(document.title=document.title.replace(/\s*\-\s*(中国知网)$/,''));
  37. }else{//html论文页
  38. const btn=my.addBtns('ref',()=>{
  39. const ref=ifr.contentDocument.querySelector('#result').innerText;
  40. sc(ref)&n({
  41. title: host,
  42. text: ref,
  43. timeout: 3000,
  44. });
  45. })[0],//拷贝ref
  46. ifr=my.append('iframe',btn,'',`src`,document.querySelector('#aexport').href/**/,`scrolling`,"no",`style`,"width: 0;height: 0;");
  47. document.title=document.querySelector('.title').innerText.replace(/\s/g,'');
  48. setBottom(document.title);
  49. }
  50. function setBottom(txt){
  51. document.body.insertAdjacentHTML('afterend','<span id="titleSpan" style="background: black;color: white;z-index:999999;position: fixed;bottom: 0px;left: 0px;text-align: left;opacity: 0.7;width: 100%;">'+txt+'<span>');
  52. }
  53. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址