谷歌学术在当前页按照被引用次数排序

当前页!当前页!当前页!只处理当前页信息

当前为 2025-02-12 提交的版本,查看 最新版本

// ==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
// ==/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();

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址