// ==UserScript==
// @name            IPTorrents - Seeding Selector
// @namespace       http://github.com/taeram/user-scripts
// @description     Calculate which are the best FreeLeech torrents to seed to bump up your ratio
// @match           https://www.iptorrents.com/t*
// @match           https://iptorrents.com/t*
// @grant           unsafeWindow
// @copyright       Jesse Patching
// @version         1.4.0
// @license         MIT https://github.com/taeram/user-scripts/blob/master/LICENSE
// @updateURL       https://raw.github.com/taeram/user-scripts/master/iptorrents-seeding-selector.user.js
// @downloadURL     https://raw.github.com/taeram/user-scripts/master/iptorrents-seeding-selector.user.js
// ==/UserScript==

(function() {
    'use strict';

    // Wait for jQuery to finish loading
    var jQueryInterval = setInterval(function () {
        if (typeof unsafeWindow['$'] !== 'undefined') {
            clearInterval(jQueryInterval);
            main();
        }
    }, 100);

    function main () {
        var minNumSeeders = 1;
        var minSeedToLeechRatio = 0.30;

        var $ = unsafeWindow.$;
        var torrents = $('table.torrents tr');
        $('table.torrents tr:first').append('<td>Leecher %</td>');
        for (var i=0; i < torrents.length; i++) {
            var torrent = torrents[i];
            var url = $(torrent).find('.t_title').attr('href');
            if (url) {
                var id = url.replace(/^.*d=/, '');
                var title = $(torrent).find('.t_title').text();
                var numSeeders = parseInt($(torrent).find('.t_seeders').text());
                var numLeechers = parseInt($(torrent).find('.t_leechers').text());
                var seedToLeechRatio = numLeechers / numSeeders;
                $(torrent).append('<td>' + round(seedToLeechRatio * 100, 2) + '%</td>');
                if (numSeeders >= minNumSeeders && seedToLeechRatio >= minSeedToLeechRatio) {
                    $(torrent).attr('style', 'background-color: #1F351F');
                }
            }
        }
    }

    // Retrieved on 2016-06-10 from https://github.com/kvz/locutus/blob/master/src/php/math/round.js
    // Modified for use in IPTorrents - Seeding Selector
    function round (value, precision) {
        //  discuss at: http://locutus.io/php/round/

        var m, f, isHalf, sgn; // helper variables
        // making sure precision is integer
        precision |= 0;
        m = Math.pow(10, precision);
        value *= m;
        // sign of the number
        sgn = (value > 0) | -(value < 0);
        isHalf = value % 1 === 0.5 * sgn;
        f = Math.floor(value);

        if (isHalf) {
            // rounds .5 away from zero
            value = f + (sgn > 0);
        }

        return (isHalf ? value : Math.round(value)) / m;
    }

})();

@@ -405,17 +405,17 @@
     1.4.
-0
+1
 %0A// @lic
@@ -870,25 +870,9 @@
 eof 
-unsafeWindow%5B'$'%5D
+$
  !==
@@ -1124,33 +1124,33 @@
 rents = $('table
-.
+#
 torrents tr');%0A 
@@ -1164,17 +1164,17 @@
 $('table
-.
+#
 torrents
@@ -1195,17 +1195,55 @@
 pend('%3Ct
-d
+h class=%22ac%22 style=%22text-align: center%22
 %3ELeecher
@@ -1773,16 +1773,16 @@
 eeders;%0A
-
         
@@ -1811,16 +1811,43 @@
 end('%3Ctd
+ style=%22text-align: center%22
 %3E' + rou

Fix for latest layout, better jQuery wait method