IMDb Netflix Button

Adds Netflix Button

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        IMDb Netflix Button
// @namespace   https://tesomayn.com
// @description Adds Netflix Button 
// @include     http://*.imdb.com/title/*/
// @include     http://*.imdb.com/title/*/?*
// @include     http://*.imdb.com/title/*/maindetails
// @include     http://*.imdb.com/title/*/combined
// @include     http://imdb.com/title/*/
// @include     http://imdb.com/title/*/maindetails
// @include     http://imdb.com/title/*/combined
// @version     1.0.1
// @grant       none
// ==/UserScript==

$(document).ready( function() {
    $('.launch-share-popover').hide();
    var header     = $('#overview-top h1.header');
    var movieTitle = $('span.itemprop', header).text();
    var movieYear  = $('span.nobr > a', header).text();
    $.ajax({
        url: 'http://netflixroulette.net/api/api.php?title=' + movieTitle + '&year=' + movieYear + '',
        dataType: 'json',
        success: function (data) {
            var nID = data['show_id'];
            $('td#overview-bottom').append('<a href="http://netflix.com/watch/' + nID + '" id="netflix" class="btn2 primary btn2_text_on large title-trailer" itemprop="netflix" target="_new"><span class="btn2_text">Netflix</span></a>');
        },
        error: function (xhr, ajaxOptions, thrownError) {
            if(xhr.status==404) {
                $('td#overview-bottom').append('<a href="javascript:void();" id="netflix" class="btn2 primary btn2_text_on large title-trailer disabled" itemprop="netflix" target="_new"><span class="btn2_text">Netflix</span></a>');
            }
        }
    });
})