User:Cafeinlove/global.js

//////////////////////////////////////////////////////////// // Ajax Batch Delete version [0.0.3] by Grunny // Based on: http://en.wikipedia.org/wiki/User:Splarka/ajaxbatchdelete.js // Converted to use jQuery

$(function {	if (skin === 'monobook') {		addPortletLink('p-tb', wgServer + wgScriptPath + '/index.php?title=Special:BlankPage&blankspecial=ajaxjqbd', '일괄 삭제 도구');	}	else {		$('#my-tools-menu')			.prepend(' 일괄 삭제 도구');	} });

if (wgCanonicalSpecialPageName === 'Blankpage' && $.getUrlVar('blankspecial') === 'ajaxjqbd') { document.title = '일괄 삭제 도구'; $(createAjaxDeleteForm); }

function createAjaxDeleteForm { var pageHeading = (skin === 'oasis') ? ($('.AdminDashboardArticleHeader')		.length ? '.AdminDashboardArticleHeader > h1' : '.WikiaPageHeader > h1') : 'h1.firstHeading', $bodyId = $('#mw-content-text > p'), bdelFormHtml = '' + ' 삭제 이유: ' + '   '; $(pageHeading) .text('일괄 삭제 도구'); $bodyId.text('삭제할 페이지 목록:'); $bodyId.after(bdelFormHtml); }

function ajaxDeleteStart { document.getElementById('abd-startbutton') .setAttribute('disabled', 'disabled'); var txt = document.getElementById('abd-textarea'), deletes = txt.value.split('\n'), page = deletes[0], reason = document.getElementById('abd-reason') .value, badchars = /(\#|\<|\>|\[|\]|\{|\}|\|)/; if (page === '') { $('#abd-output') .append('* Done! Nothing left to do, or next line is blank.\n'); document.getElementById('abd-startbutton') .removeAttribute('disabled'); }	else { if (badchars.test(page)) { $('#abd-output') .append('! Illegal characters detected, skipping:' + page + '\n'); setTimeout(ajaxDeleteStart, 1000); }		else { $('#abd-output') .append('> Attempting to delete ' + page + '\n'); ajaxBatchDeleteAPage(page, reason); }	}	deletes = deletes.slice(1, deletes.length); txt.value = deletes.join('\n'); }

function ajaxBatchDeleteAPage(title, deleteReason) { var url = wgServer + wgScriptPath + '/api.php?action=query&prop=info&intoken=delete&titles=' + encodeURIComponent(title) + '&format=json'; $.getJSON(url, function (data) {		for (var p in data.query.pages) {			break;		}		var ET = data.query.pages[p].deletetoken,			url = wgServer + wgScriptPath + '/api.php?action=delete&title=' + encodeURIComponent(title) + '&reason=' + encodeURIComponent(deleteReason) + '&format=json&token=' + encodeURIComponent(ET);		$.post(url, function { $('#abd-output') .append(' > Deleted\n'); setTimeout(ajaxDeleteStart, 1000); });	}); }

//////////////////////////////////////////////////////////// // PurgeButton by Uberfuzzy revised by Grunny and Pecoes PurgeButtonText = '새로고침'; importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PurgeButton/code.js'    ] });

/////////////////////////////// // Add Sandbox Link $(function{	if (!window.location.hostname.indexOf('ko.') == 0) return;	var a = $('사용자 연습장여러 파일 올리기</li>');	$('#AccountNavigation .subnav').prepend(a); });