KAT - Show Cast

Show initial cast as displayed on IMDB

  1. // ==UserScript==
  2. // @name KAT - Show Cast
  3. // @namespace ShowCast
  4. // @version 1.03
  5. // @description Show initial cast as displayed on IMDB
  6. // @include /^https?://kat\.cr/.+-i\d{7}/
  7. // ==/UserScript==
  8.  
  9. var container = $(".dataList").find("div");
  10.  
  11. $.ajaxPrefilter(function(options) {
  12. if(options.crossDomain && jQuery.support.cors) {
  13. var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
  14. options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
  15. //options.url = "http://cors.corsproxy.io/url=" + options.url;
  16. }
  17. });
  18.  
  19. $(container).html('<strong>Cast: <i id="temp">Please be patient, this will load shortly</i></strong>');
  20.  
  21. /** Assign the mode used here
  22. * Stars - Get the 3 stars shown at the top of the page - NOT CURRENTLY IMPLEMENTED
  23. * S - Gets the first 15 actors from the 'Cast Overview' page
  24. * F - Gets the entire cast
  25. **/
  26. var mode = "S";
  27.  
  28. var id = $('a[href^="http://anonym.to/?http://www.imdb.com/"]').text();
  29. if (mode == "S" || mode == "F")
  30. {
  31. $.get('http://myapifilms.com/imdb?idIMDB=tt' + id + '&format=JSON&lang=en-gb&actors=' + mode, function( data )
  32. {
  33. $("#temp").remove();
  34. for (var i = 0; i < data.actors.length; i++)
  35. {
  36. var actor = data.actors[i];
  37. $(container).append('<a href="/movies/actor/' + actor.actorName.replace(" ", "-") + '-a' + actor.actorId.substring(2) + '/">' + data.actors[i].actorName + '</a>, ');
  38. }
  39. $(container).html($(container).html().slice(0,-2));
  40. }, "json");
  41. }