MediaWiki:Gadget-Hotcatcheck.js:修订间差异

MediaWiki系统消息页面
(导入1个版本:​小工具集导入 来源维基共享[页面文字原许可:CC BY-SA 3.0])
(Git更新:代码仓库同步更新)
第1行: 第1行:
/*
* CheckCategories HotCat Extension –
* removes the template when categorizing (prompts before) with HotCat and
* adds a link "Categories are OK" to the category-section
*
* <nowiki>
*
* @rev 2 (2014-03-20)
* @author [[User:Rillke]], 2012
* @source User:Rillke/checkCat2.js @wikimedia Commons
*/

/*global mw:false, $:false, alert:false */
/*jshint curly:false, smarttabs:true, nomen:false */

mw.loader.using(['mediawiki.user', 'mediawiki.util', 'jquery.cookie'], function () {
'use strict';
if (6 !== mw.config.get('wgNamespaceNumber') || window.HotCatAutoRemoveCheckCatOptOut || !$('.checkcategories')[0]) return;

var chCatRE = /\{\{[Cc]heck[ _]categories[^\}\{]*\}\}/g,
selfName = '([[MediaWiki:Gadget-Hotcatcheck.js|Script]]): ',
cookieName = 'checkCat',
cookie = $.cookie(cookieName);

/**
/**
* +--------------------------------------------------------+
** A few styling helper functions
* | === WARNING: GLOBAL GADGET FILE === |
**
* +--------------------------------------------------------+
**/
* | All changes should be made in the repository, |
var createjIcon = function (iconClass) {
* | otherwise they will be lost. |
return $('<span>')
* +--------------------------------------------------------+
.attr('class', 'ui-icon ' + iconClass + ' catcheck-inline-icon')
* | Changes to this page affect many users. |
.text(' ');
* | Please discuss changes at Talk page before editing. |
};
* +--------------------------------------------------------+
var createNotifyArea = function (textNode, icon, state) {
*/
return $('<div>')
/* <nowiki> */
.attr('class', 'ui-widget')
/**
.append(
* SPDX-License-Identifier: CC-BY-SA-4.0
$('<div>')
* _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
.attr({
*
'class': state + ' ui-corner-all',
* @base <https://commons.wikimedia.org/wiki/MediaWiki:Gadget-Hotcatcheck.js>
style: 'margin-top: 20px; padding: 0.7em;'
* @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/HotCat>
})
* @dependency jquery.ui, mediawiki.storage, mediawiki.util, mediawiki.user
.append(
*/
$('<p>').append(
/**
createjIcon(icon).css('marginRight', '0.3em'),
* CheckCategories HotCat Extension –
textNode)));
* removes the template when categorizing (prompts before) with HotCat and
};
* adds a link "Categories are OK" to the category-section
mw.util.addCSS('.catcheck-inline-icon { display: inline-block; position: relative; top: 2px; }');
*

* @rev 2 (2014-03-20)
// Remove "check categories" when using HotCat
* @author Rillke, 2012
// Only executed on first submit
*/
$('body').one('submit.checkCatListener', '#hotcatCommitForm', function (e) {
(function hotCatCheck($, mw) {
if ('disabled' === cookie) return true;
if (mw.config.get('wgNamespaceNumber') !== 6 || window.HotCatAutoRemoveCheckCatOptOut || !$('.checkcategories')[0]) {

return;
var hotCatForm = this,
}
newVal = hotCatForm.wpTextbox1.value.replace(chCatRE, ''),
var chCatRE = /{{[Cc]heck[ _]categories[^{}]*}}/g;
dlgButtons = {},
var selfName = '([[MediaWiki:Gadget-Hotcatcheck.js|Script]]): ';
$dlgCheckCookie, $permaSaveHint, $textHintNode, $dlg;
var storageItemName = 'checkCat';

var storageItem = mw.storage.get(storageItemName);
var doRemove = function () {
/**
hotCatForm.wpSummary.value = 'Removing [[Template:Check categories|{' + '{Check categories}}]] ' + hotCatForm.wpSummary.value;
* A few styling helper functions
hotCatForm.wpTextbox1.value = newVal;
*
* @return {undefined}
*/
var createjIcon = function createjIcon(iconClass) {
return $('<span>').attr('class', "ui-icon ".concat(iconClass, " catcheck-inline-icon")).text(' ');
};
};
var writeCookie = function (val) {
var createNotifyArea = function createNotifyArea(textNode, icon, state) {
return $('<div>').addClass('ui-widget').append($('<div>').attr('class', "".concat(state, " ui-corner-all")).css({
$.cookie(cookieName, val, {
expires: 7,
'margin-top': '20px',
path: '/'
padding: '0.7em'
}).append($('<p>').append(createjIcon(icon).css('marginRight', '0.3em'), textNode)));
});
};
};
mw.util.addCSS('.catcheck-inline-icon{display:inline-block;position:relative;top:2px}');
dlgButtons['Yes, Remove'] = function () {
// Remove "check categories" when using HotCat
// Only executed on first submit
$('body').one('submit.checkCatListener', '#hotcatCommitForm', function (e) {
if (storageItem === 'disabled') {
return true;
}
var self = this;
var newVal = self.wpTextbox1.value.replace(chCatRE, '');
var dlgButtons = {};
var $dlgCheckStorage;
var $permaSaveHint;
var $textHintNode;
var $dlg;
var doRemove = function doRemove() {
self.wpSummary.value = "Removing [[Template:Check categories|{".concat("{Check categories}}]] ".concat(self.wpSummary.value));
self.wpTextbox1.value = newVal;
};
var writeStorage = function writeStorage(val) {
mw.storage.set(storageItemName, val, 6048e2); // 7 days
};
dlgButtons['Yes, Remove'] = function () {
doRemove();
doRemove();
if ($dlgCheckCookie[0].checked) writeCookie('auto');
if ($dlgCheckStorage[0].checked) {
writeStorage('auto');
}
$(this).dialog('close');
$(this).dialog('close');
};
};
dlgButtons['No, keep it'] = function () {
dlgButtons['No, keep it'] = function () {
if ($dlgCheckCookie[0].checked) writeCookie('disabled');
if ($dlgCheckStorage[0].checked) {
writeStorage('disabled');
}
$(this).dialog('close');
$(this).dialog('close');
};
};
var _addToJS = function (e) {
var _addToJS = function _addToJS(_e) {
e.preventDefault();
_e.preventDefault();
if ($permaSaveHint.hasClass('ui-state-disabled')) return;
if ($permaSaveHint.hasClass('ui-state-disabled')) {
return;

}
var $el = $(this);
var $el = $(this);

$el.off('click').text('Please wait.');
$el.off('click').text('Please wait.');
$permaSaveHint.addClass('ui-state-disabled');
$permaSaveHint.addClass('ui-state-disabled');
var params = {
var params = {
action: 'edit',
action: 'edit',
title: 'User:' + mw.config.get('wgUserName') + '/common.js',
title: "User:".concat(mw.config.get('wgUserName'), "/common.js"),
summary: selfName + 'Saving HotCat configuration.',
summary: "".concat(selfName, "Saving HotCat configuration."),
appendtext: $el.data('addText'),
appendtext: $el.data('addText'),
token: (window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken')),
token: window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken'),
format: 'json'
format: 'json'
};
};
var editDone = function (editStat) {
var editDone = function editDone(editStat) {
if (!editStat) return;
if (!editStat) {
return;
if (editStat.error) {
}
alert('Unable to save to your common.js using the API\n' + editStat.error.code + '\n' + editStat.error.info);
if (editStat.error) {
$el.text('Edit-Error!');
mw.notify("Unable to save to your common.js using the API\n".concat(editStat.error.code, "\n").concat(editStat.error.info), {
} else {
$el.text('Done.');
type: 'error'
});
$permaSaveHint.fadeOut();
$el.text('Edit-Error!');
}
} else {
$el.text('Done.');
$permaSaveHint.fadeOut();
}
};
};
$.post(mw.util.wikiScript('api'), params, editDone);
$.post(mw.util.wikiScript('api'), params, editDone);
};
};
/**
/**
** On COM:VP there were people who said:
* On Wikimedia Commons there were people who said:
** "Categorizing with HotCat does legit automated removal of the check-cat-message"
* "Categorizing with HotCat does legit automated removal of the check-cat-message"
** So we invented a dialog that should be readable by users even with very few English skills.
* So we invented a dialog that should be readable by users even with very few English skills.
**/
*/
var prompt = function () {
var prompt = function prompt() {
$dlgCheckCookie = $('<input type="checkbox" />').attr({
$dlgCheckStorage = $('<input>').attr({
type: 'checkbox',
id: 'hotCatAutoRemoveCheckCatCookie'
id: 'hotCatAutoRemoveCheckCatStorage'
}).change(function () {
}).on('change', function () {
if (this.checked) {
if (this.checked) {
$permaSaveHint.fadeIn();
$permaSaveHint.fadeIn();
} else {
} else {
$permaSaveHint.fadeOut();
$permaSaveHint.fadeOut();
}
}
});
});
$textHintNode = $('<ul>');
$textHintNode = $('<ul>');
$('<li>').append($('<a>').attr('href', '#').text('Disable this feature.').data('addText', '\nwindow.HotCatAutoRemoveCheckCatOptOut = true;').on('click', _addToJS)).appendTo($textHintNode);
$('<li>').append($('<a>', {
$('<li>').append($('<a>').attr('href', '#').text('Remove {{check categories}} when editing using HotCat without prompting.').data('addText', '\nwindow.HotCatAutoRemoveCheckCat = true;').on('click', _addToJS)).appendTo($textHintNode);
href: '#',
$permaSaveHint = createNotifyArea($('<span>').text('Save these setting in your common.js: ').append($textHintNode), 'ui-icon-info', 'ui-state-highlight');
text: 'Disable this feature.'
$dlg = $('<div>').append($('<span>').css({
}).data('addText', '\nwindow.HotCatAutoRemoveCheckCatOptOut = true;').click(_addToJS))
'font-size': '2em',
.appendTo($textHintNode);
'line-height': '1.8em'
$('<li>').append($('<a>', {
}).append($('<span>').text(' {{check categories}} ').css({
href: '#',
'background-color': '#F8CCB0',
text: 'Remove {{check categories}} when editing using HotCat without prompting.'
'text-decoration': 'line-through !important',
}).data('addText', '\nwindow.HotCatAutoRemoveCheckCat = true;').click(_addToJS))
display: 'inline-block'
.appendTo($textHintNode);
}), $('<span>').text(' ?'))).append('<br>', $dlgCheckStorage, $('<label>').attr('for', 'hotCatAutoRemoveCheckCatStorage').text("Don't ask again"), '<br>').append(mw.user.isAnon() ? '' : $permaSaveHint.hide());

$permaSaveHint = createNotifyArea($('<span>', {
text: 'Save these setting in your common.js: '
}).append($textHintNode), 'ui-icon-info', 'ui-state-highlight');
$dlg = $('<div>').append($('<span>').attr({
style: 'font-size: 2em; line-height: 1.8em;'
}).append(
$('<span>').text(" {{check categories}} ").attr({
style: 'background-color:#F8CCB0; text-decoration:line-through !important; display:inline-block;'
}),
$('<span>').text(" ?")))
.append('<br>', $dlgCheckCookie, $('<label>').attr({
'for': 'hotCatAutoRemoveCheckCatCookie'
}).text('Don\'t ask again'), '<br>')
.append(mw.user.isAnon() ? '' : $permaSaveHint.hide());

$dlg.dialog({
$dlg.dialog({
modal: true,
modal: true,
closeOnEscape: true,
closeOnEscape: true,
title: "{{check categories}} (−)?",
title: '{{check categories}} (−)?',
width: 450,
width: 450,
buttons: dlgButtons,
buttons: dlgButtons,
close: function () {
close: function close() {
$('#hotcatCommitForm').submit();
$('#hotcatCommitForm').trigger('submit');
},
},
open: function () {
open: function open() {
var $buttons = $(this).parent().find('.ui-dialog-buttonpane button');
var $buttons = $(this).parent().find('.ui-dialog-buttonpane button');
$buttons.eq(0).button({
$buttons.eq(0).button({
icons: {
icons: {
primary: 'ui-icon-circle-check'
primary: 'ui-icon-circle-check'
}
}
});
});
$buttons.eq(1).button({
$buttons.eq(1).button({
icons: {
icons: {
primary: 'ui-icon-cancel'
primary: 'ui-icon-cancel'
}
}
});
});
}
}
});
});
};
};
if (newVal !== hotCatForm.wpTextbox1.value) {
if (newVal !== self.wpTextbox1.value) {
if (window.HotCatAutoRemoveCheckCat || cookie === 'auto') {
if (window.HotCatAutoRemoveCheckCat || storageItem === 'auto') {
doRemove();
doRemove();
return true;
return true;
}
}
e.preventDefault();
e.preventDefault();
prompt();
mw.loader.using(['jquery.ui'], function () {
}
prompt();
return true;
});
}
});
// Add OK-Link to the cats panel
return true;
var $okLink = $('<a>').attr({
});
href: '#',

title: 'Categories are OK! Immediately remove the template.'
// Add OK-Link to the cats panel
}).append('<s>').text('{{Check categories}}');
var $okLink = $('<a>', {
$okLink.on('click', function (e) {
href: '#',
e.preventDefault();
html: '<s>{{Check categories}}</s>',
var $el = $(this);
title: 'Categories are OK! Immediately remove the template.'
}).click(function (e) {
$el.off('click');
var doEdit = function doEdit(result) {
e.preventDefault();
if (!result) {
var $el = $(this);
return;
$el.off('click');
}
var doEdit = function (result) {
if (!result) return;
$el.text('Doing.');
$el.text('Doing.');
var text = result.replace(chCatRE, '');
var text = result.replace(chCatRE, '');
if (text === result) {
if (text === result) {
$el.text('Template not found!');
$el.text('Template not found!');
return;
return;
}
}
var params = {
var params = {
action: 'edit',
action: 'edit',
title: mw.config.get('wgPageName'),
title: mw.config.get('wgPageName'),
nocreate: 1,
nocreate: 1,
summary: selfName + 'Categories are checked and OK. You can help [[Category:Media needing category review|reviewing]]!',
summary: "".concat(selfName, "Categories are checked and OK. You can help [[Category:Media needing category review|reviewing]]!"),
text: text,
text: text,
token: (window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken')),
token: window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken'),
format: 'json'
format: 'json'
};
};
var editDone = function editDone(editStat) {

var editDone = function (editStat) {
if (!editStat) {
if (!editStat) return;
return;
}
if (editStat.error) {
if (editStat.error) {
alert('Unable to remove "Check categories" with the API\n' + editStat.error.code + '\n' + editStat.error.info);
mw.notify("Unable to remove \"Check categories\" with the API\n".concat(editStat.error.code, "\n").concat(editStat.error.info));
$el.text('Edit-Error!');
$el.text('Edit-Error!');
} else {
} else {
$el.text('Edit Done.');
$el.text('Edit Done.');
}
}
$('.checkcategories').fadeOut();
$('.checkcategories').fadeOut();
};
};
$el.text('Doing..');
$el.text('Doing..');
$.post(mw.util.wikiScript('api'), params, editDone);
$.post(mw.util.wikiScript('api'), params, editDone);
};
};
$el.text('Doing');
$el.text('Doing');
$.ajax({
$.ajax({
url: mw.config.get('wgScript'),
url: mw.config.get('wgScript'),
data: {
data: {
action: 'raw',
action: 'raw',
title: mw.config.get('wgPageName').replace(/ /g, '_'),
title: mw.config.get('wgPageName').replace(/ /g, '_')
maxage: 0,
smaxage: 0
},
},
dataType: 'text',
dataType: 'text',
error: function () {
error: function error() {
$el.text('Error!');
$el.text('Error!');
},
},
success: doEdit,
success: doEdit,
type: 'GET',
type: 'GET',
cache: false
cache: false
});
});
$(function () {
$('#catlinks').find('ul:first').append($('<li>').append($okLink));
});
});
});
})($, mw);
/* </nowiki> */
$(function () {
$('#catlinks').find('ul:first').append($('<li>').append($okLink));
});

});
//</nowiki>

2023年5月24日 (三) 23:38的版本

/**
 * +--------------------------------------------------------+
 * |         === WARNING: GLOBAL GADGET FILE ===            |
 * +--------------------------------------------------------+
 * |      All changes should be made in the repository,     |
 * |              otherwise they will be lost.              |
 * +--------------------------------------------------------+
 * |        Changes to this page affect many users.         |
 * |  Please discuss changes at Talk page before editing.   |
 * +--------------------------------------------------------+
 */
/* <nowiki> */
/**
 * SPDX-License-Identifier: CC-BY-SA-4.0
 * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
 *
 * @base <https://commons.wikimedia.org/wiki/MediaWiki:Gadget-Hotcatcheck.js>
 * @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/HotCat>
 * @dependency jquery.ui, mediawiki.storage, mediawiki.util, mediawiki.user
 */
/**
 * CheckCategories HotCat Extension –
 * removes the template when categorizing (prompts before) with HotCat and
 * adds a link "Categories are OK" to the category-section
 *
 * @rev 2 (2014-03-20)
 * @author Rillke, 2012
 */
(function hotCatCheck($, mw) {
	if (mw.config.get('wgNamespaceNumber') !== 6 || window.HotCatAutoRemoveCheckCatOptOut || !$('.checkcategories')[0]) {
	  return;
	}
	var chCatRE = /{{[Cc]heck[ _]categories[^{}]*}}/g;
	var selfName = '([[MediaWiki:Gadget-Hotcatcheck.js|Script]]): ';
	var storageItemName = 'checkCat';
	var storageItem = mw.storage.get(storageItemName);
	/**
	 * A few styling helper functions
	 *
	 * @return {undefined}
	 */
	var createjIcon = function createjIcon(iconClass) {
	  return $('<span>').attr('class', "ui-icon ".concat(iconClass, " catcheck-inline-icon")).text(' ');
	};
	var createNotifyArea = function createNotifyArea(textNode, icon, state) {
	  return $('<div>').addClass('ui-widget').append($('<div>').attr('class', "".concat(state, " ui-corner-all")).css({
		'margin-top': '20px',
		padding: '0.7em'
	  }).append($('<p>').append(createjIcon(icon).css('marginRight', '0.3em'), textNode)));
	};
	mw.util.addCSS('.catcheck-inline-icon{display:inline-block;position:relative;top:2px}');
	// Remove "check categories" when using HotCat
	// Only executed on first submit
	$('body').one('submit.checkCatListener', '#hotcatCommitForm', function (e) {
	  if (storageItem === 'disabled') {
		return true;
	  }
	  var self = this;
	  var newVal = self.wpTextbox1.value.replace(chCatRE, '');
	  var dlgButtons = {};
	  var $dlgCheckStorage;
	  var $permaSaveHint;
	  var $textHintNode;
	  var $dlg;
	  var doRemove = function doRemove() {
		self.wpSummary.value = "Removing [[Template:Check categories|{".concat("{Check categories}}]] ".concat(self.wpSummary.value));
		self.wpTextbox1.value = newVal;
	  };
	  var writeStorage = function writeStorage(val) {
		mw.storage.set(storageItemName, val, 6048e2); // 7 days
	  };
  
	  dlgButtons['Yes, Remove'] = function () {
		doRemove();
		if ($dlgCheckStorage[0].checked) {
		  writeStorage('auto');
		}
		$(this).dialog('close');
	  };
	  dlgButtons['No, keep it'] = function () {
		if ($dlgCheckStorage[0].checked) {
		  writeStorage('disabled');
		}
		$(this).dialog('close');
	  };
	  var _addToJS = function _addToJS(_e) {
		_e.preventDefault();
		if ($permaSaveHint.hasClass('ui-state-disabled')) {
		  return;
		}
		var $el = $(this);
		$el.off('click').text('Please wait.');
		$permaSaveHint.addClass('ui-state-disabled');
		var params = {
		  action: 'edit',
		  title: "User:".concat(mw.config.get('wgUserName'), "/common.js"),
		  summary: "".concat(selfName, "Saving HotCat configuration."),
		  appendtext: $el.data('addText'),
		  token: window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken'),
		  format: 'json'
		};
		var editDone = function editDone(editStat) {
		  if (!editStat) {
			return;
		  }
		  if (editStat.error) {
			mw.notify("Unable to save to your common.js using the API\n".concat(editStat.error.code, "\n").concat(editStat.error.info), {
			  type: 'error'
			});
			$el.text('Edit-Error!');
		  } else {
			$el.text('Done.');
			$permaSaveHint.fadeOut();
		  }
		};
		$.post(mw.util.wikiScript('api'), params, editDone);
	  };
	  /**
	   * On Wikimedia Commons there were people who said:
	   * "Categorizing with HotCat does legit automated removal of the check-cat-message"
	   * So we invented a dialog that should be readable by users even with very few English skills.
	   */
	  var prompt = function prompt() {
		$dlgCheckStorage = $('<input>').attr({
		  type: 'checkbox',
		  id: 'hotCatAutoRemoveCheckCatStorage'
		}).on('change', function () {
		  if (this.checked) {
			$permaSaveHint.fadeIn();
		  } else {
			$permaSaveHint.fadeOut();
		  }
		});
		$textHintNode = $('<ul>');
		$('<li>').append($('<a>').attr('href', '#').text('Disable this feature.').data('addText', '\nwindow.HotCatAutoRemoveCheckCatOptOut = true;').on('click', _addToJS)).appendTo($textHintNode);
		$('<li>').append($('<a>').attr('href', '#').text('Remove {{check categories}} when editing using HotCat without prompting.').data('addText', '\nwindow.HotCatAutoRemoveCheckCat = true;').on('click', _addToJS)).appendTo($textHintNode);
		$permaSaveHint = createNotifyArea($('<span>').text('Save these setting in your common.js: ').append($textHintNode), 'ui-icon-info', 'ui-state-highlight');
		$dlg = $('<div>').append($('<span>').css({
		  'font-size': '2em',
		  'line-height': '1.8em'
		}).append($('<span>').text(' {{check categories}} ').css({
		  'background-color': '#F8CCB0',
		  'text-decoration': 'line-through !important',
		  display: 'inline-block'
		}), $('<span>').text(' ?'))).append('<br>', $dlgCheckStorage, $('<label>').attr('for', 'hotCatAutoRemoveCheckCatStorage').text("Don't ask again"), '<br>').append(mw.user.isAnon() ? '' : $permaSaveHint.hide());
		$dlg.dialog({
		  modal: true,
		  closeOnEscape: true,
		  title: '{{check categories}} (−)?',
		  width: 450,
		  buttons: dlgButtons,
		  close: function close() {
			$('#hotcatCommitForm').trigger('submit');
		  },
		  open: function open() {
			var $buttons = $(this).parent().find('.ui-dialog-buttonpane button');
			$buttons.eq(0).button({
			  icons: {
				primary: 'ui-icon-circle-check'
			  }
			});
			$buttons.eq(1).button({
			  icons: {
				primary: 'ui-icon-cancel'
			  }
			});
		  }
		});
	  };
	  if (newVal !== self.wpTextbox1.value) {
		if (window.HotCatAutoRemoveCheckCat || storageItem === 'auto') {
		  doRemove();
		  return true;
		}
		e.preventDefault();
		prompt();
	  }
	  return true;
	});
	// Add OK-Link to the cats panel
	var $okLink = $('<a>').attr({
	  href: '#',
	  title: 'Categories are OK! Immediately remove the template.'
	}).append('<s>').text('{{Check categories}}');
	$okLink.on('click', function (e) {
	  e.preventDefault();
	  var $el = $(this);
	  $el.off('click');
	  var doEdit = function doEdit(result) {
		if (!result) {
		  return;
		}
		$el.text('Doing.');
		var text = result.replace(chCatRE, '');
		if (text === result) {
		  $el.text('Template not found!');
		  return;
		}
		var params = {
		  action: 'edit',
		  title: mw.config.get('wgPageName'),
		  nocreate: 1,
		  summary: "".concat(selfName, "Categories are checked and OK. You can help [[Category:Media needing category review|reviewing]]!"),
		  text: text,
		  token: window['wikilove-edittoken'] || mw.user.tokens.get('csrfToken'),
		  format: 'json'
		};
		var editDone = function editDone(editStat) {
		  if (!editStat) {
			return;
		  }
		  if (editStat.error) {
			mw.notify("Unable to remove \"Check categories\" with the API\n".concat(editStat.error.code, "\n").concat(editStat.error.info));
			$el.text('Edit-Error!');
		  } else {
			$el.text('Edit Done.');
		  }
		  $('.checkcategories').fadeOut();
		};
		$el.text('Doing..');
		$.post(mw.util.wikiScript('api'), params, editDone);
	  };
	  $el.text('Doing');
	  $.ajax({
		url: mw.config.get('wgScript'),
		data: {
		  action: 'raw',
		  title: mw.config.get('wgPageName').replace(/ /g, '_')
		},
		dataType: 'text',
		error: function error() {
		  $el.text('Error!');
		},
		success: doEdit,
		type: 'GET',
		cache: false
	  });
	});
	$(function () {
	  $('#catlinks').find('ul:first').append($('<li>').append($okLink));
	});
  })($, mw);
  /* </nowiki> */