High priority

FANDOM has changed how user scripts work

FANDOM has disabled User Scripts from running on MediaWiki and User namespace pages that end with a '.JS' file extension. This severely reduces the effectiveness of this script. It still works on CSS pages, as well as JS pages that are not MediaWiki:Common.js or User:Name/wikia.js and so on but that's it.

You can get AntiUnicruft to apply to all script pages, including the protected ones above, by installing UnsafeScripts as well.

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.js, Common.css and other similar files. It automatically strips several magic invisible characters out of your article when you click Publish/Save.

The problem

Unicode (the way text is stored in your computer) provides several invisible 'magic' characters called 'directional marks'. These special characters are used to switch text from Left-to-Right (e.g. Latin languages) to Right-to-Left (e.g. Arabic). These markers let you mix Right-Left and Left-Right languages in a single file which can be useful when working with text... but cause serious problems when working with code (JavaScript or CSS).

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.

Try copy and pasting the following code into your JavaScript console and run it to see the nastiness in action:

console.log("Confusing, huh?‎" === "Confusing, huh?");


Operational Notes

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).