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

Numbers Google search results in the format M.N (page number, and result number 1-10 on that page). Google Instant should be disabled.

当前为 2015-07-26 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        mmmturkeybacon Numbered Google Results (with 10-per-page mod)
// @author      mmmturkeybacon + clickhappier
// @description Numbers Google search results in the format M.N (page number, and result number 1-10 on that page). Google Instant should be disabled.
// @version     1.0.1.1c
// @namespace   http://userscripts.org/users/523367
// @include     https://www.google.*/search?*
// @include     https://www.google.*/?gws_rd=ssl*
// @require     http://code.jquery.com/jquery-latest.min.js
// @grant       GM_log
// ==/UserScript==


// v1, 2014-02-09 - mmmturkeybacon's original release on userscripts.org (imported to greasyfork on 2014-07-08)
// v1c, 2014-07-02 - modified by clickhappier to add page numbering for 10-result pages
// v1.0.1c, 2015-07-24 - Google's recent formatting changes broke it; rewrote it with jquery in the process of fixing it. 
//                       I saw after finishing that mmmturkeybacon rewrote his version in Mar-Apr 2015 too, and had added
//                       10-per-page support to it now as well as 'easy copy' and some other features, but I guess I'll keep
//                       this around anyway for those who prefer this version.


// If you have Google set to return 10 results per page (default), the first
// page usually has 10 results, but sometimes it will have more or 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 and special results such as images aren't counted.
// "More results from ..." are grouped with the link they are under, as one result.

// Google Instant should be disabled on each Google country domain you use
// (Gear menu -> 'Search Settings' -> 'Never show Instant results.').


function numberIt(jNode)
{

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

    // add 10-per-page #s
    if ( $('table#nav tbody tr td.cur').text().trim().length )
    {
        page_num = $('table#nav tbody tr td.cur').text().trim();
    }
    page_str = page_num + '.';
    // end 10-per-page #s

    $('.g div.rc h3.r').each(function(index)
    {
        if ( $(this).find('span.num').length )
        {
            console.log("numbered");
            return;
        }
        else
        {
            result_num++;
            if (result_num > 10)
            {
                page_num++;
                page_str = page_num + '.';
                result_num = result_num - 10;
            }
        
            $(this).html( '<span class="num">' + page_str + result_num + '</span>' + '&nbsp;-&nbsp;' + $(this).html() );
        }
    });

}

$(document).ready(numberIt);