MediaWiki:Gadget-purgetab.js

出自维基百科,自由个百科全书

注意:垃拉保存之后,侬作兴要清除浏览器个缓存才好看见改变。

  • Firefox或Safari:揿牢“Shift”个同时点击“刷新”,或揿“Ctrl-F5”或“Ctrl-R”(Mac上是“⌘-R”)
  • Google Chrome:揿“Ctrl-Shift-R”(Mac上是“⌘-Shift-R”)
  • Internet Explorer / Edge:揿牢“Ctrl”个同时点击“刷新”,或揿“Ctrl-F5”
  • Opera:去到菜单 → 设置(Mac上是Opera → 偏好设定),再转到隐私&安全 → 清除浏览数据 → 缓存个图片搭文件
/**
 * Add "Purge" content action link.
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Purge_action
 */
if (mw.config.get('wgNamespaceNumber') >= 0)
	$(function () {
		if ($('#ca-purge').length)
			return;
		var node = mw.util.addPortletLink(
			'p-cactions',
			mw.util.getUrl(null, {action: 'purge'}),
			'清除缓存',
			'ca-purge',
			'清除该隻页面个服务器缓存'
		);
		$(node).on('click', function (e) {
			e.preventDefault();
			new mw.Api().post({
				action: 'purge',
				forcelinkupdate: '',
				titles: mw.config.get('wgPageName')
			}).then(
				function () { window.location.reload(); },
				function () { mw.notify('清除失败哉', {type: 'error'}); }
			);
		});
	});