User:Pandecybel/global.js

/* /* ======================================================================== *\   Search box for Mediawiki + search in edit area + replace found text + search and replace with regular expressions + memory (basic functionality) copyright: (C) 2006 Zocky (en:User:Zocky), (C) 2006-2009 Maciej Jaros (pl:User:Nux, en:User:EcceNux) licence:   GNU General Public License v2, http://opensource.org/licenses/gpl-license.php \* ======================================================================== */	// version var sr$ver = '1.4.1'; // -- // // Moduł(y) zewnętrzne // if ((typeof sel_t)!='object' || ((typeof sel_t)=='object' && (typeof sel_t.version)=='string' && sel_t.version.indexOf('1.0')==0)) {	document.write('<'	+'script type="text/javascript" src="'	+'http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/sel_t.js'	+'&action=raw&ctype=text/javascript&dontcountme=s&ver110'	+'"><'	+'/script>'); } if ((typeof nuxedtoolkit)!='object') {	document.write('<'	+'script type="text/javascript" src="'	+'http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/nuxedtoolkit.js'	+'&action=raw&ctype=text/javascript&dontcountme=s&ver106'	+'"><'	+'/script>'); } // // Zmienne globalne // var sr$t;	// sr$t=document.editform.wpTextbox1; var sr$f;	// sr$f=document.srForm; var sr$s;	// sr$s=document.srForm.srSearch; var sr$r;	// sr$r=document.srForm.srReplace; var sr$w;	// sr$w=sr$t.style.width; var sr$i;	// sr$i=document.getElementById('SearchIcon'); var sr$lang = { //	'_num_ ocurrences of _str_ replaced' : '$1 ocurrences of $2 replaced.' //	'_num_ ocurrences of _str_ replaced' : 'Zmieniono $1 wystąpień #$2#.' '_num_ ocurrences of _str_ replaced with _str_' : 'Zmieniono $1 wystąpień [$2] na [$3].', 'searching from the beginning' : 'wyszukiwanie od początku' }; /* Translate also: var srBoxCode = ... function srBack {	if (sr$s.value=='') {		sr$t.focus; return; }	var searchString = sr$s.value; if (!sr$f.srRegexp.checked) searchString = searchString.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1') ;	searchString="("+searchString+")(?![\\s\\S]*"+searchString+")"; if (sr$f.srCase.checked) var re=new RegExp(searchString) else var re=new RegExp(searchString,"i") ;	var res = re.exec (sr$t.value.substring(0,sr$t.selectionStart)); if (!res) var res = re.exec (sr$t.value) ;	if (res) {		sel_t.setSelRange (sr$t, res.index, res.index+res[1].length) }	else sr$t.selectionStart=sr$t.selectionEnd ;	srSync; } function srNext(norev) {	if (sr$s.value=='') {		sr$t.focus; return }	var searchString = sr$s.value; if (!sr$f.srRegexp.checked) searchString=searchString.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1') ;	if (sr$f.srCase.checked) var re=new RegExp(searchString,"g") else var re=new RegExp(searchString,"gi") ;	re.lastIndex=sr$t.selectionEnd; var res = re.exec (sr$t.value) if (!res && !norev) {		sr_msg(sr$lang['searching from the beginning']) re.lastIndex=0; var res = re.exec (sr$t.value) }	if (res) {		sel_t.setSelRange (sr$t, res.index, res.index+res[0].length) }	else sr$t.selectionStart=sr$t.selectionEnd ;	srSync; } function srReplace {	var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; if (sr$s.value=='' || sels==sele) {		sr$t.focus; return; }	var searchString = sr$s.value; var replaceString = sr$r.value; if (!sr$f.srRegexp.checked) {		searchString=searchString.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=replaceString.replace(/([\$\\])/g,'\\$1'); }	if (sr$f.srCase.checked) var re=new RegExp(searchString,"g") else var re=new RegExp(searchString,"gi") ;	re.lastIndex=sels; var res = re.exec (sr$t.value); var $$=0; if (res && res.index==sels && res[0].length==sele-sels) {		if (sr$f.srRegexp.checked) {			replaceString=replaceString.replace(/\\\\/g,'&backslash;').replace(/\\\$/g,'&dollar;'); var replaceBits=(" "+replaceString).split(/(?=\$\d)/); replaceString=replaceBits[0].substring(1); for (var i=1; i<replaceBits.length; i++) {				$$=replaceBits[i][1]-'0'; if ($$<res.length) replaceString += res[$$] + replaceBits[i].substring(2) else replaceString += replaceBits[i] ;			}			replaceString=replaceString.replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/&backslash;/g,"\\").replace(/&dollar;/g,"\$") }		sr$t.value= sr$t.value.substring(0,sels) + replaceString + sr$t.value.substring(sele); }	sr$t.selectionStart=sels; sr$t.selectionEnd=sr$t.value.length-selr; srSync; } function srReplaceall {	//	// get string var str = sel_t.getSelStr(sr$t, true); //	// get attributes var searchString = sr$s.value; var replaceString = sr$r.value; if (!sr$f.srRegexp.checked) {		searchString=searchString.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=replaceString.replace(/([\$\\])/g,'\\$1'); }	else {		replaceString=replaceString.replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/&backslash;/g,"\\").replace(/&dollar;/g,"\$") }	var re=new RegExp(searchString, (sr$f.srCase.checked ? "g" : "gi")); //	// check for ocurrences var matchesArr = str.match(re); //	// run str = str.replace(re, replaceString); //	// output sel_t.qsetSelStr(sr$t, str, true); // focus sr$t.focus; //	// show num of ocurrences if (matchesArr.length) {		sr_msg(sr$lang['_num_ ocurrences of _str_ replaced with _str_'].replace(/\$1/, matchesArr.length).replace(/\$2/, sr$s.value).replace(/\$3/, sr$r.value)); }	return; } function srToggleCase {	var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; var selt=sr$t.value.substring(sels,sele); if (sele>sels) {		if (selt==selt.toUpperCase) selt=selt.toLowerCase else if (selt==selt.toLowerCase && sele-sels>1) selt=selt.substring(0,1).toUpperCase+selt.substring(1).toLowerCase else selt=selt.toUpperCase ;		sr$t.value = sr$t.value.substring(0,sels) + selt + sr$t.value.substring(sele); sr$t.selectionStart=sels; sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; }	srSync; } function srSync_old {	var i;	var allLines=0; var lineNo=0; var w=sr$t.cols-5; var dummy=sr$t.value.split("\n"); for (i=0;i<dummy.length;i++){allLines+=Math.ceil(dummy[i].length/w)} var dummy=sr$t.value.substring(0,sr$t.selectionStart).split("\n"); for (i=0;i<dummy.length;i++){lineNo+=Math.ceil(dummy[i].length/w)} //	alert (w+" "+lineNo+"/"+allLines); sr$t.scrollTop=sr$t.scrollHeight*(lineNo-10)/allLines; sr$t.focus; } function srSync {	var input = sr$t; // IE	/* if (document.selection) {		//input.focus; var range = document.selection.createRange; if (range.parentElement==input) {			range.scrollIntoView(true); // at top }		else if (input.selectionStart) {			sel_t.setSelRange(input, input.selectionStart, input.selectionEnd) }	}	*/	if (document.selection) {	}	// fox else {		sel_t.ScrollIntoView(input, input.selectionStart, input.selectionEnd); } /*	sr$t.focus; } function srInit {	if(document.getElementById('wpTextbox1')) {		var srBoxCode = ' ' +' '					+' '						+' znajdź: '						+'' +' '					+' '						+' zamień na: '						+'' +' '					+' '						+' uwzględnij wielkość liter ' +' użyj RegEx ' +' '						+'&lt; ' +'szukaj &gt;&emsp;' +'&lt; ' +'zamień ' +'&gt;&emsp;' +'zamień wszystkie</a>&emsp;' +' '				+' '				+' '					+' '						+'MR</a>' +' Wiki2HTML</a>' +' HTMLSpecialChars</a>' +' '				+' '				+' '			+' '		;		//document.getElementById('searchInput').accessKey='none'; sr$t=document.editform.wpTextbox1; sr$w=sr$t.style.width; //		// inserting buttons nuxedtoolkit.prepare; var group_el = nuxedtoolkit.addGroup; var btn_attrs = { title : 'Wyszukiwanie i zamiana (wer. '+sr$ver+')', alt : "Szuk.", style : "width:auto;height:auto", id : 'SearchIcon' }		var icons = { oldbar : 'http://upload.wikimedia.org/wikipedia/en/1/12/Button_find.png', newbar : 'http://commons.wikimedia.org/w/thumb.php?f=Crystal_Clear_action_viewmag.png&width=21px' }		nuxedtoolkit.addBtn(group_el, 'srShowHide', icons, btn_attrs) var btn_attrs = { title : 'Zmiana wielkości liter', alt : "Wlk. lit.", style : "width:auto;height:auto" }		var icons = { oldbar : 'http://upload.wikimedia.org/wikipedia/commons/1/12/Button_case.png', newbar : 'http://commons.wikimedia.org/w/thumb.php?f=Wynn.svg&width=23px' }		nuxedtoolkit.addBtn(group_el, 'srToggleCase', icons, btn_attrs) /**/		// fix access key sr$i=document.getElementById('SearchIcon'); sr$i.accessKey="F"; //		// inserting search box var srbox=document.createElement('div'); srbox.innerHTML=srBoxCode; srbox.firstChild.style.display='none'; //el=document.getElementById('editform'); el=document.getElementById('wpTextbox1'); el.parentNode.insertBefore(srbox,el); sr$f=document.srForm; sr$s=document.srForm.srSearch; sr$r=document.srForm.srReplace; //		// inserting message box if (document.editform.messages == undefined) {			el=document.createElement('textarea'); el.cols=sr$t.cols; el.style.cssText=sr$t.style.cssText; el.rows=5; el.id='messages'; el.style.display='none'; el.style.width='auto'; sr$t.parentNode.insertBefore(el,sr$t.nextSibling); }	}	// defaults //sr_mem.remind; //sr$f.srRegexp.checked = true; } function srShowHide {	if (sr$f.style.display=='none') {		var width_pre = sr$t.clientWidth; document.editform.messages.style.display='block'; sr$f.style.display='block'; sr$i.accessKey="none"; sr$t.style.width='auto'; sr$s.focus; var width_post = sr$t.clientWidth; if (width_post != width_pre) {			sr$t.cols = Math.floor(width_pre * sr$t.cols / width_post); }	}	else {		document.editform.messages.style.display='none'; sr$f.style.display='none'; sr$t.style.width=sr$w; sr$i.accessKey="F"; } } addOnloadHook(srInit); // document.write('<link rel="stylesheet" type="text/css" href="' +'http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/SearchBox.css' +'&action=raw&ctype=text/css&dontcountme=s">'); // // Memory // var sr_mem = new Object; sr_mem.s = new Array(	//'(.*)(\\n\\n|$)'	'((.|.\\n.)+)(\\n\\n|$)' ); sr_mem.r = new Array(	' $1 \\n\\n' ); sr_mem.index = -1; sr_mem.remind = function {	sr_mem.index++; sr_mem.index%=sr_mem.s.length; sr$s.value = sr_mem.s[sr_mem.index]; sr$r.value = sr_mem.r[sr_mem.index]; } // // Zamiana seryjna // var sr_seria = new Object; sr_seria.s = new Array(	'\\*[ ]?(.*)\\n',	'(<li>(.|\\n)*</li>)',	'([ \\n><,.])"',	'"([ \\n><,.])',	' > ',	' < ',	' - ' ); sr_seria.r = new Array(	'<li>$1</li>\\n',	'<ul>\\n$1\\n</ul>',	'$1„',	'”$1',	' → ',	' ← ',	' – ' ); var sr_seria_htmlspecialchars = new Object; sr_seria_htmlspecialchars.s = new Array(	'&',	'>',	'<' ); sr_seria_htmlspecialchars.r = new Array(	'&amp;',	'&gt;',	'&lt;' ); function sr_mass_rep(obj) {	//	// always as regExp //	var prev_ser_RE = sr$f.srRegexp.checked; sr$f.srRegexp.checked = true; //	// always from the beginning //	/*	// sr$t.selectionStart = sr$t.selectionEnd = 0; if (sr$t.selectionStart == sr$t.selectionEnd) {		sr$t.selectionStart = sr$t.selectionEnd = 0; }	*/	var user_sel_start = sr$t.selectionStart; var user_sel_end = sr$t.selectionEnd; var field_len = sr$t.value.length; var field_len_diff = 0; //	// replace //	for (var i=0; i<obj.s.length; i++) {		sr$s.value = obj.s[i]; sr$r.value = obj.r[i]; srReplaceall; // recalculate end of the user's selection if (user_sel_start!=user_sel_end) {			field_len_diff = sr$t.value.length - field_len; // change after replacing stuff user_sel_end += field_len_diff; field_len = sr$t.value.length; }		sr$t.selectionStart = user_sel_start; sr$t.selectionEnd = user_sel_end; }	//	// previous settings //	sr$f.srRegexp.checked = prev_ser_RE; } // // Messages // function sr_msg(str) {	document.editform.messages.value = str+'\n'+document.editform.messages.value; }
 * Instrukcja obsługi: Narzędzia/Wyszukiwanie i zamiana
 * Autorzy: en:User:Zocky, Maciej Jaros pl:User:Nux
 * Wykorzystana wersja skryptu Zocky: http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js&oldid=60000195

