Manual talk:Interface/JavaScript


 * Would you please tell me how do I install the Commons.js file into the MediaWiki? Where do I put this file? How do I activate it? Thank you in advance.
 * Write it in your wiki page titled [[MediaWiki:Common.js]]. --almaghi 17:03, 22 July 2009 (UTC)

It's sometimes useful to start your Common.js with "// " and end it with "// " -- Sidcom 23:01, 22 February 2010 (UTC)
 * why is that? --12.46.139.200 17:23, 22 August 2011 (UTC)
 * Because some wikitext still gets parsed in your script file such as --~ . See topic below because I assume this is a bug. --Sebschlicht (talk) 20:51, 28 August 2014 (UTC)

Not working in 1.16.2?
Moved to Project:Support desk; further questions should go there. PleaseStand (talk) 04:24, 16 March 2012 (UTC)

Saving of JS/CSS files
If one edits a JS file and presses the save button, you will get redirected to the "Read"-view. This should not be the default behaviour for a JS file. This also applies to CSS files. Neither does one need a preview of the file itself, but of a wiki page using it. If the save button is clicked, one should stay at the page to do the next edit. Maybe I am missing a point, but at the moment I can't think of any setting where you would want to read the JS/CSS file after an edit. Does someone has an example I there are such settings? --Sebschlicht (talk) 20:51, 28 August 2014 (UTC)


 * Following your same argumentation, when you edit a CSS/JS page and you hit save, you want the CSS/JS applied to the page, so you want to see a page (the one you just edited for example), and not stay on the same edit screen. Staying on the same edit screen will also be confusing, since you won't be certain if the edit was saved or it was rejected without an error. --Ciencia Al Poder (talk) 09:28, 29 August 2014 (UTC)

Wikitext parsing
If your JS file includes strings containing wikitext language such as --~ it will get parsed and replaced as expected on wiki pages. This should not be the default behaviour in a JS file.

You can use //    /* JS goes here */ //

to overcome this issue. --Sebschlicht (talk) 20:51, 28 August 2014 (UTC)