| Line 1: |
Line 1: |
| − | //<pre> | + | //<nowiki> Helper tools |
| − | | + | document.write('<script type="text/javascript" src="' |
| − | // [[User:Lupin/popups.js]] | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //</nowiki> |
| | | | |
| | + | //<pre><nowiki> |
| | + | //-------------------------------------------------------------- |
| | + | //First loads |
| | + | //Helper tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | ////////////////////// |
| | + | |
| | + | //Admin rollback tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //BCrat tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Bureaucrat/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | RfAshowlinks = 'true'; |
| | + | //END |
| | + | //CU tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/CheckUser/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //UTC clock |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //Admin protection tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //Approvals |
| | document.write('<script type="text/javascript" src="' | | document.write('<script type="text/javascript" src="' |
| − | + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Approvals.js' |
| | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| − | | + | //END |
| − | function siteArticlePath(){ return ''; }
| + | //Replace txt |
| − | function siteBotInterfacePath(){ return ''; }
| |
| − | | |
| − | //popupStructure='original'; | |
| − | | |
| − | | |
| − | //========= WELCOME SCRIPT ===================================== | |
| − | | |
| | document.write('<script type="text/javascript" src="' | | document.write('<script type="text/javascript" src="' |
| − | + 'http://www.conservapedia.com/User:Philip_J._Rayment/Welcome_script' | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' |
| | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| − | | + | //END</nowiki></pre> |
| − | //============================================================== | + | |
| − | | + | //<nowiki><pre> |
| − | // This will add an [edit] link at the top of all pages except preview pages and the main page | + | //--------------------------------------------------------------- |
| − | // by User:Pile0nades
| + | //Toolbox links |
| − | | + | function changelinks() |
| − | | + | { |
| − | // Add an [edit] link to pages | + | if(!document.getElementById) return; |
| − | addOnloadHook(function () {
| + | var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0]; |
| − | // if this is preview page or generated page, stop
| + | var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML; |
| − | if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;
| + | 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');} |
| − | // if this is a revision history, stop
| + | document.getElementById('pt-mytalk').firstChild.innerHTML = 'my Talk page'; |
| − | if(document.getElementById("histlegend") || window.location.href.indexOf("/wiki/Special:") != -1) return;
| + | document.getElementById('pt-preferences').firstChild.innerHTML = 'Change Preferences'; |
| − | | + | document.getElementById('pt-watchlist').firstChild.innerHTML = 'Check my Watchlist'; |
| − | // if this is a diff page, stop
| + | document.getElementById('pt-mycontris').firstChild.innerHTML = 'My Contributions'; |
| − | if(document.getElementById("difference") || window.location.href.indexOf("/wiki/Special:") != -1) return;
| + | document.getElementById('pt-logout').firstChild.innerHTML = 'Log out'; |
| − | | + | if(document.getElementById('ca-delete')) |
| − | // if this is a watchlist, stop
| + | {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} |
| − | if(document.getElementById("watchdetails") || window.location.href.indexOf("/wiki/Special:") != -1) return;
| + | } |
| − | | + | |
| − | // if this is the main page, stop | + | function navigationlinks() |
| − | if(document.getElementById("mainpage") || window.location.href.indexOf("/wiki/Special:") != -1) return; | + | { |
| − | | + | addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln'); |
| | + | addnavbox_link('/wiki/Category:Candidates_for_speedy_deletion','Speedy deletions','speedy-ln'); |
| | + | addnavbox_link('/wiki/Wikipedia:Requests for page protection','Protection requests','rfpp-ln'); |
| | + | addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard','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', ''); |
| | + | addlilink(tb, '/wiki/WP:PP', 'Protected pages', ''); |
| | + | } |
| | + | //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.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "log", "ca-blog", "block log", ""); |
| | + | addTab("http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "info", "ca-kate", "user info", ""); |
| | + | } |
| | + | } |
| | + | //************ |
| | + | |
| | + | //************ |
| | + | //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 = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>'; |
| | + | // 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 | | // get the page title |
| − | var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); | + | var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); |
| − | | + | |
| | // create div and set innerHTML to link | | // create div and set innerHTML to link |
| | var divContainer = document.createElement("div"); | | var divContainer = document.createElement("div"); |
| − | divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:0px;margin-top:47px;">[<a href="/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit</a>]</div>'; | + | divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>'; |
| − | | + | |
| − | // insert divContainer into the DOM below the h1 | + | // insert divContainer into the DOM before the h1 |
| − | if(window.location.href.indexOf("&action=edit") == -1) | + | if (document.getElementById("content") !=undefined) { |
| − | document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]); | + | document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);} |
| − | | + | } |
| − | if(window.location.href.indexOf("&action=edit§ion=0") != -1) | + | //END |
| − | document.getElementById("wpSummary").value = "/* Intro */ "; | + | |
| − | }); | + | //************ |
| − | | + | //MAIN |
| − | //</pre> | + | //************ |
| | + | |
| | + | addOnloadHook(Mainfast) |
| | + | function Mainfast() |
| | + | { |
| | + | userlogs(); |
| | + | changelinks(); |
| | + | navigationlinks(); |
| | + | addtoolboxlinks(); |
| | + | } |
| | + | |
| | + | window.onload = Main; |
| | + | function Main() |
| | + | { |
| | + | watchlist_tab(); |
| | + | block_check(); |
| | + | lastdiff(); |
| | + | addtoplink(); |
| | + | } |
| | + | //END |
| | + | //************ |
| | + | |
| | + | 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('<h6>My pages</h6>')[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?');} |
| | + | } |
| | + | |
| | + | // |
| | + | addOnloadHook(Dfn_js_con) |
| | + | function Dfn_js_con() |
| | + | { |
| | + | Mvaluejs_class = 'DMalak1'; |
| | + | Rvaluejs_class = 'ERollen2'; |
| | + | Uvaluejs_class = 'DRaven2'; |
| | + | } |
| | + | // |
| | + | |
| | + | //************ |
| | + | //New user log tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //Admin warning tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Adminwarnings/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //Delete tabs |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | //************ |
| | + | //Google tools |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Google/monobook.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //END |
| | + | |
| | + | //Interiot's javascript edit counter |
| | + | if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); } |
| | + | // |
| | + | |
| | + | //************ |
| | + | //Lupin's tools |
| | + | //************ |
| | + | //Filter changes live [[Category:VoA scripted admins]] |
| | + | //[[User:Lupin/recent2.js]] - please include this line |
| | + | document.write('<script type="text/javascript" src="' |
| | + | + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' |
| | + | + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
| | + | //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 = '<strong>XML source return:</strong><br>' + 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,'`</script>'); |
| | + | body.innerHTML = '<strong>XML source return:</strong><br>' + 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,'`</script>'); |
| | + | body.innerHTML = '<strong>XML source return:</strong><br>' + 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,'`</script>'); |
| | + | 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</script>%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 = '<strong>XML source return:</strong><br>' + xml.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').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); |
| | + | } |
| | + | } |
| | + | // |
| | + | |
| | + | //</nowiki></pre> |