TorrentLeech V4 Enhancer

Enhance TorrentLeech

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

// ==UserScript==
// @name        TorrentLeech V4 Enhancer
// @author      Sandbird
// @description Enhance TorrentLeech
// @namespace   https://openuserjs.org/scripts/Sandbird/TorrentLeech_V4_Enhancer
// @include   https://torrentleech.org/torrents/*
// @include   https://www.torrentleech.org/torrents/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// @require  http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @grant   GM_getValue
// @grant   GM_setValue
// @grant   GM_getResourceURL
// @grant   GM_xmlhttpRequest
// @version     1
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);


function inRange(x, min, max) {
    return min <= x && x <= max;
}

$('td[class = "seeders"]').each(function(){
    var snum = $(this).html();
    $(this).empty();
    var sstyle = '';

    if(inRange(snum, 0, 50)) {
        sstyle = 'style="color:#ffffff"';
    }
    else if(inRange(snum, 51, 100)) {
        sstyle = 'style="color:#f5efd2"';
    }
    else if(inRange(snum, 101, 200)) {
        sstyle = 'style="color:#c0eca9"';
    }
    else if(inRange(snum, 201, 300)) {
        sstyle = 'style="color:#82e3af"';
    }
    else if(inRange(snum, 301, 500)) {
        sstyle = 'style="color:#5db5da"';
    }
    else if(inRange(snum, 501, 800)) {
        sstyle = 'style="color:#4d3bd1"';
    }
    else if(inRange(snum, 801, 1000)) {
        sstyle = 'style="color:#be1cc8"';
    }
    else if(inRange(snum, 1001, 10000000)) {
        sstyle = 'style="color:#bf002d"';
    }
    else{
        sstyle = 'style="font-weight:bold"';
    }

    $(this).append ('<div ' + sstyle + '>' + snum + '</div>');
});


$('*[id*=imdbOnBrowse]').each(function(){
    var imdbOnBrowse = $(this).html();
    $(this).empty();
    var test = imdbOnBrowse.replace(" &nbsp;&nbsp; ", ""); //remove that extra space
    var score = test.split(" ");
    var str1 = score[0];
    if (str1 % 1 != 0) {
	    var end = imdbOnBrowse.replace(str1, '<span style="color:#c0eca9">'+str1+' </span>');
	  } else {
	    var end = imdbOnBrowse;
  	}
	  $(this).append ('<div>' + end + '</div>');
});