// ==UserScript== // @name 谷歌学术在当前页按照被引用次数排序 // @namespace http://tampermonkey.net/ // @version 2025.02.12.006 // @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 // @downloadURL none // ==/UserScript== (function () { 'use strict'; // Your code here... function sortElements() { const gsResCclMid = document.getElementById('gs_res_ccl_mid'); if (!gsResCclMid) return; const gsOrElements = Array.from(gsResCclMid.querySelectorAll('.gs_or')) .map(node => { let citeText = node.querySelector('a[href*="cites"]')?.textContent || "" let citeInt = citeText.match(/(\d+)/)?.[1] >> 0 let rimf = node.querySelector('.rimf')?.getAttribute("val") * 10 rimf = rimf >> 0 const citeCount = citeInt * 1000 + rimf return { node, citeCount }; }) ; const preSort = JSON.stringify(gsOrElements.map(a => a.citeCount)) const gsOrElementsSorted = gsOrElements.sort((a, b) => b.citeCount - a.citeCount); const curSort = JSON.stringify(gsOrElements.map(a => a.citeCount)) if (preSort == curSort) { setTimeout(sortElements, 5000); } else { gsResCclMid.innerHTML = ''; gsOrElementsSorted.forEach(gsOr => { gsResCclMid.appendChild(gsOr.node); }); setTimeout(sortElements, 1000); } } sortElements(); })();