Searx.me - Number Results

Number search results on searx.me.

Tính đến 21-09-2017. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Searx.me - Number Results
// @namespace   r-a-y/searx/search
// @description Number search results on searx.me.
// @version     1.0.4
// @grant       none
// @include     https://searx.me*
// @include     https://search.disroot.org*
// @include     https://search.jpope.org*
// @license     GPL v3
// ==/UserScript==

var currPage = document.querySelector( '.pull-left input[name="pageno"]' ).getAttribute('value'),
    results = document.getElementById("main_results").getElementsByTagName("h4"),
    searxVersion = document.querySelector( 'meta[name="generator"]' ).getAttribute( 'content' ).replace( 'searx/', '' );

if ( parseFloat( searxVersion ) >= 0.11 && 'searx.me' !== window.location.hostname && 'search.jpope.org' !== window.location.hostname ) {
  //currPage = currPage - 2;
}
                                          
for ( i = 0, len = results.length; i < len; ++i ) {
  newSpan    = document.createElement( "span" );
  newSpan.setAttribute( "style", "float:left; font-weight:600; font-size:.9em !important; display:inline-block; margin-top:2px; margin-right:5px;" );

  newContent = document.createTextNode( ( currPage * len + i + 1 ) + ". ");
  newSpan.appendChild( newContent );

  results[i].insertBefore( newSpan, results[i].firstChild );
}