CNKI-DOI-Jump

DOI-Jump with middle click on any DOI on schlr.cnki.net

  1. // ==UserScript==
  2. // @name CNKI-DOI-Jump
  3. // @match https://schlr.cnki.net/*
  4. // @require https://code.jquery.com/jquery-latest.min.js
  5. // @license MIT
  6. // @grant GM_addStyle
  7. // @description DOI-Jump with middle click on any DOI on schlr.cnki.net
  8. // @version 0.0.1.20221102045724
  9. // @namespace https://gf.qytechs.cn/users/978257
  10. // ==/UserScript==
  11. //================================================== settings
  12. //variables
  13. const
  14. regex = '(10\.[0-9]{4,}(?:\.[0-9]+)*/(?:(?![%"&\'<>#? ])\\S)+)',
  15. doiRegex = new RegExp('(?:' + regex + ')', 'i')
  16.  
  17. //================================================== find DOI
  18. function findDOI(element){
  19. if($(element).is("[href*='org/10.']"))
  20. return $(element).attr("href").split('org/')[1].trim();
  21. if($(element).text().match(doiRegex)!==null)
  22. return $(element).text().match(doiRegex)[0].trim();
  23. return false;
  24. }
  25. $(document).ready(function(){
  26. //================================================== find middle click on doi
  27. $(document).on('mousedown', function(e){
  28. switch(e.which)
  29. {
  30. case 2:
  31. //prevent the default function of the clicked element
  32. e.preventDefault();
  33.  
  34. //if clicked element returned valid DOI
  35. if(findDOI(e.target)){
  36. window.open('https://dx.doi.org/'+findDOI(e.target));
  37. }
  38. break;
  39. }
  40. });
  41. });

QingJ © 2025

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