var del$loadingLinks = 'Wczytywanie linkujących...'; var del$loadingHistory = 'Wczytywanie historii zmian...';

var del$noLinks = ' Brak linkujących ';

var del$linksHeader = 'Linkujące (pierwsze $1) '; var del$historyHeader = 'Historia i autorzy (ostatnie $1) ';

var del$showAllCaption = 'pokaż wszystkie';

var del$talkNamespace = /(?:talk$|^dyskusja)/i;

var del$redirect = /#REDIRECT/i; var del$speedy = /\{\{(?:ek|delete|speedy)\|(?:1=)?(.+?)(?:\}\}|$)/i;

var del$speedyCaption = "z eka"; var del$speedyReason = "z eka: $1";

// - // Ustawienia domyślne - przycisków // -

if (!del_buttons) {	var del_buttons = new Array(		"general",	// identyfikator grupy (nie zmieniać i nie dodawać)		"",		// etykieta		new Array (	// przyciski "nieency",	// etykieta "wpis został uznany za nieencyklopedyczny",	//wstawiany tekst "substub", "wpis został usunięty z powodu zbyt małej ilości treści - substub", "eksperyment", "wpis został uznany za eksperyment edycyjny", "bełkot", "wpis usunięty z powodu niezrozumiałej treści", "wulgaryzmy", "wpis usunięty z powodu umieszczonych w nim wulgaryzmów", "wygłup", "wpis usunięty - wygłup", "reklama", "wpis uznany za reklamę", "npa", "wpis usunięty z powodu naruszenia praw autorskich", "forma", "wpis usunięto z powodu nieodpowiedniej formy", "zbędne", "artykuł zbędny", "nazwa", "nieprawidłowa nazwa" ),		"talk",		"dyskusja",		new Array ( "forum", "strona dyskusji to nie forum", "stare", "stare", "sierotka", "sierotka", "odpowiedziano", "odpowiedziano na stronie dyskusji użytkownika" ),		"img",		"grafika",		new Array ( "tech", "usunięte z powodów technicznych", "nazwa", "nieinformatywna nazwa pliku", "zbędne", "zbędna/nieużywana grafika", "dubel", "dubel" ),		"redir",		"przekierowanie",		new Array ( "zbędne", "zbędne przekierowanie", "zerwane", "zerwane przekierowanie", "błędne", "błędne przekierowanie" ),		"tech",		"porządki",		new Array ( "pusta kategoria", "pusta kategoria", "dubel", "dubel", "zbędna", "zbędna strona" )	); }

var pt$times = { "godzina"	: "1 hour", "2 godziny"	: "2 hours", "6 godzin"	: "6 hours", "dzień "	: "1 day", "3 dni "	: "3 days", "tydzień"	: "1 week", "2 tygodnie"	: "2 weeks", "miesiąc"	: "1 month", "na zawsze"	: "infinite" };

var pt$reasons = { "wandalizm"	: "częste wandalizmy", "wygłupy"	: "wygłupy", "spam"	: "spam", "wojna"		: "wojna edycyjna", "nieency"	: "nieencyklopedyczne wpisy" };

var bk$times = pt$times;

var bk$reasons = { "wandal"	: "wandalizm", "blanking"	: "kasowanie zawartości artykułów (blanking)", "wygłupy"	: "wygłupy", "wulg"	: "wulgaryzmy", "npa"	: "łamanie praw autorskich", "spam"	: "nagminne dodawanie linków zewnętrznych (spam)", "ency"	: "nagminne dodawanie nieencyklopedycznych wpisów", "wer"	: "nagminne dodawanie informacji niepopartych źródłami", "ataki"		: "ataki osobiste", "hoax"		: "wprowadzanie fałszywych informacji (hoaxy)", "konto"		: "konto stworzone do wandalizmów", "pacynka"		: "niedozwolone użycie pacynki", };

// - // Ustawienia domyślne - linkujące oraz historia // -

// maksymalna ilość pobieranych linkujących, 0 - nie pobiera try { del_max_links = del_max_links } catch (e) { del_max_links = 10 }

// maksymalna ilość pobieranych wpisów z historii, 0 - nie pobiera try { del_max_versions = del_max_versions } catch (e) { del_max_versions = 5 }

// czy włączony jest tryb hardcode? try { del_hardcore = del_hardcore } catch (e) { del_hardcore = 0 }

// czy włączone jest podświetlanie linku do strony dyskusji try { del_talk_highlight = del_talk_highlight } catch (e) { del_talk_highlight = 1 }

// tak, wiem... ale nie wymyśliłem nic lepszego...

// - // Fragment kodu z LiveRC

// -

var wpajax = { http: function(bundle) { // mandatory: bundle.url // optional: bundle.async // optional: bundle.method // optional: bundle.headers // optional: bundle.data // optional: bundle.onSuccess (xmlhttprequest, bundle) // optional: bundle.onFailure (xmlhttprequest, bundle) // optional: bundle.otherStuff OK too, passed to onSuccess and onFailure var xmlhttp; try { xmlhttp = new XMLHttpRequest; } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false }			}		}

if (xmlhttp) { xmlhttp.onreadystatechange = function { if (xmlhttp.readyState == 4) wpajax.httpComplete(xmlhttp,bundle); };			xmlhttp.open(bundle.method ? bundle.method : "GET",bundle.url,bundle.async == false ? false : true); if (bundle.headers) { for (var field in bundle.headers) xmlhttp.setRequestHeader(field,bundle.headers[field]); }			xmlhttp.send(bundle.data ? bundle.data : null); }		return xmlhttp; },

httpComplete: function(xmlhttp,bundle) { if (xmlhttp.status == 200 || xmlhttp.status == 302) { if (bundle.onSuccess) bundle.onSuccess(xmlhttp,bundle); } else if (bundle.onFailure) { bundle.onFailure(xmlhttp,bundle); } else { // A activer en debug mode ? // alert(xmlhttp.statusText); }	} };

// Parser if (document.implementation.createDocument) { var gml_xmlparser = new DOMParser; }

function gml_XMLParse(string) { if (document.implementation.createDocument) { return gml_xmlparser.parseFromString(string, "text/xml"); } else if (window.ActiveXObject) { var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM"); gml_xmldoc.async = "false"; ret = gml_xmldoc.loadXML(string); if (!ret) return null; return gml_xmldoc.documentElement; }	return null; }

// -

function del$callAPI(query) { var url = wgServer + wgScriptPath + '/api.php?'; for (var field in query) { var value = query[field]; url += '&' + field + '=' + encodeURIComponent(value); }	url += '&format=json'; importScriptURI(url); }

function del$gotHist(xmlreq, data) {	var doc = gml_XMLParse(xmlreq.responseText); var bodyContent = doc.getElementById('bodyContent')

var history_content = document.getElementById( 'history_content' ); history_content.innerHTML = '';

for (var i=0; i< bodyContent.childNodes.length; i++) {		var tagName = bodyContent.childNodes[i].tagName; if (tagName && tagName.toLowerCase == 'form') {			history_content.appendChild(bodyContent.childNodes[i]); return; }	}	history_content.appendChild(bodyContent); }

function del_gotBackLinks(data) {	var links_content = document.getElementById( 'links_content' );

var titles = new Array; for (var id in data.query.backlinks) { var page = data.query.backlinks[id]; titles.push( page.title ); }	del$addLinks(links_content, titles); }

function del_gotImageUsage(data) {	var links_content = document.getElementById( 'links_content' );

var titles = new Array; for (var id in data.query.imageusage) { var page = data.query.imageusage[id]; titles.push( page.title ); }

del$addLinks(links_content, titles); }

function del$addLinks(container, list) {	if (list.length > 0) { var ul = document.createElement('ul'); for (var i = 0; i < list.length; i++) { var title = list[i]; var li = document.createElement('li'); var link = document.createElement('a'); link.title = title; link.href = wgScript + "?title=" + encodeURIComponent(title); link.appendChild( document.createTextNode(title) ); li.appendChild(link); ul.appendChild(li); }		container.innerHTML = ''; container.appendChild(ul); return; }

container.innerHTML = del$noLinks; }

function del$createButtons(parentNode, buttonArray) {	for (var j = 0; j < buttonArray.length; j+=2) {		var newButton = document.createElement('a');

// atrybuty newButton.title = buttonArray[j+1]; newButton.onclick = function { del$insertReason(this.title) }; newButton.appendChild(document.createTextNode(buttonArray[j]));

// dodanie przycisku parentNode.appendChild(newButton); } }

function del$createGroup(id, caption, buttonArray) {	tr = document.createElement('tr'); tr.id = "del_" + id;

td_caption = document.createElement('td'); td_caption.align = 'right'; td_caption.appendChild( document.createTextNode(caption) ); tr.appendChild(td_caption); td_buttons = document.createElement('td'); td_buttons.align = 'left'; td_buttons.id = 'userSummaryButtons'; del$createButtons(td_buttons, buttonArray); tr.appendChild(td_buttons); return tr; }

function del$showAll {	for (var i = 0; i < del_buttons.length; i+=3) {		var group = del_buttons[i]; document.getElementById("del_" + group).style.display = ''; }	document.getElementById("del_general").cells[0].style.visibility = 'hidden'; }

function del$imageForm {	// zmienił się sposób usuwania plików // należy dodać brakujące elementy formularza var wpReason = document.getElementById('wpReason'); var button = document.getElementById('mw-filedelete-submit'); var table = wpReason.parentNode.parentNode.parentNode; var tr = document.createElement('tr'); var td_left = document.createElement('td'); var td_right = document.createElement('td');

td_right.appendChild(button); tr.appendChild(td_left); tr.appendChild(td_right); table.appendChild(tr); return tr; }

function del$init { var current_group = ''; var defaultReason = ''; var catalk = document.getElementById('ca-talk'); if ( del_talk_highlight && catalk.className == '') { catalk.style.textDecoration = 'blink'; catalk.firstChild.style.backgroundColor = 'orange'; }	var wpReason = document.getElementById('wpReason'); if ( wpReason ) { wpReason.parentNode.align = "left"; wpReason.style.width = "100%"; defaultReason = wpReason.value; wpReason.value = ''; }	var tr_watch; if (wgNamespaceNumber == 6 && !document.getElementById('wpConfirmB')) {		current_group = 'img'; tr_watch = del$imageForm; }	else {		var wpWatch = document.getElementById('wpWatch'); tr_watch = wpWatch.parentNode.parentNode; }	var table= tr_watch.parentNode; if (defaultReason.match( del$redirect )) {		current_group = 'redir'; }	else if (wgCanonicalNamespace.match( del$talkNamespace ) ) {		current_group = 'talk'; }	else if (wgNamespaceNumber == 14) {		current_group = 'tech'; }	else if (wgNamespaceNumber == 6) {		current_group = 'img'; }	else if (defaultReason.match(/\{\{(?:Pocz)?SDU/i)) {		current_group = 'tech'; }

for (var i = 0; i < del_buttons.length; i+=3) {		var group = del_buttons[i]; var caption = del_buttons[i+1]; var buttons = del_buttons[i+2]; var new_tr = del$createGroup(group, caption, buttons);

if (group == 'general') {			var newButton = document.createElement('a'); // atrybuty newButton.appendChild(document.createTextNode(del$showAllCaption)); newButton.onclick = del$showAll; newButton.style.cursor = 'pointer'; // dodanie przycisku new_tr.firstChild.appendChild(newButton); }		else if (group == current_group) {			new_tr.firstChild.style.fontWeight = 'bold'; }		else {			new_tr.style.display = 'none'; }		table.insertBefore(new_tr, tr_watch); }

var speedy_found = defaultReason.match( del$speedy );

if (speedy_found) {		var newButton = document.createElement('a'); // atrybuty newButton.appendChild(document.createTextNode(del$speedyCaption)); newButton.title = del$speedyReason.replace('$1', speedy_found[1]); newButton.onclick = function { del$insertReason(this.title) };

// dodanie przycisku document.getElementById('del_general').lastChild.appendChild(newButton); }

var bodyContent = document.getElementById('bodyContent'); var deletionlog = document.getElementById('mw-article-delete-deletionlog'); if (del_max_versions > 0) {		var history_header = document.createElement('h2'); history_header.innerHTML = del$historyHeader.replace('$1', del_max_versions); bodyContent.insertBefore(history_header, deletionlog);

var history_content = document.createElement('div'); history_content.id = 'history_content'; history_content.innerHTML = del$loadingHistory; bodyContent.insertBefore(history_content, deletionlog);

wpajax.http({url:wgServer + wgScript + '?limit=' + del_max_versions + '&title=' + encodeURIComponent(wgPageName) + '&action=history', onSuccess: del$gotHist, message: wgPageName }); }

if (del_max_links > 0) {		var links_header = document.createElement('h2'); links_header.innerHTML = del$linksHeader.replace('$1', del_max_links); bodyContent.insertBefore(links_header, deletionlog);

var links_content = document.createElement('div'); links_content.id = 'links_content'; links_content.innerHTML = del$loadingLinks; bodyContent.insertBefore(links_content, deletionlog);

if (wgNamespaceNumber == 6) // media del$callAPI({				action:	'query',				list:	'imageusage',				iulimit:	del_max_links,				iutitle:	wgPageName,				callback:	'del_gotImageUsage'			}); else del$callAPI({				action:	'query',				list:	'backlinks',				bllimit:	del_max_links,				bltitle:	wgPageName,				callback:	'del_gotBackLinks'			}); } }

function del$insertReason(reason) {	var element = document.getElementById('wpReason');

element.value = reason;

if (del_hardcore) {		element.form.submit; } }

function pt$init {	var expires = document.getElementById('expires'); var td = expires.parentNode;

td.appendChild(document.createElement('br')); td.id = 'userSummaryButtons'; for (var caption in pt$times) {		var newButton = document.createElement('a');

// atrybuty newButton.title = pt$times[caption]; newButton.onclick = function { expires.value = this.title; }; newButton.appendChild(document.createTextNode(caption));

// dodanie przycisku td.appendChild(newButton); }

var reason = document.getElementById('mwProtect-reason'); var td = reason.parentNode;

td.appendChild(document.createElement('br')); td.id = 'userSummaryButtons'; for (var caption in pt$reasons) {		var newButton = document.createElement('a');

// atrybuty newButton.title = pt$reasons[caption]; newButton.onclick = function { reason.value = this.title; }; newButton.appendChild(document.createTextNode(caption));

// dodanie przycisku td.appendChild(newButton); }

// Fragment z, autor: Alex Smotrov var inp = document.getElementById('mw-Protect-Form') if (inp) addHandler(inp, 'change', noMoveAutoconfirmedProtection) function noMoveAutoconfirmedProtection{ inp = document.getElementById('mwProtectUnchained') if (!inp || inp.checked) return inp = document.getElementById('mwProtect-level-move') if (inp && inp.selectedIndex==1) inp.selectedIndex = 0 } }

function bk$setExpiry(wpBlockExpiry, wpBlockOther, value) { var listed = false; for (var i = 0; i < wpBlockExpiry.options.length; i++) { if (wpBlockExpiry.options[i].value == value) { listed = true; }	}	if (listed) { wpBlockExpiry.value = value; if (wpBlockExpiry.onchange) wpBlockExpiry.onchange(wpBlockExpiry); }	else { wpBlockExpiry.value = 'other' wpBlockOther.value = value; } }

function bk$init {	var wpBlockExpiry = document.getElementById('wpBlockExpiry'); var wpBlockOther = document.getElementById('mw-bi-other'); var td = wpBlockExpiry.parentNode;

td.appendChild(document.createElement('br')); td.id = 'userSummaryButtons';

for (var caption in bk$times) {		var newButton = document.createElement('a'); // atrybuty newButton.title = bk$times[caption]; newButton.onclick = function { bk$setExpiry(wpBlockExpiry, wpBlockOther, this.title); }; newButton.appendChild(document.createTextNode(caption));

// dodanie przycisku td.appendChild(newButton); }

var wpBlockReasonList = document.getElementById('wpBlockReasonList'); var wpBlockOtherReason = document.getElementById('mw-bi-reason'); var td = wpBlockReasonList.parentNode;

td.appendChild(document.createElement('br')); td.id = 'userSummaryButtons'; for (var caption in bk$reasons) {		var newButton = document.createElement('a');

// atrybuty newButton.title = bk$reasons[caption]; newButton.onclick = function { bk$setExpiry(wpBlockReasonList, wpBlockOtherReason, this.title); }; newButton.appendChild(document.createTextNode(caption));

// dodanie przycisku td.appendChild(newButton); } }

function br$init { var div = document.getElementById('contentSub'); if (!div) return;

var url = new String(document.location); var img = document.createElement('img'); img.src =

div.appendChild(document.createElement('br')); div.appendChild(img); div.appendChild(document.createTextNode(' '));

if (url.match(/[?&]bot=1/)) { var span = document.createElement('span'); span.innerHTML = br$hideWarning; span.style.cssText = 'color:red; font-weight: bold'; div.appendChild(span); }	else { var a = document.createElement('a'); a.innerHTML = br$hideLink; a.href = url.match('\\?') ? url + "&bot=1" : url + "?bot=1"; a.style.cssText = 'font-weight: bold'; div.appendChild(a); } }

addOnloadHook(function {	if (wgAction == 'protect' || wgAction == 'unprotect')		pt$init;

// jeżeli to nie jest strona 'Usuń' zakończ działanie else if (wgAction == "delete" && wgArticleId != 0) del$init;

else if (wgCanonicalSpecialPageName == 'Blockip') bk$init;

else if (wgCanonicalSpecialPageName == 'Contributions') br$init; });