IMDb Netflix Button

Adds Netflix Button

  1. // ==UserScript==
  2. // @name IMDb Netflix Button
  3. // @namespace https://tesomayn.com
  4. // @description Adds Netflix Button
  5. // @include http://*.imdb.com/title/*/
  6. // @include http://*.imdb.com/title/*/?*
  7. // @include http://*.imdb.com/title/*/maindetails
  8. // @include http://*.imdb.com/title/*/combined
  9. // @include http://imdb.com/title/*/
  10. // @include http://imdb.com/title/*/maindetails
  11. // @include http://imdb.com/title/*/combined
  12. // @version 1.0.1
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. $(document).ready( function() {
  17. $('.launch-share-popover').hide();
  18. var header = $('#overview-top h1.header');
  19. var movieTitle = $('span.itemprop', header).text();
  20. var movieYear = $('span.nobr > a', header).text();
  21. $.ajax({
  22. url: 'http://netflixroulette.net/api/api.php?title=' + movieTitle + '&year=' + movieYear + '',
  23. dataType: 'json',
  24. success: function (data) {
  25. var nID = data['show_id'];
  26. $('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>');
  27. },
  28. error: function (xhr, ajaxOptions, thrownError) {
  29. if(xhr.status==404) {
  30. $('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>');
  31. }
  32. }
  33. });
  34. })