Last active
December 30, 2015 05:48
-
-
Save uroshekic/7784587 to your computer and use it in GitHub Desktop.
Automatically adds links to search engines for each new episode. MyEpisodes.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MyEpisodes.com AutoSearch | |
// @namespace myepi | |
// @version 0.1 | |
// @description Automatically adds links to search engines for each new episode. | |
// @match http://www.myepisodes.com/views.php | |
// @copyright 2013+, Uroš Hekić | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js | |
// ==/UserScript== | |
var searchEngines = [ | |
'<a href="http://publichd.se/index.php?page=torrents&search={QUERY}&active=0"><img src="http://publichd.se/favicon.ico" width="12"></a>', | |
'<a href="http://kat.ph/usearch/{QUERY}"><img src="http://kastatic.com/images/favicon.ico" width="12"></a>' | |
]; | |
var eps = $('.Episode_PastOne, .Episode_PastTwo, .Episode_Today'), | |
$children, $name, $title, $ep, name, ep, urls, query; | |
eps.each(function (index) { | |
$children = $(this).children(); | |
$name = $($children[2]); | |
$ep = $($children[3]); | |
$title = $($children[4]); | |
name = $name.text(); | |
ep = $ep.text().split('x'); | |
ep = 'S' + ep[0] + 'E' + ep[1]; | |
query = name + ' ' + ep; | |
urls = searchEngines.join(' '); | |
urls = urls.replace(/{QUERY}/g, query); | |
$title.html($title.html() + '<span style="float: right;">' + urls + '</span>'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment