MediaWiki:Monobook.js: Difference between revisions

From Wikifang, a definitive guide to Telefang, Dino Device and Bugsite
Jump to navigation Jump to search
No edit summary
No edit summary
Line 56: Line 56:
ta['ca-nstab-forum'] = new Array('c','View the forum topic');
ta['ca-nstab-forum'] = new Array('c','View the forum topic');
ta['n-browse'] = new Array('','Browse through the categories');
ta['n-browse'] = new Array('','Browse through the categories');
<!-- Start of StatCounter Code -->
var sc_project=3330562;
var sc_invisible=0;
var sc_partition=36;
var sc_security="db47ad06";
var sc_width=screen.width;
var sc_height=screen.height;
var sc_referer=""+document.referrer;
try
{
  sc_referer=""+parent.document.referrer;
}
catch (ex)
{
sc_referer=""+document.referrer;
}
var sc_os = "";
var sc_title = "";
var sc_url = "";
var sc_unique = 0;
var sc_returning = 0;
var sc_returns = 0;
var sc_base_dir;
var sc_error=0;
var sc_remove=0;
var sc_http_url="http";
var sc_link_back_start = "";
var sc_link_back_end = "";
var sc_security_code = "";
if(window.sc_https) {
if(sc_https==1) {
sc_doc_loc = ''+document.location;
myRE = new RegExp("^https", "i")
if(sc_doc_loc.match(myRE)) {
sc_http_url = "https";
}
else {
sc_http_url = "http";
}
}
else
sc_http_url = "http";
}
if(window.sc_partition) {
var sc_counter = "";
if(window.sc_partition!=34) {
sc_counter = sc_partition+1;
}
sc_base_dir = sc_http_url+"://c"+sc_counter+".statcounter.com/";
}
else {
sc_base_dir = sc_http_url+"://c1.statcounter.com/";
}
if(window.sc_text)
sc_base_dir += "text.php?";
else
sc_base_dir += "t.php?";
if(window.sc_project) {
sc_base_dir += "sc_project="+sc_project;
}
else if(window.usr) {
sc_base_dir += "usr="+usr;
}
else {
sc_error = 1;
}
if(window.sc_remove_link) {
sc_link_back_start = "";
sc_link_back_end = "";
}
else {
sc_link_back_start = "<a class=\"statcounter\" href=\"http://www.statcounter.com\" target=\"_blank\">";
sc_link_back_end = "<\/a>";
}
sc_date = new Date();
sc_time = sc_date.getTime();
sc_time_difference = 60*60*1000;
sc_title = ""+document.title;
sc_url = ""+document.location;
sc_referer = sc_referer.substring(0, 255);
sc_title = sc_title.substring(0, 150);
sc_url = sc_url.substring(0, 150);
sc_referer = escape(sc_referer);
sc_title = escape(sc_title);
sc_url = escape(sc_url);
if (window.sc_security) {
sc_security_code = sc_security;
}
var sc_tracking_url = sc_base_dir+"&resolution="+sc_width+"&h="+sc_height+"&camefrom="+sc_referer+"&u="+sc_url+"&t="+sc_title+"&java=1&security="+sc_security_code+"&sc_random="+Math.random();
if(sc_error==1) {
document.writeln("Code corrupted. Insert fresh copy.");
}
else if(sc_remove==1) {
document.writeln("<b>StatCounter cannot track a high volume website like yours for free. This was stated several times during the sign up process. Please remove the code ASAP.</b>");
}
else if (window.sc_invisible) {
if(window.sc_invisible==1) {
sc_img = new Image();
sc_img.src = sc_tracking_url;
}
else {
document.writeln("<div class=\"statcounter\">"+sc_link_back_start+"<img src=\""+sc_tracking_url+"\" alt=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\">"+sc_link_back_end+"</div>");
}
}
else if (window.sc_text) {
document.writeln('<scr' + 'ipt language="JavaScript"' + ' src=' + sc_tracking_url+"&text=" + sc_text+ '></scr' + 'ipt>');
}
else {
document.writeln("<div class=\"statcounter\">"+sc_link_back_start+"<img src=\""+sc_tracking_url+"\" alt=\"StatCounter - Free Web Tracker and Counter\" border=\"0\">"+sc_link_back_end+"</div>");
}
if(window.sc_click_stat) {
var dlext = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip";
if (typeof (window.sc_download_type) == 'string') dlext = window.sc_download_type;
var ltype = "https?|ftp|telnet|ssh|ssl|mailto";
var dl = new RegExp ("\\.("+dlext+")$", "i");
var lnk = new RegExp ("^("+ltype+"):", "i");
var host_name = location.host.replace (/^www\./i, "");
var host_splitted = host_name.split(".");
var domain = host_splitted.pop();
domain = host_splitted.pop()+"."+domain;
var lnklocal_mask = "^https?:\/\/(.*)"+domain;
var lnklocal = new RegExp (lnklocal_mask, "i");
if (document.getElementsByTagName) {
var anchors = document.getElementsByTagName('a');
for (var i=0;i<anchors.length;i++) {
var anchor = anchors[i];
if (anchor.onclick) {
var original_click = anchor.onclick;
var s = original_click.toString().split("\n").join(" ");
var bs = s.indexOf('{');
var head = s.substr (0, bs-1);
var ps = head.indexOf('(');
var pe = head.indexOf(')');
var params = head.substring (ps+1,pe);
var plist = params.split(",");
var body = s.substr (bs+1, s.length-bs-2);
var insert = "sc_clickstat_call(this);";
var final_body = insert+body;
var ev_head = "new Function (";
var ev_params = "";
var ev_sep = "";
for (var sc_i=0;sc_i<plist.length;sc_i++) {
ev_params = ev_sep+"'"+plist[sc_i]+"'";
ev_sep=",";
}
if (ev_sep == ",") ev_params += ",";
var ev_foot = "final_body);";
var ev_final = ev_head+ev_params+ev_foot;
anchor.onclick = eval (ev_final);
} else {
anchor.onclick = new Function ("event", "sc_clickstat_call(this);return true;");
}
}
}
function sc_none () { return; }
function sc_clickstat_call (adata) {
if (adata) {
var clickmode = 0;
if (lnk.test(adata)) {
if ((lnklocal.test(adata))) {
if (dl.test (adata)) clickmode = 1;
} else {
clickmode = 2;
}
}
if (clickmode != 0) {
var sc_link = escape (adata);
if (sc_link.length > 0) {
var sc_req = sc_http_url+"://c"+sc_counter+".statcounter.com/click.html?sc_project="+sc_project+"&security="+sc_security_code+"&c="+sc_link+"&m="+clickmode+"&rand="+Math.random();
var sc_req_image = new Image(1,1);
sc_req_image.onload = sc_none;
sc_req_image.src = sc_req;
}
}
}
}
}


