MediaWiki talk:Gadget-purgetab.js
![]() | This script, Page Purge, is a JavaScript gadget which can be enabled or disabled in your Preferences. |
![]() |
i18n | Gadget translations:
internationalisation needs to be implemented |
See also
- en:Wikipedia:Purge --Timeshifter (talk) 13:45, 27 September 2010 (UTC)
New code
{{editprotected}}
Please update the code. The current code has $j('#ca-history a')
in it, which is ultra-slow. — Edokter (talk) — 12:59, 4 July 2011 (UTC)
/**
* Action link: Purge (Action menu)
*
* @source: http://www.mediawiki.org/wiki/Snippets/Purge_action
* @rev: 5
*/
$( function () {
if ( !$( '#ca-purge' ).length && mw.config.get( 'wgIsArticle' ) ) {
mw.util.addPortletLink(
'p-cactions',
mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) + '?action=purge',
mw.config.get( 'skin' ) == 'vector' ? 'Purge' : '*',
'ca-purge',
'Purge the server cache of this page',
'*'
);
}
});
- Do you want your code to entirely replace the existing code? That's fine, I just didn't know (and didn't want to screw it up). Killiondude (talk) 18:40, 1 August 2011 (UTC)
Translated label
{{Edit request}}
Is there a reason why the English label "Purge" is used and not a translated label as if {{int:purge}}
was used? --bdijkstra (overleg) 09:43, 23 September 2020 (UTC)
- @Bdijkstra: Probably because the
purge
interface message isn’t available in JS (at least as far as I can tell). I’m disabling the {{Edit request}} because I don’t think it’s actionable at the moment – no specific edit has been proposed/requested and I don’t see a straightforward way to implement the requested functionality. --Lucas Werkmeister (talk) 21:22, 23 November 2020 (UTC)
Done; I added
maxage: 24 * 60 * 60
to the API request getting the message so that it gets cached (client-side, per user) for a day, to reduce overhead and make the gadget load faster (most of the time). --Lucas Werkmeister (talk) 07:43, 5 May 2024 (UTC)
Vector-2022 label
Can someone update this gadget with the version from https://en.wikipedia.org/wiki/MediaWiki:Gadget-purgetab.js ? This should fix the label in the new Vector. It's the only change to the code. —TheDJ (talk • contribs) 11:07, 15 March 2023 (UTC)
- @TheDJ: I've synced the code (this issue has been bugging me for a while), but it doesn't seem to work as far as I can see - any thoughts? Thanks. Mike Peel (talk) 11:49, 1 April 2023 (UTC)
- Ah, now it seems to be working, must have taken a bit of time to get through the cache. Thanks. Mike Peel (talk) 11:50, 1 April 2023 (UTC)
Timeless label
Category:Commons protected edit requests for interface administrators#Gadget-purgetab.jsPlease add "timeless" to the list of skins on line 13. In Timeless, the link is shown as a sidebar entry on wider screens and as a dropdown menu entry on narrower screens, there's no reason it would need a single character label.
A better solution might be to only use "*" if the skin is "monobook", which I assume is what the "*" label is really intended for.
- Nikki (talk) 14:56, 30 March 2024 (UTC)
A better solution might be to only use "*" if the skin is "monobook", which I assume is what the "*" label is really intended for.
I’m not sure about that, to be honest – MediaWiki:Gadget-purgetab says that it’s “an asterisk * in skins other than the default Vector”. Lucas Werkmeister (talk) 07:34, 5 May 2024 (UTC)
Minerva support
Category:Commons protected edit requests for interface administrators#Gadget-purgetab.jsPlease use "p-tb" instead of "p-cactions" (line 11) when the skin is "minerva". This gadget currently doesn't work in Minerva because Minerva does not have an element with the ID "p-cactions". Adding it to "p-tb" will add it to Minerva's dropdown "More" menu.
An icon could also be added for it. Adding this somewhere after line 17 if the skin is "minerva" would use the OOUI reload icon (it does reload the page after purging, so it wouldn't be wrong :)):
node.querySelector(".minerva-icon").classList.add("oo-ui-icon-reload");
And adding this CSS (I would create MediaWiki:Gadget-purgetab.css and then update MediaWiki:Gadgets-definition, but adding it from within the script would be an option too) would make the icon closer in colour to the other Minerva icons:
.minerva-icon-portletlink-t-purge { opacity: 0.65 }