Large

The Pirate Bay Homepage +

By Matthew Hill Last update Oct 3, 2011 — Installed 2,272 times.

There are 5 previous versions of this script.

// --------------------------------------------------------------------------------
//
// The Pirate Bay Homepage +
// version 0.3 BETA
// 03-10-2011
// Copyright (c) 2010, Matthew Hill
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------------------
//
// ==UserScript==
// @name          The Pirate Bay Homepage +
// @namespace     http://www.userscripts.org/scripts/show/84383
// @description   Improves The Pirate Bay's homepage. Strips adverts and irrelevant links and tidys up the layout.
// @include       http://thepiratebay.org/
// @include       https://thepiratebay.org/
// @include       http://thepiratebay.org/index.php
// @include       https://thepiratebay.org/index.php
// ==/UserScript==
//
// --------------------------------------------------------------------------------
//
document.title = "The Pirate Bay - The world's most resilient BitTorrent website";
var topRight = document.getElementById('topright');
var topBar = document.createElement('div');
var searchField = document.getElementsByTagName('input')[0];
var searchFieldContainer = searchField.parentNode;
var searchButtonsContainer = document.getElementsByTagName('td')[7];
var searchButtonShadow1 = document.createElement('div');
var searchButtonShadow2 = document.createElement('div');
searchFieldContainer.setAttribute('id', 'searchFieldContainer');
document.getElementsByTagName('td')[1].setAttribute('id', 'browseLinksContainer');
searchButtonShadow1.setAttribute('class', 'shadow');
searchButtonShadow2.setAttribute('class', 'shadow');
if (new String(document.getElementsByTagName('a')[10].href) == 'http://thepiratebay.org/logout') {
    var loggedInOut = '<a href="/logout" title="Logout">Logout</a>';
} else {
    var loggedInOut = '<a href="/login" title="Login">Login</a><a href="/register" title="Register">Register</a>';
}
if (document.getElementById('porn')) {
    var searchButton1 = document.getElementsByTagName('input')[8];
    var searchButton2 = document.getElementsByTagName('input')[9];
} else {
    var searchButton1 = document.getElementsByTagName('input')[7];
    var searchButton2 = document.getElementsByTagName('input')[8];
}
topBar.innerHTML = '<div id="topBar"><div id="topBarLeft"><b>Search Torrents</b><a href="/browse" title="Browse Torrents">Browse Torrents</a><a href="/recent" title="Recent Torrents">Recent Torrents</a><a href="/tv" title="TV shows">TV shows</a><a href="/music" title="Music">Music</a><a href="/top" title="Top 100">Top 100</a></div><div id="topBarRight">' + loggedInOut + '</div>';
addGlobalStyle('body {margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 13px;} #topBar {padding: 5px 8px; margin-bottom: 41px; border-bottom: #D2B9A6 1px solid; overflow: hidden; text-align: right;} #topBarLeft {float: left;} #topBarLeft b, #topBarLeft a {margin-right: 10px;} #topBarRight {float: right;} #topBarRight a {margin-left: 10px;} #topleft, #topright, #browseLinksContainer, h3, #foot {display: none !important;} h1 {margin-bottom: 21px;} td {padding: 0;} #searchFieldContainer, .shadow {border-right: #E7E7E7 1px solid; border-bottom: #E7E7E7 1px solid;} .shadow {margin: 6px 2px; display: inline-block;} input[type=text] {width: 488px !important; padding: 5px 6px; margin: 0 !important; border: 1px solid; border-color: #CCC #999 #999 #CCC; font-size: 18px;} input[type=checkbox] {margin: 5px 4px 0 6px;} input[type=submit] {margin: 0 3px;} input[type=submit] {height: 30px; padding: 4px 6px; margin: 0; background: url(http://www.google.co.uk/images/srpr/nav_logo14.png) center bottom; border: 1px solid; border-color: #CCC #999 #999 #CCC; cursor: pointer; font-family: Arial, Helvetica, sans-serif; font-size: 15px;} input[type=submit]:active {background: #CCC;} a, a:visited, a:hover, a:active, a:focus {color: #11C; text-decoration: underline; border: none;} .smalltext a {margin-left: 10px; font-size: 11px; text-decoration: none;} .smalltext a:hover {text-decoration: underline;}');
if (searchField.type = 'search') {
  addGlobalStyle('#searchFieldContainer {border: none;}');
}
topRight.parentNode.insertBefore(topBar, topRight);
searchButtonsContainer.appendChild(searchButtonShadow1);
searchButtonsContainer.appendChild(searchButtonShadow2);
searchButtonShadow1.appendChild(searchButton1);
searchButtonShadow2.appendChild(searchButton2);

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) {
      return
    }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}
//
// --------------------------------------------------------------------------------