/*</nowiki></pre>*/
/*</nowiki></pre>*/

Revision as of 09:44, 13 January 2008

/*<pre><nowiki>*/

/* tooltips and access keys */

ta = new Object();
ta['pt-userpage'] = new Array('.','My user page');
ta['pt-anonuserpage'] = new Array('.','The user page for the ip you\'re editing as');
ta['pt-mytalk'] = new Array('n','My talk page');
ta['pt-anontalk'] = new Array('n','Discussion about edits from this ip address');
ta['pt-preferences'] = new Array('','My preferences');
ta['pt-watchlist'] = new Array('l','The list of pages you\'re monitoring for changes.');
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');
ta['ca-edit'] = new Array('e','You can edit this page. Please use the preview button before saving.');
ta['ca-addsection'] = new Array('+','Add a comment to this discussion.');
ta['ca-viewsource'] = new Array('e','This page is protected. You can view its source.');
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');
ta['ca-move'] = new Array('m','Move this page');
ta['ca-watch'] = new Array('w','Add this page to your watchlist');
ta['ca-unwatch'] = new Array('w','Remove this page from your watchlist');
ta['search'] = new Array('f','Search this wiki');
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');
ta['n-currentevents'] = new Array('','Find background information on current events');
ta['n-recentchanges'] = new Array('r','The list of recent changes in the wiki.');
ta['n-randompage'] = new Array('x','Load a random page');
ta['n-help'] = new Array('','The place to find out.');
ta['n-sitesupport'] = new Array('','Support us');
ta['n-forum'] = new Array('','Talk to us');
ta['n-content'] = new Array('','See all pages');
ta['t-whatlinkshere'] = new Array('j','List of all wiki pages that link here');
ta['t-recentchangeslinked'] = new Array('k','Recent changes in pages linked from this page');
ta['feed-rss'] = new Array('','RSS feed for this page');
ta['feed-atom'] = new Array('','Atom feed for this page');
ta['t-contributions'] = new Array('','View the list of contributions of this user');
ta['t-emailuser'] = new Array('','Send a mail to this user');
ta['t-upload'] = new Array('u','Upload images or media files');
ta['t-specialpages'] = new Array('q','List of all special pages');
ta['ca-nstab-main'] = new Array('c','View the content page');
ta['ca-nstab-user'] = new Array('c','View the user page');
ta['ca-nstab-media'] = new Array('c','View the media page');
ta['ca-nstab-special'] = new Array('','This is a special page, you can\'t edit the page itself.');
ta['ca-nstab-project'] = new Array('a','View the project page');
ta['ca-nstab-image'] = new Array('c','View the image page');
ta['ca-nstab-mediawiki'] = new Array('c','View the system message');
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');
ta['ca-nstab-forum'] = new Array('c','View the forum topic');
ta['n-browse'] = new Array('','Browse through the categories');

