您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Detect DOIs as hyperlinks
// ==UserScript== // @name RGdoi // @namespace https://www.researchgate.net // @description Detect DOIs as hyperlinks // @include http://www.researchgate.net/publication/* // @include https://www.researchgate.net/publication/* // @version 0.0.3 // @grant none // ==/UserScript== function rgdoi() { openDoi(window.top) } var matchRegexpGlobal = /DOI:.*/mg; var extractRegexp = /(?:DOI:\s)([\w\.\/\-])*/g; function openDoi(win) { var root = "https://doi.org/"; var text = win.document.body.textContent; while((match = matchRegexpGlobal.exec(text)) != null) { var doi = extractRegexp.exec(match[0]); if (doi != null) { var doi_link = doi[0].replace(/DOI\:\s/i, ""); alert('DOI detected'); replaceElement(doi_link); } } for (var i = 0, n = win.frames.length; i < n; i++) openDoi(win.frames[i]); } function replaceElement(doi) { var divs = document.querySelectorAll(".publication-meta-secondary"); var element = divs[0]; var replace = '<a href="https://doi.org/' + doi +'">' + element.innerHTML + '</a>'; element.innerHTML = replace; } rgdoi()