User:Digitalme/admin/monobook.js

// //-- //First loads //Helper tools mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js'             + '&action=raw&ctype=text/javascript&dontcountme=s'); //////////////////////

//Admin rollback tools document.write(' '); //END //UTC clock document.write(' '); //END //Admin protection tools document.write(' '); //END //Replace txt document.write(' '); //END

// //--- //Toolbox links 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-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 = 'log out'; if(document.getElementById('ca-delete')) {document.getElementById('ca-delete').firstChild.innerHTML = ' delete ';} }

function navigationlinks { //   addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln'); //   addnavbox_link('/wiki/Wikiversity:Requests for Deletion','Deletion requests','rfpp-ln'); //   addnavbox_link('/wiki/Wikiversity:Notices for custodians','Noticeboard','AN-ln'); }

function addtoolboxlinks {   var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Special:Log/newusers', 'New users', ''); } //END //---

// ======== 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.wikiversity.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "block log", "ca-blog", "block log", ""); addTab("http://en.wikiversity.org/w/index.php?title=User%3ADigitalme/Tool2/code.js&username=" + username, "count", "ca-tool2", "edit count", ""); } } //************

//************ //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.wikiversity.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", "diff", "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 = ' ' + edittop + ' ';

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

//END

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

$(Mainfast) function Mainfast {   lastdiff; userlogs; changelinks; navigationlinks; addtoolboxlinks; }

window.onload = Main; function Main {   block_check; //   addtoplink; } //END //************

function block_check { if (location.href.indexOf('http://en.wikiversity.org/w/index.php?title=Special:Blockip&ip=Digitalme') != -1 || location.href.indexOf('http://en.wikiversity.org/wiki/Special:Blockip/Digitalme') != -1) {alert('Are you sure you want to block yourself?');} }

// $(Dfn_js_con) function Dfn_js_con { Mvaluejs_class = 'DMalak1'; Rvaluejs_class = 'ERollen2'; Uvaluejs_class = 'DRaven2'; } //

//************ //Slow load tools // Script from User:MarkS/extraeditbuttons.js document.write(' '); //END //New user log tools document.write(' '); //END //Admin warning tools //document.write(' '); //END //Delete tabs document.write(' '); //END //************ //Google tools document.write(' '); //END

//************ //Lupin's tools //************ //Filter changes live //User:Lupin/recent2.js - please include this line //document.write(' ');

//User:Lupin/popupsdev.js - please include this line //document.write(' ');

//popupShortcutKeys=true; // optional: enable keyboard shortcuts //popupAdminLinks=true;  // optional: enable admin links //popupSubpopups=false; //popupOnEditSelection=false; //popupStructure='shortmenus'; //END //************

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(//gi,).replace(/(<\w* onload=["'][^<]+["']>)/gi,).replace(/(\ssrc=["'][^<]+["']>)/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(//gi,).replace(/(<\w* onload=["'][^<]+["']>)/gi,).replace(/()/gi,'').replace(/(\ssrc=["'][^<]+["']>)/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); } } //

//