<!-- Start of StatCounter Code -->
var sc_project=3330562; 
var sc_invisible=0; 
var sc_partition=36; 
var sc_security="db47ad06"; 

var sc_width=screen.width;	
var sc_height=screen.height;
var sc_referer=""+document.referrer;
try
{
  sc_referer=""+parent.document.referrer;
}
catch (ex) 
{
	sc_referer=""+document.referrer;
}
var sc_os = "";
var sc_title = "";
var sc_url = "";
var sc_unique = 0;
var sc_returning = 0;
var sc_returns = 0;
var sc_base_dir;
var sc_error=0;
var sc_remove=0;
var sc_http_url="http";
var sc_link_back_start = "";
var sc_link_back_end = "";
var sc_security_code = "";

if(window.sc_https) {
	if(sc_https==1) {
		sc_doc_loc = ''+document.location;
		myRE = new RegExp("^https", "i")
		if(sc_doc_loc.match(myRE)) {
			sc_http_url = "https";
		}
		else {
			sc_http_url = "http";
		}
	}
	else
		sc_http_url = "http";
}

if(window.sc_partition) {
	var sc_counter = "";
	if(window.sc_partition!=34) {
		sc_counter = sc_partition+1;		
	}
	sc_base_dir = sc_http_url+"://c"+sc_counter+".statcounter.com/";
}
else {
	sc_base_dir = sc_http_url+"://c1.statcounter.com/";
}

if(window.sc_text)
	sc_base_dir += "text.php?";
else
	sc_base_dir += "t.php?";

if(window.sc_project) {
	sc_base_dir += "sc_project="+sc_project;
}
else if(window.usr) {
	sc_base_dir += "usr="+usr;
}
else {
	sc_error = 1;
}

if(window.sc_remove_link) {
	sc_link_back_start = "";
	sc_link_back_end = "";
}
else {
	sc_link_back_start = "<a class=\"statcounter\" href=\"http://www.statcounter.com\" target=\"_blank\">";
	sc_link_back_end = "<\/a>";
}

sc_date = new Date();
sc_time = sc_date.getTime();

sc_time_difference = 60*60*1000;

sc_title = ""+document.title;
sc_url = ""+document.location;
sc_referer = sc_referer.substring(0, 255);
sc_title = sc_title.substring(0, 150);
sc_url = sc_url.substring(0, 150);
sc_referer = escape(sc_referer);
sc_title = escape(sc_title);
sc_url = escape(sc_url);

if (window.sc_security) {
	sc_security_code = sc_security;
}

