mmmturkeybacon Numbered Google Results (with 10-per-page mod)

Numbers Google search results in the format M.N to show the result number.

目前為 2015-01-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name        mmmturkeybacon Numbered Google Results (with 10-per-page mod)
// @author      mmmturkeybacon
// @description Numbers Google search results in the format M.N to show the result number.
//              N counts up from 1 to 10, after that M is incremented by 1 and N starts over
//              at 1. Google Instant should be disabled.
// @namespace   http://userscripts.org/users/523367
// @include     http*://www.google.*/search?*
// @grant       none
// @version     1c
// @require     http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

// modified by clickhappier to add page numbering for 10-result pages


// If you have Google set to return 10 results per page (default), the first
// page usually has 10 results but not sometimes it will have fewer.

// If you change Results per page under Search Settings, Google will return
// more results per page. The number of links on the page might not always be
// the same as the number of results per page you chose. That's because Google
// doesn't count every link it shows you as a result.
// Ads aren't counted
// "More results from ..." are grouped with the link they are under. Google
// counts this as one result.
// "Images for ..." aren't counted. (imagebox_bigimages)
// "News for ..." and all the the links grouped with it are counted as one
// result?? (newsbox)

 (function() {
    // If instant search has enabled
    //if(document.getElementById('misspell')) return;
	
    var p_result = document.getElementById('res');
    if (!p_result) return;

    //Create Array of All HTML Tags
    var allLiTags = p_result.getElementsByTagName("li");

    var i;
    var result_num = 0;
    var page_num = 1;
    var page_str = '';

    // begin mod
    page_num = $('table#nav tbody tr td.cur').text();
    page_str = page_num + '.';
    // end mod

    for (i = 0; i < allLiTags.length; i++)
    {
        if (allLiTags[i].className == 'g' || allLiTags[i].className == 'g w0')
        {
            //if (allLiTags[i].id == 'imagebox_bigimages')
            if (allLiTags[i].id == 'imagebox_bigimages' || allLiTags[i].id == 'newsbox')
            {
                continue;
            }

            var h3 = allLiTags[i].getElementsByTagName('h3');
            if(!h3[0])
            {
                continue;
            }

            result_num++;
            if (result_num > 10)
            {
                page_num++;
                page_str = page_num + '.'
                result_num = result_num - 10;
            }
            
            h3[0].innerHTML = page_str + result_num + '&nbsp;-&nbsp;' + h3[0].innerHTML;
        }
    }

})();

QingJ © 2025

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