MediaWiki:Gadget-purgetab.js

Origem: Wikilivros, livros abertos por um mundo aberto.

Nota: Após gravar, terá de limpar a cache do seu navegador para ver as alterações. Mozilla / Firefox / Safari: pressione Shift enquanto clica em Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (Command-R num Macintosh); Konqueror:: clique no botão Recarregar ou pressione F5; Opera: limpe a cache em Ferramentas → Preferências (Tools → Preferences); Internet Explorer: pressione Ctrl enquanto clica em Recarregar ou pressione Ctrl-F5.

/* Adiciona botão para purgar a página */
addOnloadHook(function () {
   var hist; var url;
   if (!(hist = document.getElementById('ca-history') )) return;
   if (!(url = hist.getElementsByTagName('a')[0] )) return;
   if (!(url = url.href )) return;
   addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                  'Purgar', 'ca-purge', 'Purgar o cache', '*');
});
 
// [[Categoria:Gadgets|Purgetab.js]]