当前页!当前页!当前页!只处理当前页信息
当前为
// ==UserScript==
// @name 谷歌学术在当前页按照被引用次数排序
// @namespace http://tampermonkey.net/
// @version 2025-02-12
// @description 当前页!当前页!当前页!只处理当前页信息
// @author You
// @match https://scholar.google.com/scholar?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
// Your code here...
function sortElements() {
const gsResCclMid = document.getElementById('gs_res_ccl_mid');
const gsOrElements = Array.from(gsResCclMid.querySelectorAll('.gs_or')).map(node => ({ node, num: node.querySelector('a[href*=cite]')?.textContent.match(/(\d+)/)[1] >> 0 }));
const gsOrElementsSorted = gsOrElements.toSorted((a, b) => b.num - a.num);
if (gsOrElements.length == 0 || JSON.stringify(gsOrElements.map(a => a.num)) != JSON.stringify(gsOrElementsSorted.map(a => a.num))) {
gsResCclMid.innerHTML = '';
gsOrElementsSorted.forEach(gsOr => {
gsResCclMid.appendChild(gsOr.node);
});
setTimeout(sortElements, 1000)
}
}
sortElements()
})();