ipt-better

Make IPTorrents less annoying, mainly by removing donation/lottery clutter

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        ipt-better
// @namespace   https://github.com/furwasalreadytaken
// @description Make IPTorrents less annoying, mainly by removing donation/lottery clutter
// @include     https://ipt-update.com/*
// @include     https://www.ipt-update.com/*
// @include     https://iptorrents.com/*
// @include     https://www.iptorrents.com/*
// @version     3
// @grant       GM_addStyle
// ==/UserScript==

// execute the script in the context of the page so we don't need to load jquery again
// nasty, but you know, javscript
// https://stackoverflow.com/questions/14901036
function execute(body) {
    var el = document.createElement("script");
    el.textContent = "(" + body + ")();";
    document.body.appendChild(el);
    return el;
}

execute(function() {
  // make the banner link to the torrents page, not donate
  $(".banner a:first").attr('href', 'https://' + window.location.host + '/t');

  // hide the donate button from the main menu
  $(".butRow a:last").remove();

  // hide the "double your upload" banner
  $('td a[href="/donate.php"]').remove();

  // hide the lottery points indictator thing
  // FIXME: is there not a huge banner ala double your upload when the lottery is active?
  $('.stats div:nth-child(2) a[href="/lottery.php"]').remove();

  // hide the IPT Browser button
  $('.topRow a:contains("IPT Browser")').remove();

  // hide the sketchy-ass non-tls mirrors stuff
  $('.topRow a:contains("Mirrors")').remove();
  $('td a[href="/p/4334880"]').remove(); // "UK members can't access IPT? Use Mirrors!" banner

  // fix their stupid inconsistent 1337 spelling
  // column, row, new text
  var table = [
    [5, 3, "Apps"],
    [5, 4, "Apps/Non-English"],
    [5, 5, "Audiobooks"],
    [5, 11, "Magazines/Newspapers"]
  ];
  for (var i = 0; i < table.length; i++) {
    // does javascript *really* not have a .format method?
    var t = table[i];
    $("td.bottom:nth-child("+t[0]+") label:nth-child("+t[1]+") span a").html(t[2]);
  }
});