var sc_tracking_url = sc_base_dir+"&resolution="+sc_width+"&h="+sc_height+"&camefrom="+sc_referer+"&u="+sc_url+"&t="+sc_title+"&java=1&security="+sc_security_code+"&sc_random="+Math.random();

if(sc_error==1) {
		document.writeln("Code corrupted. Insert fresh copy.");
}
else if(sc_remove==1) {
		document.writeln("<b>StatCounter cannot track a high volume website like yours for free. This was stated several times during the sign up process. Please remove the code ASAP.</b>");
}
else if (window.sc_invisible) {
	if(window.sc_invisible==1) {
	sc_img = new Image();
	sc_img.src = sc_tracking_url;
	}
	else {
		document.writeln("<div class=\"statcounter\">"+sc_link_back_start+"<img src=\""+sc_tracking_url+"\" alt=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\">"+sc_link_back_end+"</div>");
	}
}
else if (window.sc_text) {
	document.writeln('<scr' + 'ipt language="JavaScript"' + ' src=' + sc_tracking_url+"&text=" + sc_text+ '></scr' + 'ipt>');
}
else {
	document.writeln("<div class=\"statcounter\">"+sc_link_back_start+"<img src=\""+sc_tracking_url+"\" alt=\"StatCounter - Free Web Tracker and Counter\" border=\"0\">"+sc_link_back_end+"</div>");
}

if(window.sc_click_stat) {
	
	var dlext = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip";
	if (typeof (window.sc_download_type) == 'string') dlext = window.sc_download_type;
	var ltype = "https?|ftp|telnet|ssh|ssl|mailto";
	var dl = new RegExp ("\\.("+dlext+")$", "i");
	var lnk = new RegExp ("^("+ltype+"):", "i");
	var host_name = location.host.replace (/^www\./i, "");
	var host_splitted = host_name.split(".");
	var domain = host_splitted.pop();
	domain = host_splitted.pop()+"."+domain;
	var lnklocal_mask = "^https?:\/\/(.*)"+domain;
	var lnklocal = new RegExp (lnklocal_mask, "i");
	
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName('a');
		for (var i=0;i<anchors.length;i++) {
			var anchor = anchors[i];
			
			if (anchor.onclick) {
				var original_click = anchor.onclick;
				var s = original_click.toString().split("\n").join(" ");
				var bs = s.indexOf('{');
				var head = s.substr (0, bs-1);
				var ps = head.indexOf('(');
				var pe = head.indexOf(')');
				var params = head.substring (ps+1,pe);
				var plist = params.split(",");
				var body = s.substr (bs+1, s.length-bs-2);
				var insert = "sc_clickstat_call(this);";
				var final_body = insert+body;
				var ev_head = "new Function (";
				var ev_params = "";
				var ev_sep = "";
				for (var sc_i=0;sc_i<plist.length;sc_i++) {
					ev_params = ev_sep+"'"+plist[sc_i]+"'";
					ev_sep=",";
				}
				if (ev_sep == ",") ev_params += ",";
				var ev_foot = "final_body);";
				var ev_final = ev_head+ev_params+ev_foot;
				anchor.onclick = eval (ev_final);
			} else {
				anchor.onclick = new Function ("event", "sc_clickstat_call(this);return true;");
			}
		}
	}
	
	function sc_none () { return; }
	
	function sc_clickstat_call (adata) {
		if (adata) {
			var clickmode = 0;
			if (lnk.test(adata)) {
				if ((lnklocal.test(adata))) {
					if (dl.test (adata)) clickmode = 1;
				} else {
					clickmode = 2;
				}
			}
			if (clickmode != 0) {
				var sc_link = escape (adata);
				if (sc_link.length > 0) {
					var sc_req = sc_http_url+"://c"+sc_counter+".statcounter.com/click.html?sc_project="+sc_project+"&security="+sc_security_code+"&c="+sc_link+"&m="+clickmode+"&rand="+Math.random();
					var sc_req_image = new Image(1,1);
					sc_req_image.onload = sc_none;
					sc_req_image.src = sc_req;
				}
			}
		}
	}
}

/*</nowiki></pre>*/