Crunchyroll Website Cleaner + Popup Mode

This removes premium promotions, shop ads, sn-buttons and adds a Popup feature for non-premium users.

  1. // ==UserScript==
  2. // @name Crunchyroll Website Cleaner + Popup Mode
  3. // @namespace none
  4. // @version 3.8
  5. // @description This removes premium promotions, shop ads, sn-buttons and adds a Popup feature for non-premium users.
  6. // @author TheBone_
  7. // @match *://*.crunchyroll.com/*
  8. // @grant none
  9. // @icon http://www.crunchyroll.com/favicon.ico
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14.  
  15. //Inject JS Code directly into CR
  16. injectjsraw("function customPopupMode() { addGlobalStyle('body.main-page{background-color: black;}'); addGlobalStyle('#template_scroller{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#template_container{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#template_body{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#showmedia_video{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#showmedia_video_box{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#main_content{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#showmedia{background-color: black; width: 100%; height: 100%; position: absolute;}'); addGlobalStyle('#template_container.template-container{background-color: black;width: 100%; height: 100%; position: absolute;}'); $('#showmedia_video_player').attr('height', '100%'); $('#showmedia_video_player').attr('width', '100%'); $('.site-header').remove(); $('#sidebar').remove(); $('#footer').remove(); $('.showmedia-submenu').remove(); $('.white-wrapper').remove(); $('.showmedia-trail').remove(); $('h1').remove(); $('.showmedia-related').remove(); $('.guestbook').remove(); } function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'textconvert/css'; style.innerHTML = css; head.appendChild(style); }");
  17. injectjsraw("function ShowRelated(){ $('.showmedia-related').show(); $('.cshowrelated').remove(); } function ShowComments(){ $('.guestbook').show(); $('.cshowcomments').remove(); }");
  18.  
  19. //UNblockAdBlock
  20. $("[src='http://static.ak.crunchyroll.com/vendor/blockadblock.js']").attr("src", "dummy.js");
  21. $("[src='http://static.ak.crunchyroll.com/versioned_assets/js/components/adblocker_message_strategy.e23f3421.js']").attr("src", "dummy.js");
  22.  
  23. //hide Related Content
  24. $('.showmedia-related').hide();
  25. //remove SN Buttons
  26. $('.facebook').remove();
  27. $('.twitter').remove();
  28. $('.plus-one').remove();
  29. //remove Ads Button
  30. $('.right.clearfix').remove();
  31. //hide News Ticker
  32. $('#message_box').hide();
  33. //remove ShopAds-Slidebox
  34. $('#slidebox').remove();
  35. //remove Free Trial Box
  36. $('#showmedia_free_trial_signup').remove();
  37. //remove Premium Signup in menu
  38. $('#header_try_premium_free').remove();
  39. $('.premium-message').remove();
  40. //remove SN Buttons (Page End)
  41. $("#social_media").remove();
  42. //hide Guestbook
  43. $(".guestbook").hide();
  44. //remove Shop Ads
  45. $("#ecom_deal_img_div").remove();
  46. $("#get_funimation_button").remove();
  47. //remove adblock message
  48. $(".adblocker_message").remove();
  49. //hide Watch on VRV button
  50. $(".watch-dub-on-vrv").hide();
  51. //remove cr-expo ad
  52. $(".cr-expo-banner").remove();
  53.  
  54.  
  55. //add QualityControl to QueueButton
  56. $(".showmedia-btns").appendTo(".showmedia-submenu");
  57. $('.queue-button').attr('style', 'margin-left: 1cm; margin-top: 0.17cm; opacity: 1;');
  58. $(".showmedia-submenu").attr("style"," height: 40px");
  59.  
  60. //modify Playback Problems Button (to Popup Feature)
  61.  
  62. $("<a id='custompopupmodebtn' href='javascript:void(0);' onclick='customPopupMode();' title='Enable Popup Mode (reload page to disable)'>Popup Mode</a>").appendTo(".showmedia-submenu");
  63. //add ShowRelated-Button
  64. $("<p><a class='cshowrelated textconvert-link' onclick='ShowRelated();'>Show Related Titles</a>").appendTo('#showmedia_about_info');
  65. //add ShowComments-Button
  66. $("<p><a class='cshowcomments textconvert-link' onclick='ShowComments();'>Show Comments</a>").appendTo('#showmedia_about_info');
  67.  
  68. //queueBtn Bugfix
  69. var element= document.querySelectorAll("ul.portrait-grid > li.hover-bubble > div > button.queue-button");
  70. $(element).each(function() {
  71. $(this).attr("style", $(this).attr("style") + "opacity: 0;");
  72. });
  73.  
  74. //make sure to kill all ads
  75. killAd();
  76. createCookie('temp_ad_closed',1,7);
  77. })();
  78.  
  79. function injectjs(link) { $('<script type="textconvert/javascript" src="'+link+'"/>').appendTo($('head')); }
  80. function injectjsraw(link) { $('<script type="textconvert/javascript">'+link+'</script>').appendTo($('head')); }
  81. function contains(selector, text) {
  82. var elements = document.querySelectorAll(selector);
  83. return Array.prototype.filter.call(elements, function(element){
  84. return RegExp(text).test(element.textContent);
  85. });
  86. }