User talk:Glen/monobook.js

 ');

document.write(' ');

document.write(' ');

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

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

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

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

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

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

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

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

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

function addlilink(tabs, url, name, id, title, key) { //check for duplicates if (document.getElementById(id)){return;} //cologne blue bypass if (document.getElementById('quickbar')) {  if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0]) {     addquickbarlink(url, name, id, title, 'Edit'); }  if (document.getElementById('footer') && !document.getElementById('bodyContent')) {     addfooterlink(url, name, id, title); }  return; } //monobook var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) {       if(key && title) {           ta[id] = [key, title]; }       else if(key) {           ta[id] = [key, '']; }       else if(title) {           ta[id] = ['', title]; }   }    // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); }

function prependChild(parent, node) { parent.insertBefore(node, parent.firstChild); }

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

function addTab(url, name, id, title, key) { //monobook if (document.getElementById('p-cactions')) {var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];} //cologneblue else { if (document.getElementById('quickbar')) {var tabs = document.getElementById('quickbar').getElementsByTagName('h6')[2];} if (document.getElementById('footer')) {var tabs = document.getElementById('footer').getElementsByTagName('td')[0];} return addquickbarlink(url, name, id, 'Edit'); }     return addlilink(tabs, url, name, id, title, key); }

/////////////// //cologneblue tab/link adder function addquickbarlink(url, name, id, title, header) { var header = ' ' + header + ' '; var tabs = document.getElementById('quickbar'); if (tabs.innerHTML.indexOf(header) ==-1) {return;} var add_html = ' ' + name + ' '; var section_html = tabs.innerHTML.split(header)[1].split(' ')[0]; var next_section = ' ' + tabs.innerHTML.split(header)[1].split(' ')[1].split(' ')[0] + ' '; tabs.innerHTML = tabs.innerHTML.split(header)[0] + header + section_html + add_html + next_section + tabs.innerHTML.split(next_section)[1]; }

function addfooterlink(url, name, id, title) { var tabs = document.getElementById('footer').getElementsByTagName('td')[1]; var add_html = ' ' + name + ' '; tabs.innerHTML = add_html + ' | ' + tabs.innerHTML; } ///////////////

function addLink(where, url, name, id, title, key, after){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); }   if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} }   // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; } /////////////////////////////////////////////

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

function addlilink_simple(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; }

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; }

///////// //These are simplier versions of the above, except they add the links on top, not on botton function addnavbox_link(URL,Name,ID) { //cologne blue bypass if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0]) {     var tabs = document.getElementById('quickbar'); addquickbarlink(URL, Name, ID, Name, 'Browse'); return; } //monobook var portlet = document.getElementById('p-navigation'); var links = portlet.getElementsByTagName('ul')[0]; links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>'; } //////////

