Talk:Snippets/Purge action

Vector support?
I just tried this script out and it didn't seem to work with Vector. It works fine with Monobook. Has this been tested with Vector? Is there some reason it wouldn't work currently? --MZMcBride 03:14, 25 August 2011 (UTC)
 * How did you try it? When I dump the snippet into the FireBug Console and run it I get a purge link in the p-cactions dropdown menu. Amalthea 07:16, 25 August 2011 (UTC)
 * I put the code at testwiki:User:MZMcBride/killionboob.js (imported into /monobook.js). I have a "*" tab in Monobook, but in Vector I only see protect/delete/move in the drop-down menu (using a URL like http://test.wikipedia.org/wiki/Easytimelinetest?useskin=vector). Chrome/OS X. --MZMcBride 19:33, 25 August 2011 (UTC)
 * Imported in /monobook.js, but not in /vector.js. :) Amalthea 20:15, 25 August 2011 (UTC)
 * Oh, hah. I'm a moron. Thanks. --MZMcBride 22:34, 25 August 2011 (UTC)

Strange loading
$.when(mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.notify']), $.ready).then(function, forgive my ignorance, but can you break down the above line? What is different between this and simply listing the modules as dependencies in the gadget definition? It implies the code has to wait for the modules to load, but does listing the dependencies (or .using) not do that by default?   07:44, 19 May 2016 (UTC)
 * No problem, Edokter! It's like this:
 * is a promise (usable as  or via shortcut.
 * is also a promise. So instead of writing two nested functions like  it's nicer to combine the promises via.
 * Regarding the use of mw.loader in the first place, this is because I want this JavaScript snippet to work even if it is loaded out of context (such as w:MediaWiki:Gadget-UTCLiveClock.js loading MediaWiki:Gadget-UTCLiveClock.js, and many other wikis), and to allow safe copy-and-paste of it anywhere. This is especially common when people use it in a site-wide or user script (which don't have a way to specify dependencies). As always, mw.loader will take not to load things multiple times. It's harmless if they're already loaded as dependencies. --Krinkle (talk) 18:18, 24 May 2016 (UTC)
 * So the note I added is appropriate, as is the way I have done on enwiki? Just making sure my urge to simplify code is not backfiring.  19:05, 24 May 2016 (UTC)