(function($) {

/*

Twinkle.deprod = function {
	/* 기능 비활성화 : 아직 준비 안 됨 (2020-08-12) */
	if (true) {
		return;

	if (
		mw.config.get('wgNamespaceNumber') !== 14 ||
	) {
		return;
	Twinkle.addPortletLink;

var concerns = {};

Twinkle.deprod.callback = function {
	var Window = new Morebits.simpleWindow;
	Window.setTitle('PROD cleaning');
	Window.setScriptName('Twinkle');
	Window.addFooterLink;
	Window.addFooterLink;

	var form = new Morebits.quickForm(callback_commit);

	var statusdiv = document.createElement('div');
	statusdiv.style.padding = '15px'; // just so it doesn't look broken
	Window.setContent(statusdiv);
	Morebits.status.init(statusdiv);
	Window.display;

	var query = {
		'action': 'query',
		'generator': 'categorymembers',
		'gcmtitle': mw.config.get('wgPageName'),
		'gcmlimit': Twinkle.getPref('batchMax'),
		'gcmnamespace': '0|6|108|2', // mostly to ignore categories
		'prop': [ 'info', 'revisions' ],
		'rvprop': [ 'content' ],
		'inprop': [ 'protection' ]

	var statelem = new Morebits.status('Grabbing list of pages');
	var wikipedia_api = new Morebits.wiki.api('loading...', query, function(apiobj) {
		var $doc = $(apiobj.responseXML);
		var $pages = $doc.find('page[ns!="6"]'); // all non-files
		var list = [];
		var re = /\{\{Proposed deletion/;
		$pages.each(function {
			var $page = $(this);
			var title = $page.attr('title');
			var content = $page.find('revisions rev').text;
			var $editprot = $page.find('pr[type="edit"][level="sysop"]');
			var isProtected = $editprot.length > 0;

			var metadata = [];
			var res = re.exec(content);
			if (res) {
				var parsed = Morebits.wikitext.template.parse;
				concerns[title] = parsed.parameters.concern || '';
				metadata.push(concerns[title]);
			if (isProtected) {
				metadata.push('fully protected' +
					($editprot.attr('expiry') === 'infinity' ? ' indefinitely' : ', expires ' + $editprot.attr('expiry')));
			list.push({
				label: metadata.length ? '(' + metadata.join('; ') + ')' : '',
				value: title,
				checked: concerns[title] !== '',
				style: isProtected ? 'color:red' : ''
		apiobj.params.form.append;
		apiobj.params.form.append({
			type: 'button',
			label: 'Select All',
			event: function(e) {
				$(Morebits.quickForm.getElements).prop;
		apiobj.params.form.append({
			type: 'button',
			label: 'Deselect All',
			event: function(e) {
				$(Morebits.quickForm.getElements).prop;
		apiobj.params.form.append({
			'type': 'checkbox',
			'name': 'pages',
			'list': list
		apiobj.params.form.append({
			'type': 'submit'

		var rendered = apiobj.params.form.render;
		apiobj.params.Window.setContent(rendered);
		Morebits.quickForm.getElements.forEach(function(checkbox) {
			var $checkbox = $(checkbox);
			var link = Morebits.htmlNode;
			link.setAttribute;
			link.setAttribute('href', mw.util.getUrl($checkbox.val));
			link.setAttribute;
			$checkbox.next.prepend;

	wikipedia_api.params = { form: form, Window: Window };
	wikipedia_api.post;

var callback_commit = function(event) {
		var pages = Morebits.quickForm.getInputData(event.target).pages;
		Morebits.status.init(event.target);

		var batchOperation = new Morebits.batchOperation('Deleting pages');
		batchOperation.setOption('chunkSize', Twinkle.getPref('batchChunks'));
		batchOperation.setOption;
		batchOperation.setPageList(pages);
		batchOperation.run(function(pageName) {
			var params = { page: pageName, reason: concerns[page] };

			var query = {
				'action': 'query',
				'titles': pageName,
				'prop': 'redirects',
				'rdlimit': 'max' // 500 is max for normal users, 5000 for bots and sysops
			var wikipedia_api = new Morebits.wiki.api;
			wikipedia_api.params = params;
			wikipedia_api.post;

			query = {
				'action': 'query',
				'titles': 'Talk:' + pageName
			wikipedia_api = new Morebits.wiki.api;
			wikipedia_api.params = params;
			wikipedia_api.post;

			var page = new Morebits.wiki.page;
			page.setEditSummary('Expired PROD, concern was: ' + concerns[pageName] + Twinkle.getPref('deletionSummaryAd'));
			page.suppressProtectWarning;
			page.deletePage;
	callback_deleteTalk = function(apiobj) {
		var $doc = $(apiobj.responseXML);
		var exists = $doc.find('page:not([missing])').length > 0;

		if (!exists) {
		// no talk page; forget about it
			return;

		var page = new Morebits.wiki.page;
		page.setEditSummary('G8: Talk page of deleted page "' + apiobj.params.page + '"' + Twinkle.getPref('deletionSummaryAd'));
		page.deletePage;
	callback_deleteRedirects = function(apiobj) {
		var $doc = $(apiobj.responseXML);
		$doc.find('redirects rd').each(function {
			var title = $(this).attr('title');
			var page = new Morebits.wiki.page;
			page.setEditSummary('G8: Redirect to deleted page "' + apiobj.params.page + '"' + Twinkle.getPref('deletionSummaryAd'));
			page.deletePage;

Twinkle.addInitCallback;