您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
无需跳转直接复制Bibtex
// ==UserScript== // @name 谷歌学术直接复制Bibtex // @namespace http://tampermonkey.net/ // @version 0.1 // @description 无需跳转直接复制Bibtex // @author HeMOu // @match https://scholar.google.com/scholar* // @require https://unpkg.com/[email protected]/dist/jquery.js // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @license MIT // ==/UserScript== var App = { fetchContent() { document.querySelectorAll('#gs_citi a').forEach(function(elem) { if (elem.innerHTML === 'BibTeX') { GM_xmlhttpRequest({ url: elem.href, onload: ({responseText}) => { GM_setClipboard(responseText); $('#cite_tip').text('已复制到剪切板') $('#cite_content').text(responseText) } }); } }) }, bind() { var _this = this var intervalId = setInterval(function() { if ($('#gs_citi').length !== 0) { $('#gs_citi').after('<div><button id="my_button">获取BibTex</button><div id="cite_tip" style="padding-top: 10px; color: red;"></div><pre id="cite_content"></pre></div>') clearInterval(intervalId); $('#my_button').on('click', function(){ _this.fetchContent() }) } }, 500) }, init() { var _this = this $('a.gs_or_cit.gs_or_btn.gs_nph').on('click', function() { _this.bind() }) } } App.init();