diff --git a/README.md b/README.md index f43cc60..dd4d35a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ ***Some of scripts I've wrote for personal use but decided to share 'em.*** +# TVMaze -> RARBG + +[This userscript](rarbg.tvmaze.user.js) has a simple task of adding 'rarbg' button on shows page that will open a new tab which will lead to that show on rarbg. + +![RARBG TVmaze](img/tvmaze.rarbg.png "TVMaze -> RARBG bridge") + # TVMaze Episode Counter [This userscript](counter.tvmaze.user.js) has simple task of showing remaining episodes count to finish all of the shows on the [watchlist](http://www.tvmaze.com/watchlist). diff --git a/img/tvmaze.rarbg.png b/img/tvmaze.rarbg.png new file mode 100644 index 0000000..303caf1 Binary files /dev/null and b/img/tvmaze.rarbg.png differ diff --git a/rarbg.tvmaze.user.js b/rarbg.tvmaze.user.js new file mode 100644 index 0000000..595dec0 --- /dev/null +++ b/rarbg.tvmaze.user.js @@ -0,0 +1,35 @@ +// ==UserScript== +// @name TVMaze RARBG +// @namespace tvmaze +// @description add rarbg link to tvmaze show page +// @icon http://tvmazecdn.com/images/favico/favicon.ico +// @author vBm +// @oujs:author vBm +// @license The MIT License (MIT) +// @supportURL https://github.com/vBm/snippets/issues +// @include http://www.tvmaze.com/shows/* +// @version 0.4 +// @date 29/07/2016 +// @grant none +// ==/UserScript== + +$.getJSON( + `//api.tvmaze.com/shows/${$('script:contains(/stats/)').text().match(/\d+/)[0]}` +).done(function(json) { + $('#main-img').append( + $('').attr({ + id: 'watching', + class: 'radius small button secondary rarbg js-needlogin', + target: '_blank', + }).css({ + float: 'right', + width: '100%', + marginTop: '3px' + }).text(' RARBG ').click( + function() { + window.open(`https://rarbg.to/tv/${json.externals.imdb}/`); + } + ) + ); + $('').prependTo('.rarbg'); +});