Violentmonkey userscript cannot get @exclude to work for specific URL

6 days ago 14
ARTICLE AD BOX

I have a userscript which changes the layout of Wikipedia to the older style by appending ?useskin=vector to the URL. The script is supposed to exclude URLs with useskin=vector to prevent an endless loop, however, when I navigate to the article for the film Thunderbolts*, it gets stuck in one:

https://en.wikipedia.org/wiki/Thunderbolts*

I'm using Violentmonkey in Firefox.

Here's the userscript:

// ==UserScript== // @name Wikipedia Vector // @namespace Violentmonkey Scripts // @match *://*.wikipedia.org/* // @exclude *://*.wikipedia.org/ // @exclude /useskin=vector/ // @grant none // @version 1.0 // @author - // @run-at document-start // ==/UserScript== (function() { 'use strict'; if(window.location.href.includes("?")) { if(window.location.href.includes("#")) { window.location.replace(window.location.href.substring(0, window.location.href.indexOf('#')) + "&useskin=vector" + window.location.href.substring(window.location.href.indexOf('#'), window.location.href.length)); } else { window.location.replace(window.location.href + "&useskin=vector"); } } else if(window.location.href.includes("#")) { window.location.replace(window.location.href.substring(0, window.location.href.indexOf('#')) + "?useskin=vector" + window.location.href.substring(window.location.href.indexOf('#'), window.location.href.length)); } else { window.location.replace(window.location.pathname + "?useskin=vector"); } })();
Read Entire Article