Prevent Wikia Ads

Prevent the ads that pop up when clicking a link to an external page on Wikias

当前为 2019-12-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Prevent Wikia Ads
  3. // @namespace https://greasyfork.org/users/649
  4. // @version 1.0.8
  5. // @description Prevent the ads that pop up when clicking a link to an external page on Wikias
  6. // @author Adrien Pyke
  7. // @match *://*.wikia.com/*
  8. // @require https://gitcdn.link/repo/fuzetsu/userscripts/b38eabf72c20fa3cf7da84ecd2cefe0d4a2116be/wait-for-elements/wait-for-elements.js
  9. // @grant GM_openInTab
  10. // ==/UserScript==
  11.  
  12. (() => {
  13. 'use strict';
  14.  
  15. waitForElems({
  16. sel: 'a.exitstitial',
  17. onmatch(link) {
  18. link.onclick = e => {
  19. e.preventDefault();
  20. e.stopImmediatePropagation();
  21. if (e.button === 0) {
  22. location.href = link.href;
  23. } else if (e.button === 1) {
  24. GM_openInTab(link.href, true);
  25. }
  26. return false;
  27. };
  28. link.onauxclick = link.onclick;
  29. }
  30. });
  31. })();