This script cleans up a nasty set of head-scratching bugs you can get when you do a lot of copy-pasting of code into
Common.css and other similar files. It automatically strips several magic invisible characters out of your article when you click Publish/Save.
If you've ever been in a situation where you're absolutely sure the code is right but it won't work so you retyped it exactly the same and it magically starts working, these evil little invisible characters were the cause. The reason this happens is that sometimes a program will add a Left-Right mark to your clipboard when you copy text and those marks are then pasted into your code. Since the code is already Left-Right, the mark is pointless and redundant; however, the script engine, being a complete pedant, will make a fuss over it and refuse to behave until those marks are removed.
console.log("Confusing, huh?" === "Confusing, huh?");
The script has no UI or configuration, it's simply set and forget. You can add it to your Wiki's
Common.js if you want to help every admin on your site avoid inadvertently breaking your scripts, or you can add it to your
global.jsto have it work for you on every Wiki (or both).
If you are putting it in
Common.js, then use
The script will only run on Article pages whose names end with '.js' or '.css'. For example, it will run on 'MediaWiki:Common.js', 'User:You/global.js', 'Template:Something/appearance.css'. It will not run on anything that does not have those file extensions (this is a protection mechanism to avoid breaking articles that use directional marks intentionally).