User:Cafeinlove/global.js

//// This scripts affect only for User:Cafeinlove //////////////////////////////////////////////////////////// // NoImageLightbox by Mathmagician importArticle({   type: "script",    article: "w:dev:NoImageLightbox/code.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

(function($, mw) {

'use strict';

var nsNr = mw.config.get('wgNamespaceNumber'), theText = typeof window.PurgeButtonText === 'string' ? window.PurgeButtonText : '새로고침'; //default text, ala SMW

if (nsNr < 0 || window.PurgeButtonsLoaded || document.getElementById('control_purge')) { return; }

window.PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code)

$(addPurgeButton);

function purgePage { var page = encodeURIComponent(mw.config.get('wgPageName')); $.get('/index.php?title=' + page + '&action=purge', function {			location.reload(true);		}); }

function addOasisPurgeButton { var selector; switch (nsNr) { case 500: case 502: selector = $('#WikiaUserPagesHeader'); break; case 2: case 3: selector = $('.UserProfileActionButton'); if (selector.length) break; default: selector = $('#WikiaPageHeader'); }		selector.find('.wikia-menu-button') .first .find('ul') .append('' + theText + ''); }

function addPurgeButton { switch (mw.config.get('skin')) { case 'oasis': case 'wikia': addOasisPurgeButton; break; }

$('#purge') .click(purgePage); } }(jQuery, mediaWiki));

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