Open main menu

I'm new here, and not so much on Wikipedia:

My discussion page on WP

TemplateScriptEdit

@Pathoschild: I just found TemplateScript, thought it was a great idea and started to use it. So far, I've been able to get the Regex editor to work – it looks a little simpler than File:Regex editor for TemplateScript.png – but I don't seem to be able to get templates to work. I've tried the main welcome script in both my global.js and my common.js on Wikipedia. Does TemplateScript work on WP? Painius  03:26, 24 October 2015 (UTC)

Hi Paine Ellsworth. You set it up correctly, but your script is configured for the user namespace instead of user talk. I fixed your script's namespace (and fixed the example code); does it work now? —Pathoschild 14:37, 24 October 2015 (UTC)
Yes, thank you! That's much better – now if I want to use a given template in all talk namespaces, would the type be 'all talk' or simply 'talk'? Painius  17:17, 24 October 2015 (UTC)
You could list multiple namespaces with forNamespaces (see TemplateScript#Options), but enabled lets you use your own condition. Replacing the forNamespaces option with this will do it:
enabled: mw.config.get('wgNamespaceNumber') % 2
(Talk namespaces always have an odd number.) —Pathoschild 17:38, 24 October 2015 (UTC)
That is smooth! Thank you so much, because this is going to save me a lot of time! Painius  18:09, 24 October 2015 (UTC)
Return to the user page of "Paine Ellsworth".