您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
当前页!当前页!当前页!只处理当前页信息。建议打开每页20条记录
// ==UserScript== // @name 谷歌学术在当前页按照被引用次数排序 // @namespace http://tampermonkey.net/ // @version 2025.02.13.005 // @description 当前页!当前页!当前页!只处理当前页信息。建议打开每页20条记录 // @author You // @include https://scholar.google.com.*/* // @match https://scholar.google.com/scholar?* // @match https://sc.panda985.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... /** * 从节点中提取引用次数和 rimf 值,并计算综合得分 * @param {HTMLElement} node - 要处理的节点 * @returns {number} 综合得分 */ function getCiteCount(node) { const citeText = node.querySelector('a[href*="cites"]')?.textContent || "0"; const citeInt = parseInt(citeText.match(/(\d+)/)?.[1], 10) || 0; const rimf = parseInt(node.querySelector('.rimf')?.getAttribute("val"), 10) || 0; return citeInt * 1000 + rimf; } let sortCount = 0 /** * 对元素进行排序 */ function sortElements() { const gsResCclMid = document.getElementById('gs_res_ccl_mid'); if (!gsResCclMid) { console.error('未找到 gs_res_ccl_mid 元素'); return; } const gsOrElements = [...gsResCclMid.querySelectorAll('.gs_or')] .map(node => ({ node, citeCount: getCiteCount(node) })); const gsOrElementsSorted = [...gsOrElements].sort((a, b) => b.citeCount - a.citeCount); // 检查是否需要重新排序 const needResort = gsOrElements.some((element, index) => element.node !== gsOrElementsSorted[index].node); if (needResort) { console.log("重排", ++sortCount) gsResCclMid.innerHTML = ''; gsResCclMid.append(...gsOrElementsSorted.map(item => item.node)); // 重新添加排序后的节点 setTimeout(sortElements, 1000); } else { setTimeout(sortElements, 5000); } } sortElements(); })();