v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "User:Lethosor/purge link.js"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(update for 1.32)
(upgrade for MW 1.35)
 
Line 2: Line 2:
 
$(function() {
 
$(function() {
 
var link = $('<a>')
 
var link = $('<a>')
.attr('href', wgScript+'?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge')
+
.attr('href', mw.config.get('wgScript')+'?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge')
 
.text('Purge');
 
.text('Purge');
 
$('#right-navigation #p-cactions ul').append($('<li id="ca-purge">').append(link));
 
$('#right-navigation #p-cactions ul').append($('<li id="ca-purge">').append(link));

Latest revision as of 23:03, 12 November 2022

// Adds a purge link to the navigation menu
$(function() {
	var link = $('<a>')
		.attr('href', mw.config.get('wgScript')+'?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge')
		.text('Purge');
	$('#right-navigation #p-cactions ul').append($('<li id="ca-purge">').append(link));
	link.on('click', function(e) {
		e.preventDefault();
		// https://www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js
		new mw.Api().post({action: 'purge', titles: mw.config.get('wgPageName')}).then(function() {
			location.reload();
		}, function() {
			mw.notify('Purge failed', {type: 'error'});
		});
	});
});