User:Selmo/firefox.js

/* */

/** * Here be all good stuff * Original location: User:Alphax/monobook.js * Forked from User:ABCD/monobook.js around April 2005 * Dual licensed under the GFDL and GPL * See also: User:JesseW/monobook.js * And best of all: WP:US */

/**** Add Godmode-lite ****/

// this one breaks popups // document.write('<\/SCRIPT>');

// and this one is dead as well... // document.write('<\/SCRIPT>');

// this one works with popups document.write('<\/script>');

/**** Add navigation popups ****/

// User:Lupin/popups.js - please include this line

document.write('<\/script>');

// customisations = see Tools/Navigation popups for more

popupFixRedirs = true; popupRedirAutoClick = 'wpPreview'; popupFixDabs = true; popupStructure = 'menus'; popupRedlinkRemoval = true;

/**** Live RC filter ****/

// User:Lupin/recent2.js - please include this line

document.write('<\/script>');

/**** afd helper ****/

// From User:Jnothman/afd_helper/script.js

document.write('<\/script>');

/*

function addToolboxLink(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, url, name, id); } /*



/**** Interiot's javascript edit counter ****/

if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }

/**** Initialise on window load and load custom functions ****/

addOnloadHook( myLoadFuncs );

function myLoadFuncs {   // &action=purge addPurge; // &section=0 addEditSection0; // cause the personal menu looks bad changeLinks; // because edit summaries are good addForceSummary; // now add a million extra tabs morelinks; // and some stuff for the sidebar addToolBoxLinks; // make red talk page links start new sections //talkpageplus; // for admins only... // if(document.title.indexOf("Confirm delete - Delete") == 0) addVfdLink; // change the title of the edit link ta['ca-edit'] = ['e', 'Edit page']; // remove the logout access key //ta['pt-logout'] = new Array(null, null); // re-render the title and accesskeys for stuff akeytt; // add history link to new messages box newmessagehistory; }

/**** Edit section 0 ****/

function addEditSection0 {   ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page']; if(!document.getElementById) return; var x = document.getElementById('ca-edit'); if(!x) return; var y = document.createElement('LI'); y.id = 'ca-edit-0'; if(x.className == 'selected'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; }   } else if(x.className == 'selected istalk'){ if(/&action=edit&section=0$/.test(window.location.href)){ x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; }   } else { y.className = x.className; x.className = 'istalk'; }   var z = document.createElement('A'); if(x.children){ z.href = x.children[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); }else{ z.href = x.childNodes[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); } }

/**** Add generic tab ****/

function addlilink(tabs, url, name, id){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; }

/**** Add tab as menu ****/

function addlimenu(tabs, name, id) {   var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabs.appendChild(li); return li; }

/**** Add purge tab ****/

function addPurge {   ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; var pf = document.createElement('form'); pf.action = '?action=purge'; pf.method = 'POST'; pf.id = 'pf'; x.appendChild(pf); addlilink(tabs, 'javascript:document.getElementById("pf").submit;', 'purge', 'ca-purge'); }

/**** Add afd header, footer and comment ****/

function closeafd(bold, notbold) {   var txt = document.editform.wpTextbox1; txt.value = " " + bold + "" + notbold + ". – ~\n" + txt.value + "\n\n"; txt = document.editform.wpSummary; txt.value = "close discussion: " + bold + notbold; // I don't mind still watching them // document.editform.wpWatchthis.checked = false; }

/**** Generic custom talk message ****/

function autoMessage(msgtext, summary, saveopt) {   var txt = document.editform.wpTextbox1; document.editform.wpSummary.value = summary; if(txt.value.length > 0) txt.value += '\n'; txt.value += msgtext; if(saveopt == 'save') {       document.editform.submit; }   else if(saveopt == 'preview') {       document.editform.wpPreview.click; }   else if(saveopt == 'diff') {       document.editform.wpDiff.click; } }

/**** Get the pagename for a specified thread ****/

function startThread {   var which = prompt("Thread number?"); var now = new Date; if(which < 10) which = '0' + which; var timestamp = now.getUTCFullYear + ''; now.getUTCMonth < 9 ? timestamp += '0' + (now.getUTCMonth + 1) : timestamp += (now.getUTCMonth + 1); now.getUTCDate < 10 ? timestamp += '0' + now.getUTCDate : timestamp += now.getUTCDate; return ''; }

/**** Get the text for a specified test number ****/

function test(x) {   var s = (x == '1' ? '' : x); return [' – ~', '']; }

/**** Get the text for a specified blanking number ****/

function blank(x) {   var s = (x == '1' ? '' : x); return [' – ~', '']; }

/**** String replacement popup ****/

function replace {   var s = prompt("Search regexp?"); if(s){ var r = prompt("Replace regexp?"); var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } }

/**** Talk page AFD result ****/

function afdresult {   var res = prompt("Result?"); if(!res) return; var afddate = prompt("Nomination date?"); document.editform.wpSummary.value = 'AFD result - ' + res.replace(/'/g, ''); var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; txt.focus; }

/**** Make old AfD's appear or disappear ****/

function hideafd {   var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = "none"; // needed to shrink the page - rendering bug document.getElementById('footer').style.display = 'none'; }

function showafd {   var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = ""; // might as well put it back... document.getElementById('footer').style.display = ''; }

/**** Make the top links look better ****/

function changeLinks {   if(!document.getElementById) return; // remove the "my" bits document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk'; document.getElementById('pt-preferences').firstChild.innerHTML = 'preferences'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions'; // add a clock var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0]; addlilink(toplinks, '#', '', 'utcdate'); showtime; }

/**** Now using the version I developed on commons ****/

function addForceSummary {   if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/&section=new/.test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; document.forms.editform.wpSave.onfocus = forceSummary; }

function forceSummary {   // Section names be damned if (!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))   {        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r;   } return true; }

/**** Not sure how this works ****/

function afddelete{ var form = document.forms.deleteconfirm; form.wpReason.value = 'Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ''; form.wpConfirm.checked = true; }

/**** Mega Tab Adding **** * * I'm making this comment block REALLY REALLY BIG so I can find it * * Possibly the most useful bit of this entire file, it adds various tabs depending on * what page we are on * */

function morelinks {   var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0) {       /**** AFD closing ****/ addlimenu(tabs, 'afd actions', 'afda'); var afda = document.getElementById('afda').getElementsByTagName('ul')[0]; addlilink(afda, 'javascript:closeafd("keep", "")', 'keep', ''); addlilink(afda, 'javascript:closeafd("merge and redirect", " to " + prompt("Merge and redirect to?") + "")', 'merge', ''); addlilink(afda, 'javascript:closeafd("redirect", " to " + prompt("Redirect to?") + "")', 'redir', ''); addlilink(afda, 'javascript:closeafd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', ''); addlilink(afda, 'javascript:closeafd("transwiki", " to Wiktionary")', 'wikt', ''); addlilink(afda, 'javascript:closeafd("speedy delete", "")', 'speedy', ''); addlilink(afda, 'javascript:closeafd("delete", "")', 'del', ''); addlilink(afda, 'javascript:closeafd(prompt("Result?"), "")', 'other', ''); addlilink(tabs, 'javascript:replace', 'replace', ''); /**** The "Make it Awesome!" button **** document.editform.wpSummary.value = 'This vote brought to you by the "Make it Awesome!" button'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += "*Make it awesome! ~"; document.editform.submit; **** Finish making it awesome ****/ }   else if(document.title.indexOf("Confirm delete - Delete") == 0) {       addlilink(tabs, 'javascript:afddelete', 'afd', ''); }   else if(document.title.indexOf("Editing User talk:") == 0) {       addlilink(tabs, 'javascript:replace', 'replace', ''); addlimenu(tabs, 'talk messages', 'talkm'); var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0]; /**** Set up Welcome messages ****/ addlimenu(talkm, 'welcome', 'welcmess'); var welcmess = document.getElementById('welcmess').getElementsByTagName('ul')[0]; addlilink(welcmess, 'javascript:autoMessage(" ~", "Welcome to Wikipedia!", "save")', 'personal', ''); addlilink(welcmess, 'javascript:autoMessage(" Thanks, ~", "Create an account!", "save")', 'anon', ''); addlilink(welcmess, 'javascript:autoMessage(" ~", "Welcome to Wikipedia!", "save")', 'oldwelcome', ''); /**** Set up Test series ****/ addlimenu(talkm, 'test[x]', 'testx'); var testx = document.getElementById('testx').getElementsByTagName('ul')[0]; addlilink(testx, 'javascript:autoMessage(" ~", "", "save")', 'selftest', ''); addlilink(testx, 'javascript:autoMessage(test(1)[0], test(1)[1], "save")', 'test', ''); addlilink(testx, 'javascript:autoMessage(test(2)[0], test(2)[1], "save")', 'test2', ''); addlilink(testx, 'javascript:autoMessage(test(3)[0], test(3)[1], "save")', 'test3', ''); addlilink(testx, 'javascript:autoMessage(test(4)[0], test(4)[1], "save")', 'test4', ''); addlilink(testx, 'javascript:autoMessage(test(5)[0], test(5)[1], "save")', 'test5', ''); /**** Set up Blanking series ****/ addlimenu(talkm, 'blanking', 'blankmess'); var blankmess = document.getElementById('blankmess').getElementsByTagName('ul')[0]; addlilink(blankmess, 'javascript:autoMessage(blank(1)[0], blank(1)[1], "save")', 'blank', ''); addlilink(blankmess, 'javascript:autoMessage(blank(2)[0], blank(2)[1], "save")', 'blank2', ''); addlilink(blankmess, 'javascript:autoMessage(test("2a")[0], test("2a")[1], "save")', 'test2a', ''); addlilink(blankmess, 'javascript:autoMessage(blank(3)[0], blank(3)[1], "save")', 'blank3', ''); addlilink(blankmess, 'javascript:autoMessage(blank(4)[0], blank(4)[1], "save")', 'blank4', ''); addlilink(blankmess, 'javascript:autoMessage(blank(5)[0], blank(5)[1], "save")', 'blank5', ''); /**** Generic talk messages ****/ addlilink(talkm, 'javascript:autoMessage(startThread, "new thread", "save")', 'thread', ''); addlilink(talkm, 'javascript:autoMessage(" ~", "Edit summary", "save")', 'summary', ''); addlilink(talkm, 'javascript:autoMessage(" ~", "", "save")', 'bv', ''); }   else if(document.title.indexOf("Editing ") == 0) {       addlilink(tabs, 'javascript:replace', 'replace', ''); addlilink(tabs, 'javascript:afdresult', 'afd result', ''); }   else if(document.title.indexOf("Wikipedia:Articles for deletion") == 0) {       addlilink(tabs, 'javascript:hideafd', 'hide closed', 'ca-hide'); ta['ca-hide'] = ['', 'Hide closed AFDs']; addlilink(tabs, 'javascript:showafd', 'show closed', 'ca-show'); ta['ca-show'] = ['', 'Show closed AFDs']; }   else if((document.title.indexOf("User:") == 0) || (document.title.indexOf("User talk:") == 0)) {       addlimenu(tabs, 'User functions', 'userf'); var userf = document.getElementById('userf').getElementsByTagName('ul')[0]; var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if(slloc > 0) editlk = editlk.substring(0, slloc); // add "block" tab addlilink(userf, '/wiki/Special:Blockip/' + editlk, 'block user'); // add "blocklog" tab addlilink(userf, '/wiki/Special:Log/block?page=User:' + editlk, 'block log', ''); // add "unblock" tab addlilink(userf, '/w/index.php?title=Special:Ipblocklist&action=unblock&ip=' + editlk, 'unblock user', ''); // add "contributions" tab addlilink(userf, '/wiki/Special:Contributions/' + editlk, 'contributions', ''); // add "edit count" tab //addlilink(userf, 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=' + editlk + '&dbname=enwiki_p', 'interiot\'s tool', ''); addlilink(userf, 'http://tools.wikimedia.de/~essjay/edit_count/Count.php?username=' + editlk + '&submit=Count', 'Essjay\'s tool', ''); // add "whois" tab addlilink(userf, 'http://www.samspade.org/t/lookat?a=' + editlk, 'whois user', ''); // add another "whois" tab addlilink(userf, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + editlk, 'whois (2)', ''); // add "proxycheck" tab addlilink(userf, 'http://wikipedia.quyme.com/proxycheck.php?ip=' + editlk, 'open proxy check', ''); } }

/**** Add links to the toolbox ****/

function addToolBoxLinks {   var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; var afdtime = new Date; var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; afdtime.setUTCDate(afdtime.getUTCDate - 7); addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Special:Shortpages', 'Short pages', ''); addlilink(tb, '/wiki/Special:Log', 'Logs', ''); // addlilink(tb, '/wiki/Template:Deletiontools', 'Deletion tools', ''); addlilink(tb, '/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear       + '_' + months[afdtime.getUTCMonth] + '_' + afdtime.getUTCDate, 'Week old AfD', ''); addlilink(tb, '/wiki/Wikipedia:Disambiguation_pages_with_links', 'Dab list', ''); addlilink(tb, '/wiki/Wikipedia:Template_messages/User_talk_namespace', 'Talk messages', ''); addlilink(tb, '/wiki/User:Alphax/special', 'Special characters', ''); addlilink(tb, '/wiki/User:Alphax/monobook.js', 'Monobook.js', ''); addlilink(tb, '/wiki/User:Alphax/monobook.css', 'Monobook.css', ''); addlilink(tb, '/wiki/User:Alphax/Sandbox', 'My sandbox', ''); addlilink(tb, '/wiki/WP:ICT', 'Image Copyright tags', ''); }

/**** Get a clock that autoupdates! ****/

function showtime {   var timerID; var now = new Date; var timeValue = now.toUTCString.replace(/GMT/, "UTC"); document.getElementById('utcdate').firstChild.innerHTML = timeValue; timerID = setTimeout('showtime', 100); }

/**** Auto start new topics when hitting empty talk pages from the content page ****/

function talkpageplus {   var talkpagelink = document.getElementById('ca-talk'); if (talkpagelink.className == 'new') {       talkpagelink.firstChild.href += '&section=new'; } }

/**** Add history link to the "You have new messages" box ****/

function newmessagehistory {   var divs = document.getElementsByTagName('div'); var talkmessagebox; for(var x = 0; x < divs.length; ++x) {       if(divs[x].className.indexOf('usermessage') != -1) {           talkmessagebox = divs[x]; x = divs.length; // force break }   }    divs = ''; // release divs? if(!talkmessagebox) return false; var newmessagelink = talkmessagebox.getElementsByTagName('a')[0]; var historylink = document.createElement('a'); historylink.href = newmessagelink.href.replace(/\/wiki\//, '/w/index.php?title=') + '&action=history'; historylink.className = 'extiw'; historylink.appendChild(document.createTextNode('changes')); // var talkmessagetext = 'You have '; // talkmessagebox.innerHTML = talkmessagetext; // talkmessagebox.appendChild(newmessagelink); talkmessagebox.appendChild(document.createTextNode(' ('));   talkmessagebox.appendChild(historylink);    talkmessagebox.appendChild(document.createTextNode(')')); } //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); } /* */ function inc (file) { mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s'); } inc("User:Lightdarkness/aiv.js");

// Script from User:AndyZ/peerreviewer.js document.write('');

/* add/removeEvent Original idea by John Resig Tweaked by Scott Andrew LePera, Dean Edwards and Peter-Paul Koch Fixed for IE by Tino Zijdel (crisp) @date 2005-10 */ function addEvent(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false)}else if(obj.attachEvent){var eProp=type+fn;obj["e"+eProp]=fn;obj[eProp]=function{obj["e"+eProp](window.event)};obj.attachEvent("on"+type,obj[eProp])}else{obj['on'+type]=fn}}; function removeEvent(obj,type,fn){if(obj.removeEventListener){obj.removeEventListener(type,fn,false)}else if(obj.detachEvent){var eProp=type+fn;obj.detachEvent("on"+type,obj[eProp]);obj['e'+eProp]=null;obj[eProp]=null}else{obj['on'+type]=null}}; addOnloadHook( function { addToolboxLink('http://en.wikipedia.org/wiki/WP:Vancouver', 'Vancouver project', 'v'); });

function listRedLinks { var len=document.links.length; var output=document.createElement('div'); output.innerHTML=' Red links '; var gotSome=false; for (var i=0; i<len; ++i) { if (document.links[i].className=='new') { gotSome=true; var l=document.links[i].cloneNode(true); output.appendChild(l); output.appendChild(document.createElement('br')); } } if (gotSome){ output.appendChild(document.createElement('hr')); var h1=document.getElementsByTagName('h1')[0]; h1.parentNode.insertBefore(output, h1.nextSibling); } } addOnloadHook(function{addToolboxLink('javascript:listRedLinks', 'List red links');}); //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); } // CHECK THAT I'VE REMEMBERED TO SIGN TALK PAGES AND IF SURE DO IT AUTOMATIC: // *** aut. signing / (automatische Unterschrift) *** User:Olliminatore/signing.js // created 23.04.2006 by User:Olliminatore // updated 23.04.2006 by en:User:Ilmari Karonen // current version 1.48 13.08.2006 //

// Helper-function String.prototype.trim = function{return this.replace(/^\s*|\s*$/g,"")};

if (typeof usersignature == 'undefined') usersignature = ' --\~\~\~\~\n';

addOnloadHook(function{	if(!document.editform) return; var title = encodeURI(document.title); // object to string	// regarded pages type encoded	var regpages=new Array('talk:', 'Talk:', ':Village pump', ':Articles for deletion', ':Requests for deletion', ':Requests for ');	for(p in regpages)		if(title.indexOf(regpages[p])!=-1){			regpages=false;			break		}	if(regpages) return;	var txtarea=document.editform.wpTextbox1;	var txtOld=txtarea.value.trim;	// txtOld_l=txtOld.length	var txtOldEnd=txtOld.slice(-24);	var tNode = document.editform.wpMinoredit.parentNode  setSigBox	tNode.insertBefore(neuB, tNode.getElementsByTagName("DIV").item(0));	var sig = /~{3}/g	function doSign(event){		if(document.editform.onsubmit==){ // only once!			removeEvent(document.editform.wpSave,"click",doSign);			removeEvent(document.editform.wpPreview,"click",doSign);		}		if(document.editform.onsubmit==) removeEvent(document.editform.wpSave,"click",doSign); // only once! if(document.editform.wpMinoredit.checked || !sigBox.checked) return; var cOld = txtOld.match(/ .*?~{3}.*?<\/nowiki>/g); if (cOld) cOld = cOld.length; var cNew = sig.exec(txtarea.value); if (cNew) cNew = cNew.length; if(cNew <= cOld){ // then search a set position txt=txtarea.value.trim; txtEnd=txt.slice(-24); if(txtOldEnd!=txtEnd) return txtarea.value = txt + usersignature; // aut. underwrite else { // post between pos = getCaretPos(txtarea); pos = txt.indexOf('\n', pos); // go to the post-end txtEnds = txt.substr(pos,24).replace(/(^\s*)/,""); // after txtpEnds = txt.slice(pos-18,pos); // before oldp = txtOld.indexOf(txtEnds); if(oldp!=-1 && oldp < pos - 3 && txtOld.indexOf(txtpEnds+RegExp.$1+txtEnds)==-1) // if some added return txtarea.value = txt.slice(0,pos).trim + usersignature + txt.slice(pos+1); }		 // FIXME: the edit-end is not found } 		else if(!sig.test(txtOld) || cOld < cNew) return; if (event) event=(window.Event)? event.target: event.srcElement; if (event.name == 'wpPreview') return; // not for preview return document.editform.onsubmit=new Function("document.editform.onsubmit='';return confirm('No signing was found. Continue anyway?')"); };	addEvent(document.editform.wpSave,"click", doSign); addEvent(document.editform.wpPreview,"click", doSign); addEvent(document.editform.wpMinoredit,"click", setSigBox);

}); var sigBox = document.createElement("input"); sigBox.setAttribute('type','checkbox'); sigBox.setAttribute('name','wpSigning'); sigBox.setAttribute('id','wpSigning'); sigBox.setAttribute('checked','checked'); sigBox.defaultChecked=true; var neuB = document.createElement("label"); neuB.appendChild(sigBox); neuB.appendChild(document.createTextNode("Undersign")); neuB.setAttribute('for','wpSigning'); neuB.setAttribute('title','This edit automatic undersigning.');

function setSigBox{ if(document.editform.wpMinoredit.checked) sigBox.setAttribute('disabled', 'disabled'); else sigBox.removeAttribute('disabled'); }

function getCaretPos(txtObj) { if (txtObj.setSelectionRange) return txtObj.selectionStart; // NS like else if(!document.selection) return 0; // not IE like txtObj.focus; var c="\001", pos=0; var range=document.selection.createRange; var txt=range.text, dul=range.duplicate; dul.moveToElementText(txtObj); range.text=txt+c; pos=(dul.text.indexOf(c)); range.moveStart('character',-1); range.text=""; return pos; };

/* add/removeEvent Original idea by John Resig Tweaked by Scott Andrew LePera, Dean Edwards and Peter-Paul Koch Fixed for IE by Tino Zijdel (crisp) @date 2005-10 */ function addEvent(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false)}else if(obj.attachEvent){var eProp=type+fn;obj["e"+eProp]=fn;obj[eProp]=function{obj["e"+eProp](window.event)};obj.attachEvent("on"+type,obj[eProp])}else{obj['on'+type]=fn}}; function removeEvent(obj,type,fn){if(obj.removeEventListener){obj.removeEventListener(type,fn,false)}else if(obj.detachEvent){var eProp=type+fn;obj.detachEvent("on"+type,obj[eProp]);obj['e'+eProp]=null;obj[eProp]=null}else{obj['on'+type]=null}};

//*** end *** // // Interwiki en:User:Olliminatore/sign.js //*** end *** // // Interwiki en:User:Olliminatore/sign.js