Skip to content

Instantly share code, notes, and snippets.

@owenvoke
Last active February 20, 2018 12:51
Show Gist options
  • Save owenvoke/9ac658d2bd4810350a9608bf01e5fb37 to your computer and use it in GitHub Desktop.
Save owenvoke/9ac658d2bd4810350a9608bf01e5fb37 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name WWT [worldwidetorrents.eu] - Subtitle download links to TV and Movie torrents
// @description Adds download links for subtitles to every TV and movie torrent on WWT (addic7ed & subscene)
// @namespace NotNeo
// @include http*://worldwidetorrents.eu/torrents-details.php*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @version 1.0.1
// @grant none
// ==/UserScript==
$(document).ready(() => {
const btnBar = $(".glyphicon.glyphicon-download").parent().parent().parent();
const cat = $(".category_id_bar").text();
const torrentTitle = $(".fltRight").prev().prev().text();
let baseURL;
if (/^TV.*/ig.test(cat)) {
baseURL = "http://www.addic7ed.com/search.php?search=";
} else if (/^Movies.*/ig.test(cat)) {
baseURL = "https://subscene.com/subtitles/title?q=";
}
btnBar.append(`<a href="${baseURL}${encodeURI(torrentTitle)}" target="_blank" class="btn btn-default"><span class="fa fa-fw fa-comment"></span> Download Subtitles</a>`);
});
@owenvoke
Copy link
Author

Changelog:

  • Removed duplicated code (mostly selector definition)
  • Removed code for changing to + and removing spaces
  • Not entirely sure of the purpose of the for loops. Removed them as it is unrequired (changed to regex and encodeURI())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment