IMDb: remove amazon ads

Removes amazon 'Watch now' ads

  1. // ==UserScript==
  2. // @name IMDb: remove amazon ads
  3. // @namespace https://greasyfork.org/en/users/8981-buzz
  4. // @description Removes amazon 'Watch now' ads
  5. // @author buzz
  6. // @require https://code.jquery.com/jquery-2.2.0.min.js
  7. // @version 0.3
  8. // @license GPLv2
  9. // @match *://*.imdb.com/title/tt*
  10. // @grant none
  11. // ==/UserScript==
  12. /* jshint -W097 */
  13. 'use strict';
  14.  
  15. $(function($) {
  16. var $watchbar = $('.watchbar2'), $el;
  17. if ($watchbar.length === 1) {
  18. var $parpar = $watchbar.parent().parent();
  19. if ($parpar.hasClass('article')) {
  20. $el = $parpar;
  21. }
  22. else {
  23. $el = $('.watchbar2').parent();
  24. }
  25. var text = $el.text();
  26. $el.find('script').each(function() {
  27. text = text.replace($(this).text(), '');
  28. });
  29. text = text.toLowerCase();
  30. if (text.indexOf('amazon') > 0 || text.indexOf('watch') > 0 || text.indexOf('disc') > 0) {
  31. $el.hide();
  32. }
  33. else {
  34. $el.show();
  35. }
  36. }
  37. });