MediaWiki:Gadget-purge.js

Revision as of 04:18, 6 October 2024 by Cronos (talk | contribs) (Created page with "var l10n = (function(){ var $text = { 'buttonlabel': { 'en': 'Purge', 'de': 'Aktualisieren', 'fr': 'Purger', 'ru': 'Обновить', 'pt': 'Actualizar', 'pt-br': 'Actualizar', 'zh': '刷新缓存' }, 'hovertext': { 'en': 'Purge the server cache for this page', 'de': 'Den Server-Cache dieser Seite löschen', 'fr': 'Purge le...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
var l10n = (function(){
    var $text = {
        'buttonlabel': {
            'en': 'Purge',
            'de': 'Aktualisieren',
            'fr': 'Purger',
            'ru': 'Обновить',
            'pt': 'Actualizar',
            'pt-br': 'Actualizar',
            'zh': '刷新缓存'
        },
        'hovertext': {
            'en': 'Purge the server cache for this page',
            'de': 'Den Server-Cache dieser Seite löschen',
            'fr': 'Purge le cache du serveur de cette page',
            'ru': 'Очистить кэш сервера на этой странице',
            'pt': 'Limpe o cache do servidor para esta página',
            'pt-br': 'Limpe o cache do servidor para esta página',
            'zh': '刷新此页面的服务器缓存'
        }
    }
    var $lang = mw.config.get( 'wgUserLanguage' ) || 'en';
    return function(key){
        return $text[key] && ($text[key][$lang] || $text[key]['en']) || '';
    }
})();

$(document).ready(function(){
    var url = new URL(window.location.href);
    url.searchParams.set('action', 'purge');
    mw.util.addPortletLink('p-cactions', url.href, l10n('buttonlabel'), 'ca-gadget-purgecache', l10n('hovertext'), '1');
});