Fate takes a turn... Episode 6 of the podcast is finally out!

MediaWiki:Monobook.js

From Daniel Fans

(Difference between revisions)
(Change.)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
/* tooltips and access keys */
+
/* <pre><nowiki> */
-
ta = new Object();
+
addOnloadHook(function() {
-
ta['pt-userpage'] = new Array('.','My user page');
+
if(document.getElementById('ca-delete')) {
-
ta['pt-anonuserpage'] = new Array('.','The user page for the ip you\'re editing as');
+
for(var i=0; i<document.getElementsByTagName('div').length; i++) {
-
ta['pt-mytalk'] = new Array('n','My talk page');
+
if(document.getElementsByTagName('div')[i].className == 'nosysop') document.getElementsByTagName('div')[i].style.display = "none";
-
ta['pt-anontalk'] = new Array('n','Discussion about edits from this ip address');
+
}
-
ta['pt-preferences'] = new Array('','My preferences');
+
for(var i=0; i<document.getElementsByTagName('div').length; i++) {
-
ta['pt-watchlist'] = new Array('l','The list of pages you\'re monitoring for changes.');
+
if(document.getElementsByTagName('div')[i].className == 'onlysysop') document.getElementsByTagName('div')[i].style.display = "block";
-
ta['pt-mycontris'] = new Array('y','List of my contributions');
+
}
-
ta['pt-login'] = new Array('o','You are encouraged to log in, it is not mandatory however.');
+
}
-
ta['pt-anonlogin'] = new Array('o','You are encouraged to log in, it is not mandatory however.');
+
});
-
ta['pt-logout'] = new Array('o','Log out');
+
 