function URLEncoding(input) {       var encodedInputString=escape(input); encodedInputString=encodedInputString.replace(/\+/g, "%2B"); encodedInputString=encodedInputString.replace(/\//g,"%2F"); encodedInputString=encodedInputString.replace(/&/g,"%26"); var outputurl=encodedInputString; return outputurl; }

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

function standard_XMLParse(string) { if (document.implementation.createDocument) {   return gml_xmlparser.parseFromString(string, "text/xml"); }  else if (window.ActiveXObject) {   string = string.replace(/<body .*\"ns-(.*)\">/, '<body class="ns-$1">'); rer = string.match(/<h1 .*<\/h1>/)[0].replace(/&/g, '&'); if (rer) {string = string.replace(/<h1 .*<\/h1>/, rer);} var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM"); gml_xmldoc.async = false; ret = gml_xmldoc.loadXML(string); myErr = gml_xmldoc.parseError; if (myErr.errorCode || !ret) {			showError("Error: " + ERROR_XML + myErr.reason); return null; }		return gml_xmldoc.documentElement } return null; }

var xml_http;

function HTTPClient { var xml_http = false; if(window.XMLHttpRequest) xml_http = new XMLHttpRequest; else if (IE){ try{ xml_http = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ xml_http = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } }	if (!xml_http) showError(ERROR_XML); return xml_http };

function changelinks {   if(!document.getElementById) return; var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0]; var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML; if (document.title.indexOf('User:' + user_name + '/xml') != -1 || document.title.indexOf('User:' + user_name + '/XML') != -1) {addlilink(toplinks, 'javascript:XMLrequestprompt', 'Request XML', 'Request XML');} document.getElementById('pt-userpage').firstChild.innerHTML = 'User'; document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk'; document.getElementById('pt-preferences').firstChild.innerHTML = 'Prefs'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'Watchlist'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contribs'; document.getElementById('pt-logout').firstChild.innerHTML = 'Logout'; if(document.getElementById('ca-move')) {     document.getElementById('ca-move').firstChild.innerHTML = '[m]'; }       if(document.getElementById('ca-watch')) {     document.getElementById('ca-watch').firstChild.innerHTML = '[w]'; }       if(document.getElementById('ca-unwatch')) {     document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]'; }     if(document.getElementById('ca-edit')) {       document.getElementById('ca-edit').firstChild.innerHTML = 'Edit'; }   if(document.getElementById('ca-delete')) {document.getElementById('ca-delete').firstChild.innerHTML = ' del ';} }

function navigationlinks {   addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','C:CSD','speedy-ln'); addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard/Incidents','AN/I','AN/I'); addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','AIV','aiv-ln'); addnavbox_link('/w/index.php?title=Special:Ipblocklist&limit=100', 'Block log', ''); addnavbox_link('/w/index.php?title=Special:Ipblocklist&action=unblock', 'Unblock', ''); addnavbox_link('/w/index.php?title=User:Glen_S/monobook.js&action=edit', 'monobook.js', ''); addnavbox_link('/w/index.php?title=User:Glen_S/monobook.css&action=edit', 'monobook.css', ''); addnavbox_link('/w/index.php?title=Special%3ALog&type=newusers&user=&page=&limit=300&offset=0', 'New users', ''); addnavbox_link('/w/index.php?title=Special:Newpages&namespace=0&limit=100&offset=0', 'New pages', ''); addnavbox_link('/wiki/User:Glen_S/Links', 'Useful links', ''); addnavbox_link('/w/index.php?title=Special:Prefixindex&namespace=2&from=Glen_S', 'My userspace', ''); var afdtime = new Date; var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; addnavbox_link('/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear       + '_' + months[afdtime.getUTCMonth] + '_' + afdtime.getUTCDate, 'Todays AfD', ''); afdtime.setUTCDate(afdtime.getUTCDate - 5); addnavbox_link('/wiki/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear       + '_' + months[afdtime.getUTCMonth] + '_' + afdtime.getUTCDate, '5-day old AfD', ''); addnavbox_link('/wiki/Special:Log', 'Logs', ''); addnavbox_link('/wiki/Special:Recentchanges', 'Recentchanges', ''); addnavbox_link('/wiki/User:Lupin/Recent_IP_edits', 'Recent IP edits', ''); addnavbox_link('/wiki/Special:Watchlist', 'Watchlist', ''); }

function addtoolboxlinks {      var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; }

addOnloadHook(Mainfast) function Mainfast {   userlogs; navigationlinks; changelinks; addtoolboxlinks; }

window.onload = Main; function Main {   watchlist_tab; block_check; lastdiff; addtoplink; }

// ======== USER TABS ======= function userlogs { //no subpages or history if (document.title.search("/") != -1 || location.href.search(/Special:|&action=[^p]|&diff=/) !=-1) {return;} if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {     username_a = document.URL.match(/:.*:(.*)/); username=username_a[1]; addTab("http://en.wikipedia.org/w/index.php?title=Special:Log&user=" + username, "logs", "ca-blog", "all-logs", ""); } }

//************ // ======== QuickBlocks ======= function QuickBlock (expiry,reason,ao,autob) { blockForm = document.getElementById('blockip'); inputs = blockForm.getElementsByTagName('input'); for (i=0; i<inputs.length; i++) { if (inputs[i].name == 'wpBlockOther') { inputs[i].value = expiry; continue; }   if (inputs[i].name == 'wpBlockReason') { inputs[i].value = reason; continue; }   if (inputs[i].name == 'wpAnonOnly') { if (ao==1) { inputs[i].checked = 'checked'; }     continue; }   if (inputs[i].name == 'wpEnableAutoblock') { if (autob==0) { inputs[i].checked=false; }     continue; } }  blockForm.submit; }

addOnloadHook(function{ if (document.title.indexOf("Block user") == -1) return; addTab('javascript:('+QuickBlock+')("indefinite"," Please read our username policy and choose another name",0,0)','Username','p-block-user'); addTab('javascript:('+QuickBlock+')("indefinite","Bad faith Username or sockpuppet of banned user ",0,1)','NAMETROLL','p-block-nameabuse');  addTab('javascript:('+QuickBlock+')("indefinite","vandalism account",0,1)','VANDAL','p-block-vandalism');  addTab('javascript:('+QuickBlock+')("31 hours","Vandalism",1,1)','31 hour','p-block-31h');  addTab('javascript:('+QuickBlock+')("72 hours","Repeat vandalism",1,1)','72 HOUR','p-block-72h');  addTab('javascript:('+QuickBlock+')("1 week","Repeat vandalism",1,1)','1 week','p-block-week');  addTab('javascript:('+QuickBlock+')("2 weeks","Repeat vandalism",1,1)','2 week','p-block-2weeks');  addTab('javascript:('+QuickBlock+')("1 month","Chronic vandalism",1,1)','1 month','p-block-month'); addTab('javascript:('+QuickBlock+')("3 months","Chronic vandalism",1,1)','3 month','p-block-3month'); addTab('javascript:('+QuickBlock+')("30 minutes","vandalism. See Advice to AOL users if you are impacted by this block",0,1)','30M AOL','p-block-30mins'); }); //************

//************ //LAST DIFF TAB function lastdiff {   if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined || location.href.search(/&action=history/) !=-1) {return;} z=document.getElementById("content").childNodes; for (var n=0;n<z.length;n++) { if (z[n].className=="firstHeading") { var pname=document.title.split(' - ')[0].replace(/&/g,'%26').replace(/\\+/g, '%2B'); }   } addTab("http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", "Last", "ca-diff", "Show most recent diff", ""); }

// This will add an [edit top] link at the top of all pages except preview pages function addtoplink { var edittop = ' [ edit top ] '; // if this is preview page or generated page, stop if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return; if(document.title.indexOf("Main Page") != -1) return;

// get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' <a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a> ';

// insert divContainer into the DOM before the h1 if (document.getElementById("content") !=undefined) { document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);} } //END

//************ //MAIN //***********

function watchlist_tab { if (location.href.indexOf('Special:Watchlist/edit') !=-1) {addTab("javascript:watchlist_clean", "check deleted pages", "ca-clean", "check all deleted pages", "");} }

function watchlist_clean { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } var l = body.getElementsByTagName('li'); for (var i=0; i<l.length; i++) {   if (l[i].getElementsByTagName('a')[0].href.indexOf('&action=') !=-1) {l[i].getElementsByTagName('input')[0].checked=true;} } }

function block_check { if (document.title.indexOf('Block user') !=0){return;} //monobook if (document.getElementById('pt-userpage')) {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;} //cologneblue else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0]) {     var toplinks = document.getElementById('quickbar'); var user_name = toplinks.innerHTML.split(' My pages ')[1].split('title="User:')[1].split('"')[0]; } if (document.getElementsByTagName('input')[0].value == user_name) {alert('Are you sure you want to block yourself?');} else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_')) {alert('Are you sure you want to block yourself?');} }

//User:Lupin/popupsdev.js - please include this line document.write('<script type="text/javascript" src="'             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js'              + '&action=raw&ctype=text/javascript&dontcountme=s"> ');

popupAdminLinks=true;

function XMLrequestprompt { var parameters = ''; var type = 'GET'; var url = location.href; url = prompt('Enter a URL:'); parse_js_value_cache = 0; parse_js_value_cache = prompt('Parse the data?' + '\n' + '0 - false (default)' + '\n' + '1 - true (no script/SRCs/images)' + '\n' + '2 - true (no script/SRCs)' + '\n' + '3 - true (script/images allowed)'); if (parse_js_value_cache != 0 && parse_js_value_cache != 1 && parse_js_value_cache != 2 && parse_js_value_cache != 3){return;} if (!url || url == ''){return;} makeRequestXML(url, parameters,type); }

function alertContents { if (http_request.readyState != 4) return; body = document.getElementById('bodyContent'); if (body && parse_js_value_cache == 3) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; body.innerHTML = ' XML source return: ' + http_request.responseText; } else if (body && parse_js_value_cache == 2) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'` '); body.innerHTML = ' XML source return: ' + xml.replace(/<script [^`]+`<.script>/gi,).replace(/(<\w* onload=["'][^<]+["']>)/gi,).replace(/(\src=["'][^<]+["']>)/gi,' src="">'); } else if (body && parse_js_value_cache == 1) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'` '); body.innerHTML = ' XML source return: ' + xml.replace(/<script [^`]+`<.script>/gi,).replace(/(<\w* onload=["'][^<]+["']>)/gi,).replace(/(<img [^<]+>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">'); } else if (body && parse_js_value_cache == 0) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'` '); xml = xml.replace(/(<a href=["'][^<]+<.a>)/gi,'%parenST|span style="background-color: yellow"|%parenEN$1%parenST|/span|%parenEN').replace(/(<img [^<]+>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<iframe [^<]+<.iframe>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<script [^`]+)`<.script>/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1 %parenST|/span|%parenEN').replace(/(<\w* onload=["'][^<]+["']>)/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1%parenST|/span|%parenEN').replace(/\s(src=["'][^<]+["'])>/gi,'%parenST|span style="background-color: #FF3300"|%parenEN $1>%parenST|/span|%parenEN'); body.innerHTML = ' XML source return: ' + xml.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/%parenST\|/g,'<').replace(/\|%parenEN/g,'>'); } }

//security override HTTP request //ALSO, reduce IE security settings //For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ" //Basically, enable "signed.applets.codebase_principal_support" in about:config function makeRequestXML(url, parameters,type,parse) {  if(window.XMLHttpRequest) { try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) {alert("Permission UniversalBrowserRead denied."); } http_request = false; http_request = new XMLHttpRequest; if (http_request.overrideMimeType) {http_request.overrideMimeType('text/xml'); } if (!http_request) {alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open(type, url + parameters, true); http_request.send(null); } else if (window.ActiveXObject) {   try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {     try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){} } if (!http_request) {showError(ERROR_XML);} http_request.onreadystatechange = alertContents; http_request.open(type, url + parameters, true); http_request.send(null); } } //

// addOnloadHook(Dfn_js_con) function Dfn_js_con { Mvaluejs_class = 'go'; Rvaluejs_class = 'go'; Uvaluejs_class = 'go'; } //

-->