FANDOM


The other day I was thinking about a way to only load scripts that I need on certain namespaces, so... I came up with this.

var Loaded = '1';
if (wgNamespaceNumber == "-1"){var Loaded = '0'; importArticles({ type: "script", articles: [ "w:c:creepypasta:MediaWiki:AjaxRefresh.js", "w:c:creepypasta:MediaWiki:NoLightBox.js", "w:c:creepypasta:MediaWiki:AJAXRollback.js", "w:c:dev:WHAM/code.js",]});}
if (wgNamespaceNumber == "0"){var Loaded = '0'; importArticles({ type: "script", articles: [ "w:c:creepypasta:MediaWiki:Redlinks.js", "w:c:creepypasta:MediaWiki:AJAXRollback.js", "w:c:creepypasta:MediaWiki:AjaxUndo.js", "w:c:dev:AjaxPatrol/code.js",]});}
if (wgNamespaceNumber == "1"){var Loaded = '0'; importArticles({ type: "script", articles: ["w:c:dev:Sine/code.js",]});}
if (wgNamespaceNumber == "2"){var Loaded = '0'; importArticles({ type: "script", articles: ["w:c:dev:AjaxPatrol/code.js", "w:c:creepypasta:MediaWiki:AjaxUndo.js", "w:c:creepypasta:MediaWiki:AJAXRollback.js"]});}
if (wgNamespaceNumber == "3"){var Loaded = '0'; importArticles({ type: "script", articles: ["w:c:dev:Sine/code.js", "w:c:creepypasta:MediaWiki:AjaxUndo.js", "w:c:creepypasta:MediaWiki:AJAXRollback.js"]});}
if (Loaded == '1'){alert('Script load failure');}

So What I want to know is if there is anything else I should be doing with this? (other than adding the other namespaces)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.