/* <pre> more at Wikipedia:WikiProject User scripts/Scripts */
/* Takes the wikipage "page" and includes its raw text as javascript. */
function import_module(page){
if( document.createElement && document.childNodes ) {
var url =
'http://en.wikipedia.org/w/index.php?title=' +
page.replace(/ /g, "_") +
'&action=raw&ctype=text/javascript&dontcountme=s';
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src',url);
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
}
/* Helpers */
import_module('Wikipedia:WikiProject User scripts/Scripts/Add tab');
import_module('Wikipedia:WikiProject User scripts/Scripts/Add LI link');
import_module('Wikipedia:WikiProject User scripts/Scripts/addLink');
/* Scripts */
import_module('Wikipedia:WikiProject User scripts/Scripts/Replace');
import_module('Wikipedia:WikiProject User scripts/Scripts/Revert tools');
import_module('Wikipedia:WikiProject User scripts/Scripts/Autolink');
import_module('MediaWiki:WikiProject User scripts/Scripts/Compare link.js');
// Edit tools for the vandal whack-a-mole game
// [[User:Kbh3rd/whackamole.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Kbh3rd/whackamole.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// [[User:Henrik/sandbox/google-search]] (please include this line)
function install_search() {
document.getElementById('searchBody').innerHTML='<div>'+
'<FORM method=get action="http://www.google.com/search">'+
'<input type=hidden name="ie" value="UTF-8" /><input type=hidden name="oe" value="UTF-8" />'+
'<INPUT id="searchInput" name="q" type="text" accesskey="f" value="" />'+
'<input type="hidden" name="domains" value="en.wikipedia.org" />'+
'<input type=radio name=sitesearch value="">Web'+
'<input type=radio name=sitesearch value="en.wikipedia.org" checked />WP'+
'<INPUT type="submit" name="btnG" VALUE="Google Search" /></FORM></div>';
}
addOnloadHook(install_search);
// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades
// Add an [edit top] link to pages
addOnloadHook(function () {
// if this is preview page or generated page, stop
if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -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 = '<div class="editsection" style="float:right;margin-left:5px;margin-right:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';
// insert divContainer into the DOM before the h1
if(window.location.href.indexOf("&action=edit") == -1)
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
if(window.location.href.indexOf("&action=edit§ion=0") != -1)
document.getElementById("wpSummary").value = "/* Intro */ ";
});
// Code originally by [[User:Raylu|raylu]]
// Modified by [[User:Moeron]]
// This script adds a "subst:welcome2" tab to the top of User pages
// when in edit mode.
function dowelcome2() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'welcome2' + '}' + '}' + ' ' + '~' + '~' + '~' + '~';
document.editform.wpSummary.value = 'Welcome to Wikipedia!';
document.editform.wpMinoredit.checked = false;
document.editform.submit();
}
function addwelcome2() {
addTab("javascript:dowelcome2()", "subst:welcome2", "ca-welcome2", "subst:welcome2", "");
akeytt();
}
addOnloadHook(function() {
if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
addOnloadHook(addwelcome2);
}
});
// install [[User:Cacycle/wikEd]] in-browser text editor
//document.write('<script type="text/javascript" src="'
//+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
//+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//var wikEdFrameCSS = [];
//wikEdFrameCSS['.wikEdLinkName'] = 'color: blue; font-weight: bold;';
//wikEdFrameCSS['.wikedFrameBody'] = 'background-color: #e0e7f7;';
/* </pre> */