-
ta['ca-talk'] = new Array('t','Discussion about the content page');
+
addOnloadHook(function() {
-
ta['ca-edit'] = new Array('e','You can edit this page. Please use the preview button before saving.');
+
if((wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk') && document.getElementById('ca-delete')) {
-
ta['ca-addsection'] = new Array('+','Add a comment to this discussion.');
+
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
-
ta['ca-viewsource'] = new Array('e','This page is protected. You can view its source.');
+
addlilink(tbs, wgArticlePath.replace('$1', 'Special:Makesysop?target='+wgTitle.replace(/ /g, '_').split('/')[0]), "makesysop", 'ca-sys', '');
-
ta['ca-history'] = new Array('h','Past versions of this page.');
+
}
-
ta['ca-protect'] = new Array('=','Protect this page');
+
});
-
ta['ca-delete'] = new Array('d','Delete this page');
+
 
-
ta['ca-undelete'] = new Array('d','Restore the edits done to this page before it was deleted');
+
/** Click on Image ***********************************************************
-
ta['ca-move'] = new Array('m','Move this page');
+
  *
-
ta['ca-watch'] = new Array('w','Add this page to your watchlist');
+
  *  Description: Make images clickable to a different location
-
ta['ca-unwatch'] = new Array('w','Remove this page from your watchlist');
+
  *              than the one set by MediaWiki
-
ta['search'] = new Array('f','Search this wiki');
+
  *  Maintainers: [[User:GeorgeMoney]]
-
ta['p-logo'] = new Array('','Main Page');
+
  */
-
ta['n-mainpage'] = new Array('z','Visit the Main Page');
+
-
ta['n-portal'] = new Array('','About the project, what you can do, where to find things');
+
addOnloadHook(function() {
-
ta['n-currentevents'] = new Array('','Find background information on current events');
+
var usebody = document.getElementById('bodyContent') || document;
-
ta['n-recentchanges'] = new Array('r','The list of recent changes in the wiki.');
+
var divs = usebody.getElementsByTagName('div');
-
ta['n-randompage'] = new Array('x','Load a random page');
+
for(var i = 0; i < divs.length; i++) {
-
ta['n-help'] = new Array('','The place to find out.');
+
try {
-
ta['n-sitesupport'] = new Array('','Support us');
+
if(divs[i].getAttribute('class') != 'click') continue;
-
ta['t-whatlinkshere'] = new Array('j','List of all wiki pages that link here');
+
var titleurl =  divs[i].getAttribute('title').split('URL=');
-
ta['t-recentchangeslinked'] = new Array('k','Recent changes in pages linked from this page');
+
divs[i].getElementsByTagName('a')[0]
-
ta['feed-rss'] = new Array('','RSS feed for this page');
+
.setAttribute('title', titleurl[0]);
-
ta['feed-atom'] = new Array('','Atom feed for this page');
+
divs[i].setAttribute('title', '');
-
ta['t-contributions'] = new Array('','View the list of contributions of this user');
+
if(typeof titleurl[1] == 'undefined') continue;
-
ta['t-emailuser'] = new Array('','Send a mail to this user');
+
var useurl;
-
ta['t-upload'] = new Array('u','Upload images or media files');
+
if(titleurl[1].substr(0, 2) == '[['  
-
ta['t-specialpages'] = new Array('q','List of all special pages');
+
&& titleurl[1].substr(titleurl[1].length-2) == ']]') {
-
ta['ca-nstab-main'] = new Array('c','View the content page');
+
useurl = titleurl[1].substr(0, titleurl[1].length-2).substr(2);
-
ta['ca-nstab-user'] = new Array('c','View the user page');
+
useurl = wgServer + wgArticlePath.replace('$1', useurl);
-
ta['ca-nstab-media'] = new Array('c','View the media page');
+
} else
-
ta['ca-nstab-special'] = new Array('','This is a special page, you can\'t edit the page itself.');
+
useurl = titleurl[1];
-
ta['ca-nstab-wp'] = new Array('a','View the project page');
+
divs[i].getElementsByTagName('a')[0]
-
ta['ca-nstab-image'] = new Array('c','View the image page');
+
.setAttribute('href', useurl);
-
ta['ca-nstab-mediawiki'] = new Array('c','View the system message');
+
} catch(e) { }
-
ta['ca-nstab-template'] = new Array('c','View the template');
+
}
-
ta['ca-nstab-help'] = new Array('c','View the help page');
+
});
-
ta['ca-nstab-category'] = new Array('c','View the category page');
+
 
 +
//Auto welcome user script written by GeorgeMoney
 +
if(welcome == undefined) {
 +
//If you would like to make your own config you have 2 options:
 +
//1:Copy the entire code to your monobook and change the config
 +
//2:Copy everything, from this line until you see 'end config', into your monobook.js, and include the module to your monobook via an import function
 +
 
 +
var welcome={};welcome.edit={};welcome.link={};welcome.link.tab={};welcome.link.newUserLog={};welcome.link.redLinkTalk={};welcome.options={};
 +
 
 +
//config
 +
welcome.edit.summary = "Welcome to The Test Wiki!";
 +
welcome.edit.text = "{{sub" + "st:Welcome}}" + "\
 +
" + "~~" + "~~";
 +
welcome.edit.textAnon = "{{sub" + "st:Welcomeip}}" + "\
 +
" + "~~" + "~~";
 +
welcome.edit.button = 'wpSave';
 +
 
 +
welcome.link.newUserLog.defaultColor = "blue";
 +
welcome.link.newUserLog.clickedColor = "green";
 +
welcome.link.newUserLog.text = "[welcome]";
 +
 
 +
welcome.link.redLinkTalk.defaultColor = "blue";
 +
welcome.link.redLinkTalk.clickedColor = "green";
 +
welcome.link.redLinkTalk.text = "[welcome]";
 +
welcome.link.redLinkTalk.blink = false;
 +
 
 +
welcome.link.tab.text = "welcome!";
 +
welcome.link.tab.accessKey = 'a';
 +
 
 +
welcome.options.newUserLogaddReloadButton = true;
 +
welcome.options.newUserLogEnabled = true;
 +
welcome.options.redLinkTalkEnabled = true;
 +
welcome.options.addTab = true;
 +
welcome.options.askIfPageIsNotBlank = true;
 +
welcome.options.maxLinks = 1000;
 +
welcome.options.warnIfOverMaxLinks = false;
 +
 
 +
//end config
 +
 
 +
}
 +
//main script
 +
if(welcome.options.newUserLogEnabled && (/Special(%3A|:)Log(\\/newusers$|(.*?&|\\?)type=newusers)/i).test(window.location.href)) {
 +
if(window.location.hash != "") window.location.hash = "";
 +
else {
 +
addOnloadHook(function() {
 +
var lis = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
 +
for (var i=0; i<lis.length; i++) {
 +
var li = lis[i];
 +
var url = li.firstChild.nextSibling.nextSibling.nextSibling.href;
 +
var charao = (url.indexOf('?') != -1)?'&':'?';
 +
url += charao+"autowelcome=true"
 +
var link = document.createElement('a');
 +
link.appendChild(document.createTextNode(welcome.link.newUserLog.text));
 +
link.style.color = welcome.link.newUserLog.defaultColor;
 +
monclick = function() {
 +
//this.style = { };
 +
this.style.textDecoration = 'none';
 +
this.style.color = welcome.link.newUserLog.clickedColor;
 +
var n = parseInt(this.name.split('_')[2]);
 +
var newhref = "#anchor_welcome_"+(n+1);
 +
this.onmouseover = function() { return false; }
 +
this.onfocus = function() { return false; }
 +
this.onclick = function() {
 +
window.open(this.href);
 +
this.onclick = function() { return false; };
 +
return false;
 +
}
 +
this.onmousedown = function() { return false; }
 +
this.onmouseup = function() { return false; }
 +
this.onmouseout = function() {
 +
//var n = parseInt(this.name.split('_')[2]);
 +
//var newhref = "#anchor_welcome_"+(n+1);
 +
//this.href /**/+= '&hasdone=true'; //newhref;
 +
//this.href=newhref;
 +
this.href = "javascript:void(0);";
 +
this.onmouseout = function() {
 +
return false;
 +
}
 +
};
 +
//this.href = newhref;
 +
//this.tagName = 'SPAN';
 +
//this.innerHTML = 'welcomed';
 +
this.style.cursor = "default";
 +
};
 +
//link.onfocus = monclick;
 +
link.onmouseup = monclick;
 +
link.href = url;
 +
link.id = "id_welcome_"+i;
 +
link.name = "anchor_welcome_"+i;
 +
li.appendChild(link);
 +
}
 +
 +
if(welcome.options.newUserLogaddReloadButton) {
 +
var h1 = document.getElementsByTagName('h1')[0];
 +
var button = document.createElement('input');
 +
button.onclick = function() {
 +
if(window.location.hash != "")
 +
window.location.hash = "";
 +
location.reload();
 +
}
 +
button.value = "reload";
 +
button.type = "button";
 +
h1.parentNode.insertBefore(button, h1.nextSibling);
 +
}
 +
});
 +
}
 +
}
 +
 
 +
if(welcome.options.redLinkTalkEnabled && !((/Special(%3A|:)Log(\\/newusers$|(.*?&|\\?)type=newusers)/i).test(window.location.href)) && ( ( (wgNamespaceNumber > -1 && wgNamespaceNumber % 2 != 0) || (wgCanonicalNamespace == "Wikipedia"||wgCanonicalNamespace == 'Special') ) || !wgIsArticle )) {
 +
addOnloadHook(function() {
 +
var alinks = document.getElementById('bodyContent').getElementsByTagName('a');
 +
if(alinks.length > welcome.options.maxLinks) {
 +
if(welcome.options.warnIfOverMaxLinks)
 +
var ok_to_go = confirm("This page has over "+welcome.options.maxLinks+" links.\
 +
"
 +
+"Searching for red links to add welcome links might take a while and freeze your"
 +
+" browser\
 +
To continue and add welcome links, press ok.");
 +
else var ok_to_go = false;
 +
} else var ok_to_go = true;
 +
if(!ok_to_go) return;
 +
for(var i=0, j=0; i<alinks.length; i++) {
 +
var lin = alinks[i];
 +
if(lin.className == "new" && (/User([_ ]talk)?:/i).test(lin.href) && lin.href.substr('http://en.wikipedia.org/w/index.php?title='.length).indexOf('/') == -1) {
 +
var url = lin.href;
 +
url = url.replace('User:', 'User_talk:');
 +
var charao = (url.indexOf('?') != -1)?'&':'?';
 +
url += charao+"autowelcome=true"
 +
var nlin = document.createElement('a');
 +
nlin.appendChild(document.createTextNode(welcome.link.redLinkTalk.text));
 +
nlin.style.color = welcome.link.redLinkTalk.defaultColor;
 +
monclick = function() {
 +
this.style.textDecoration = 'none';
 +
this.style.color = welcome.link.redLinkTalk.clickedColor;
 +
var n = parseInt(this.name.split('_')[2]);
 +
var newhref = "#anchor_welcome_"+(n+1);
 +
this.onmouseover = function() { return false; }
 +
this.onfocus = function() { return false; }
 +
this.onclick = function() {
 +
window.open(this.href);  
 +
this.onclick = function() { return false; };
 +
return false;
 +
}
 +
this.onmousedown = function() { return false; }
 +
this.onmouseup = function() { return false; }
 +
this.onmouseout = function() {
 +
//var n = parseInt(this.name.split('_')[2]);
 +
//var newhref = "#anchor_welcome_"+(n+1);
 +
//this.href /**/+= '&hasdone=true'; //newhref;
 +
//this.href=newhref;
 +
this.href = "javascript:void(0);";
 +
this.onmouseout = function() {
 +
return false;
 +
}
 +
};
 +
//this.href = newhref;
 +
//this.tagName = 'SPAN';
 +
//this.innerHTML = 'welcomed';
 +
this.style.cursor = "default";
 +
};
 +
nlin.onmouseup = monclick;
 +
nlin.href = url;
 +
nlin.id = "id_welcome_"+j;
 +
nlin.name = "anchor_welcome_"+j;
 +
if(welcome.link.redLinkTalk.blink) nlin.style.textDecoration = 'blink';
 +
 +
try { //alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
 +
if(lin.nextSibling) {
 +
lin.parentNode
 +
.insertBefore(
 +
nlin,  
 +
lin.nextSibling
 +
);
 +
} else {
 +
lin.parentNode
 +
.appendChild(
 +
nlin
 +
);
 +
 +
}
 +
j++;
 +
} catch(e) {
 +
//alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
 +
//alert(e.toString());
 +
}
 +
}
 +
}
 +
});
 +
}
 +
 
 +
if(welcome.options.addTab && ( wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk' ) ) {
 +
addOnloadHook(function() {
 +
try {
 +
var href = document.getElementById('ca-edit').firstChild.href;
 +
var charao = (href.indexOf('?') != -1)?'&':'?';
 +
href += charao+"autowelcome=true";
 +
if(wgCanonicalNamespace == 'User') href = href.replace(/User:/i, 'User_talk:');
 +
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
 +
addlilink(tbs, href, welcome.link.tab.text, 'ca-welcome', 'Welcome '+wgTitle, welcome.link.tab.accessKey);
 +
} catch(e) { }
 +
});
 +
}
 +
 
 +
if(window.location.href.indexOf('autowelcome=true') != -1
 +
&&window.location.href.indexOf('action=edit') == -1) {
 +
window.location.href += '&action=edit';
 +
}
 +
 
 +
if(window.location.href.indexOf('action=edit') != -1
 +
&& window.location.href.indexOf('autowelcome=true') != -1) {
 +
if(window.location.href.indexOf('hasdone=true') != -1) {
 +
location.href = location.href.split('action=edit')[0]
 +
.split('autowelcome=true')[0];
 +
} else {
 +
addOnloadHook(function() {
 +
var text = document.getElementById('wpTextbox1').value;
 +
if(welcome.options.askIfPageIsNotBlank && text != '') {
 +
var oktogo = confirm("There was other text detected on this page\
 +
Would you like to continue with the welcome?");
 +
} else var oktogo = true;
 +
var newtext = text + '\
 +
';
 +
if((/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/).test(wgPageName))
 +
newtext += welcome.edit.textAnon;
 +
else
 +
newtext += welcome.edit.text;
 +
document.getElementById('wpTextbox1').value = newtext;
 +
document.getElementById('wpSummary').value = welcome.edit.summary;
 +
if(!oktogo) return;
 +
document.getElementById(welcome.edit.button).click();
 +
});
 +
}
 +
}</nowiki></pre>

Current revision as of 09:49, 11 April 2007

/* <pre><nowiki> */
addOnloadHook(function() {
	if(document.getElementById('ca-delete')) {
		for(var i=0; i<document.getElementsByTagName('div').length; i++) {
			if(document.getElementsByTagName('div')[i].className == 'nosysop') document.getElementsByTagName('div')[i].style.display = "none";
		}
		for(var i=0; i<document.getElementsByTagName('div').length; i++) {
			if(document.getElementsByTagName('div')[i].className == 'onlysysop') document.getElementsByTagName('div')[i].style.display = "block";
		}
	}
});

addOnloadHook(function() {
	if((wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk') && document.getElementById('ca-delete')) {
		var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
		addlilink(tbs, wgArticlePath.replace('$1', 'Special:Makesysop?target='+wgTitle.replace(/ /g, '_').split('/')[0]), "makesysop", 'ca-sys', '');
	}
});

/** Click on Image ***********************************************************
  *
  *  Description: Make images clickable to a different location
  *               than the one set by MediaWiki
  *  Maintainers: [[User:GeorgeMoney]]
  */
 
 addOnloadHook(function() {
	var usebody = document.getElementById('bodyContent') || document;
	var divs = usebody.getElementsByTagName('div');
	for(var i = 0; i < divs.length; i++) {
		try {
			if(divs[i].getAttribute('class') != 'click') continue;
			var titleurl =  divs[i].getAttribute('title').split('URL=');
			divs[i].getElementsByTagName('a')[0]
				.setAttribute('title', titleurl[0]);
			divs[i].setAttribute('title', '');
			if(typeof titleurl[1] == 'undefined') continue;
			var useurl;
			if(titleurl[1].substr(0, 2) == '[[' 
			&& titleurl[1].substr(titleurl[1].length-2) == ']]') {
				useurl = titleurl[1].substr(0, titleurl[1].length-2).substr(2);
				useurl = wgServer + wgArticlePath.replace('$1', useurl);
			} else
				useurl = titleurl[1];
			divs[i].getElementsByTagName('a')[0]
				.setAttribute('href', useurl);
		} catch(e) { }
	}
});

//Auto welcome user script written by GeorgeMoney
if(welcome == undefined) {
//If you would like to make your own config you have 2 options:
//1:Copy the entire code to your monobook and change the config
//2:Copy everything, from this line until you see 'end config', into your monobook.js, and include the module to your monobook via an import function

var welcome={};welcome.edit={};welcome.link={};welcome.link.tab={};welcome.link.newUserLog={};welcome.link.redLinkTalk={};welcome.options={};

//config
welcome.edit.summary = "Welcome to The Test Wiki!";
welcome.edit.text = "{{sub" + "st:Welcome}}" + "\
" + "~~" + "~~";
welcome.edit.textAnon = "{{sub" + "st:Welcomeip}}" + "\
" + "~~" + "~~";
welcome.edit.button = 'wpSave';

welcome.link.newUserLog.defaultColor = "blue";
welcome.link.newUserLog.clickedColor = "green";
welcome.link.newUserLog.text = "[welcome]";

welcome.link.redLinkTalk.defaultColor = "blue";
welcome.link.redLinkTalk.clickedColor = "green";
welcome.link.redLinkTalk.text = "[welcome]";
welcome.link.redLinkTalk.blink = false;

welcome.link.tab.text = "welcome!";
welcome.link.tab.accessKey = 'a';

welcome.options.newUserLogaddReloadButton = true;
welcome.options.newUserLogEnabled = true;
welcome.options.redLinkTalkEnabled = true;
welcome.options.addTab = true;
welcome.options.askIfPageIsNotBlank = true;
welcome.options.maxLinks = 1000;
welcome.options.warnIfOverMaxLinks = false;

//end config

}
//main script
if(welcome.options.newUserLogEnabled && (/Special(%3A|:)Log(\\/newusers$|(.*?&|\\?)type=newusers)/i).test(window.location.href)) {
	if(window.location.hash != "") window.location.hash = "";
	else {
		addOnloadHook(function() {
			var lis = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
			for (var i=0; i<lis.length; i++) {
				var li = lis[i];
				var url = li.firstChild.nextSibling.nextSibling.nextSibling.href;
				var charao = (url.indexOf('?') != -1)?'&':'?';
				url += charao+"autowelcome=true"
				var link = document.createElement('a');
				link.appendChild(document.createTextNode(welcome.link.newUserLog.text));
				link.style.color = welcome.link.newUserLog.defaultColor;
				monclick = function() {
					//this.style = { };
					this.style.textDecoration = 'none';
					this.style.color = welcome.link.newUserLog.clickedColor;
						var n = parseInt(this.name.split('_')[2]);
						var newhref = "#anchor_welcome_"+(n+1);
					this.onmouseover = function() { return false; }
					this.onfocus = function() { return false; }
					this.onclick = function() { 
						window.open(this.href); 
						this.onclick = function() { return false; }; 
						return false; 
					}
					this.onmousedown = function() { return false; }
					this.onmouseup = function() { return false; }
					this.onmouseout = function() { 
						//var n = parseInt(this.name.split('_')[2]);
						//var newhref = "#anchor_welcome_"+(n+1);
						//this.href /**/+= '&hasdone=true'; //newhref;
						//this.href=newhref;
						this.href = "javascript:void(0);";
						this.onmouseout = function() {
							return false;
						}
					};
					//this.href = newhref;
					//this.tagName = 'SPAN';
					//this.innerHTML = 'welcomed';
					this.style.cursor = "default";
				};
				//link.onfocus = monclick;
				link.onmouseup = monclick;
				link.href = url;
				link.id = "id_welcome_"+i;
				link.name = "anchor_welcome_"+i;
				li.appendChild(link);
			}
			
			if(welcome.options.newUserLogaddReloadButton) {
				var h1 = document.getElementsByTagName('h1')[0];
				var button = document.createElement('input');
				button.onclick = function() { 
					if(window.location.hash != "") 
						window.location.hash = "";
					location.reload();
				}
				button.value = "reload";
				button.type = "button";
				h1.parentNode.insertBefore(button, h1.nextSibling);
			}
		});
	}
}

if(welcome.options.redLinkTalkEnabled && !((/Special(%3A|:)Log(\\/newusers$|(.*?&|\\?)type=newusers)/i).test(window.location.href)) && ( ( (wgNamespaceNumber > -1 && wgNamespaceNumber % 2 != 0) || (wgCanonicalNamespace == "Wikipedia"||wgCanonicalNamespace == 'Special') ) || !wgIsArticle )) {
	addOnloadHook(function() {
		var alinks = document.getElementById('bodyContent').getElementsByTagName('a');
		if(alinks.length > welcome.options.maxLinks) {
			if(welcome.options.warnIfOverMaxLinks)
				var ok_to_go = confirm("This page has over "+welcome.options.maxLinks+" links.\
"
				+"Searching for red links to add welcome links might take a while and freeze your"
				+" browser\
To continue and add welcome links, press ok.");
			else var ok_to_go = false;
		} else var ok_to_go = true;
		if(!ok_to_go) return;
		for(var i=0, j=0; i<alinks.length; i++) {
			var lin = alinks[i];
			if(lin.className == "new" && (/User([_ ]talk)?:/i).test(lin.href) && lin.href.substr('http://en.wikipedia.org/w/index.php?title='.length).indexOf('/') == -1) {
				var url = lin.href;
				url = url.replace('User:', 'User_talk:');
				var charao = (url.indexOf('?') != -1)?'&':'?';
				url += charao+"autowelcome=true"
				var nlin = document.createElement('a');
				nlin.appendChild(document.createTextNode(welcome.link.redLinkTalk.text));
				nlin.style.color = welcome.link.redLinkTalk.defaultColor;
				monclick = function() {
					this.style.textDecoration = 'none';
					this.style.color = welcome.link.redLinkTalk.clickedColor;
						var n = parseInt(this.name.split('_')[2]);
						var newhref = "#anchor_welcome_"+(n+1);
					this.onmouseover = function() { return false; }
					this.onfocus = function() { return false; }
					this.onclick = function() { 
						window.open(this.href); 
						this.onclick = function() { return false; }; 
						return false; 
					}
					this.onmousedown = function() { return false; }
					this.onmouseup = function() { return false; }
					this.onmouseout = function() { 
						//var n = parseInt(this.name.split('_')[2]);
						//var newhref = "#anchor_welcome_"+(n+1);
						//this.href /**/+= '&hasdone=true'; //newhref;
						//this.href=newhref;
						this.href = "javascript:void(0);";
						this.onmouseout = function() {
							return false;
						}
					};
					//this.href = newhref;
					//this.tagName = 'SPAN';
					//this.innerHTML = 'welcomed';
					this.style.cursor = "default";
				};
				nlin.onmouseup = monclick;
				nlin.href = url;
				nlin.id = "id_welcome_"+j;
				nlin.name = "anchor_welcome_"+j;
				if(welcome.link.redLinkTalk.blink) nlin.style.textDecoration = 'blink';
				
				try { //alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
					if(lin.nextSibling) {
						lin.parentNode
							.insertBefore(
								nlin, 
								lin.nextSibling
							);
					} else { 
						lin.parentNode
							.appendChild(
								nlin
							);
					
					}
					j++;
				} catch(e) {
					//alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
					//alert(e.toString());
				}
			}
		}
	});
}

if(welcome.options.addTab && ( wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk' ) ) {
	addOnloadHook(function() {
		try {
			var href = document.getElementById('ca-edit').firstChild.href;
			var charao = (href.indexOf('?') != -1)?'&':'?';
			href += charao+"autowelcome=true";
			if(wgCanonicalNamespace == 'User') href = href.replace(/User:/i, 'User_talk:');
			var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
			addlilink(tbs, href, welcome.link.tab.text, 'ca-welcome', 'Welcome '+wgTitle, welcome.link.tab.accessKey);
		} catch(e) { }
	});
}

if(window.location.href.indexOf('autowelcome=true') != -1
&&window.location.href.indexOf('action=edit') == -1) {
	window.location.href += '&action=edit';
}

if(window.location.href.indexOf('action=edit') != -1 
&& window.location.href.indexOf('autowelcome=true') != -1) {
	if(window.location.href.indexOf('hasdone=true') != -1) {
		location.href = location.href.split('action=edit')[0]
						.split('autowelcome=true')[0];
	} else {
		addOnloadHook(function() {
			var text = document.getElementById('wpTextbox1').value;
			if(welcome.options.askIfPageIsNotBlank && text != '') {
				var oktogo = confirm("There was other text detected on this page\
Would you like to continue with the welcome?");
			} else var oktogo = true;
			var newtext = text + '\
';
			if((/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/).test(wgPageName))
				newtext += welcome.edit.textAnon;
			else 
				newtext += welcome.edit.text;
			document.getElementById('wpTextbox1').value = newtext;
			document.getElementById('wpSummary').value = welcome.edit.summary;
			if(!oktogo) return;
			document.getElementById(welcome.edit.button).click();
		});
	}
}</nowiki></pre>
Personal tools