User:Megaboz/modern.js

// User:Lupin/popups.js //importScript('User:Lupin/popups.js'); //importScript('User:Macy/FastButtons.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited');

importScript('User:Mr.Z-man/rollbackSummary.js'); //// FastButtons code copied from Macy/FastButtons.js

//FastButtons, based on the original work of Racso from Spanish Wikipedia, //translated by Macy. // var pagina =; var mot=; var txt=; var botones=; var usuario=; var temporal=; var sep="|"; var biblio=false; var ufb = '. (FBs)'; var dire="http://en.wikipedia.org/w/index.php?title="; var fin_otro="edit&borrar=otro-"; var fin_aviso="edit&aviso="; var textopruebas="Warn user:\n—Vandalism:\n1: Level 1\n2: Level 2\n3: Level 3\n4: Level 4\n4im: Level 4im\n \nAdditionally, you may add the article name\nfollowed by a |"; var FBpersonal = false; //Personal configuration var FBpruebas= true;	//Test edits var FBblanco = true;	//Vandalism var FBne = true;	//Nonsense pages var FBinfra = true;	//Attack pages var FBautopromo = true;	//Promotional var FBbio = true;	//A7 var FBband = true;	//A7 var FBweb = true;	//A7 var FBinc = true;	//Nonsense pages var FBotro = true;	//Custom CSD var FBcommons = true;	//Now Commons var FBimfu = true;	//No fair use rationale var FBwikify = true;   //Wikify var FBunref = true;	//Unreferenced var FBcleanup = true;	//Cleanup var FBnpov = true;	//POV var FBglobal = true;	//Globalize var FBcedit = true;	//Copyedit var FBborrar = false;	//Speedy delete (test) var FBaviso = true;	//Warn user var FBwelcome = false;	//Welcome user //All data is here: for (i=0; i<wgUserGroups.length; i++) { if (wgUserGroups[i] == "sysop") biblio=true; } for (i=0; ispeedy delete!] '; } if (tmp!=''){botones = botones + 'Sysop buttons: ' +tmp+' ';} } if (biblio===false) if (autoconfirmed===true) {	tmp=''; if( wgNamespaceNumber == 0 ) if (FBpruebas){tmp+= '[test] '; } if( wgNamespaceNumber == 0 ) if (FBblanco){tmp+= '[vandalism] '; } if( wgNamespaceNumber == 0 ) if (FBne){tmp+= '[nonsense] '; } if( wgNamespaceNumber == 0 ) if (FBinfra){tmp+= '[attack] '; } if( wgNamespaceNumber == 0 ) if (FBautopromo){tmp+= '[promotional] '; } if( wgNamespaceNumber == 6 ) if (FBimfu){tmp+= '[no fair use] '; } if( wgNamespaceNumber == 6 ) if (FBcommons){tmp+= '[commons] '; } if( wgNamespaceNumber == 0 ) if (FBotro){tmp+= '[<a onclick="mot=prompt(/Enter reason:/);location.href=dire + fin_otro +encodeURI(mot) ;"> other </a>] ';} if( wgNamespaceNumber == 0 ) if (FBbio){tmp+= '/ A7: [<a href='+dire+'edit&borrar=bio>person</a> '; } if( wgNamespaceNumber == 0 ) if (FBband){tmp+= '| <a href='+dire+'edit&borrar=band>band</a> '; } if( wgNamespaceNumber == 0 ) if (FBweb){tmp+= '| <a href='+dire+'edit&borrar=web>web</a> '; } if( wgNamespaceNumber == 0 ) if (FBinc){tmp+= '| <a href='+dire+'edit&borrar=inc>inc</a>] '; } if (tmp!='') { botones= botones + 'CSD: ' + tmp + ' ';} } tmp=''; if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBwikify){tmp+= '[<a href='+dire+'edit&plant=wikify>wikify</a>] '; } if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBunref){tmp+= '[<a href='+dire+'edit&plant=unref>unreferenced</a>] '; } if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBcleanup){tmp+= '[<a href='+dire+'edit&plant=cleanup>cleanup</a>] '; } if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBnpov){tmp+= '[<a href='+dire+'edit&plant=npov>POV</a>] '; } if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBglobal){tmp+= '[<a href='+dire+'edit&plant=global>globalize</a>] '; } if( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) if (FBcedit){tmp+= '[<a href='+dire+'edit&plant=cedit>copyedit</a>] '; } if (tmp!=''){botones = botones + 'Templates: ' +tmp+' ';} tmp=''; if( wgNamespaceNumber == 3 ) if (FBaviso){tmp+='[<a onclick="mot=prompt(textopruebas);location.href=dire + fin_aviso +encodeURI(mot) ;">warn user</a>] ';} if( wgNamespaceNumber == 3 ) if (FBwelcome){tmp+= '[<a href='+dire+'edit&plant=welcome>welcome</a>] '; } if (tmp!=''){botones = botones + 'Special: ' +tmp+' ';} /* Botones funcionando */ $(function { if (document.getElementById('contentSub').innerHTML!='') {document.getElementById('contentSub').innerHTML+=' ';} document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML+/*' ' +*/ botones;// + ' '; if (location.href.match("borrar=blanco")) {	txt=document.getElementById("wpTextbox1").value;	if (txt.match("{db")==null)	{		txt= '\n' + txt;		document.getElementById ("wpTextbox1").value=txt;		document.editform.wpSummary.value = 'Requesting speedy deletion G2'+ufb;		document.editform.submit;	} } else if (location.href.match("borrar=pruebas")) {	txt=document.getElementById("wpTextbox1").value;	if ((txt.match("{db")==null) && (txt!=""))	{		txt= '\n' + txt;		document.getElementById ("wpTextbox1").value=txt;		document.editform.wpSummary.value = 'Requesting speedy deletion G3'+ufb;		document.editform.submit;	} } else if (location.href.match("borrar=NE")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion G1'+ufb; document.editform.submit; } } else if (location.href.match("borrar=infra")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion G10'+ufb; document.editform.submit; } } else if (location.href.match("borrar=autopromo")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion G11'+ufb; document.editform.submit; } } else if (location.href.match("borrar=otro")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		mot=location.href.substring(location.href.indexOf('otro-')+5, location.href.length) if (mot!=null) {			txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion'+ufb; document.editform.submit; }	} } else if (location.href.match("borrar=norat")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion I8'+ufb; document.editform.submit; } } else if (location.href.match("borrar=commons")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion I6'+ufb; document.editform.submit; } } else if (location.href.match("borrar=bio")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion A7'+ufb; document.editform.submit; } } else if (location.href.match("borrar=band")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion A7'+ufb; document.editform.submit; } } else if (location.href.match("borrar=web")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion A7'+ufb; document.editform.submit; } } else if (location.href.match("borrar=inc")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{db")==null) && (txt!="")) {		txt= '\n' + txt document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Requesting speedy deletion A7'+ufb; document.editform.submit; } } else if (location.href.match("plant=wikify")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{wikify")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.submit; } } else if (location.href.match("plant=unref")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{unreferenced")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.submit; } } else if (location.href.match("plant=cleanup")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{cleanup")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.wpSave.click; } } else if (location.href.match("plant=npov")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{POV")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.wpSave.click; } } else if (location.href.match("plant=global")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{globalize")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.wpSave.click; } } else if (location.href.match("plant=cedit")) {	txt=document.getElementById("wpTextbox1").value if ((txt.match("{copyedit")==null) && (txt!="")) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Tagged with '+ufb; document.editform.submit; } } else if (location.href.match("plant=welcome")) {	txt=document.getElementById("wpTextbox1").value if (txt.match("{destruir")==null) {		txt='\n'+txt; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Welcoming user'+ufb; document.editform.submit; } } else if (location.href.match("rapido=si")) {	document.getElementById ("wpConfirmB").click; } else if (location.href.match("aviso=")) {	txt=document.getElementById("wpCombobox1").value; mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length); txt=txt+'\n\n --~'; document.getElementById ("wpTextbox1").value=txt; document.editform.wpSummary.value = 'Warning user'+ufb; document.editform.submit; } }); // //Special FastButtons start here //Edit count FastButton $(function { if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //no subpages or history return; if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") { var username = encodeURIComponent( wgTitle ); var checkurl = "http://toolserver.org/~soxred93/count/index.php?name="+ username +"&lang=en&wiki=wikipedia" ; mw.util.addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "View edit count by this user"); } }); //Special:Prefixindex FastButton $(function { if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1) //no subpages or history return; if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") { var username = encodeURIComponent( wgTitle ); var checkurl = wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2" ; mw.util.addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "List of pages by this user"); } });

//////////////////////////////////////// End FastButtons code

$(function { if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history     return;  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {     var username = encodeURIComponent( wgTitle );     mw.util.addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "User contributions");     //mw.util.addPortletLink("p-cactions", wgServer + "/wikipedia/en/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "User contributions");     mw.util.addPortletLink("p-cactions", "http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "count", "ca-editcount", "Edit count from Interiot's Tool1");     mw.util.addPortletLink("p-cactions", "http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=" + username + "&site=en.wikipedia.org", "Summary", "ca-summary", "Edit Summary"); } });

///// LOCALIZE DATE CODE COPIED FROM User:Gary King/localize_comments.js $(function {	if (wgCanonicalNamespace == '' || wgCanonicalNamespace == 'MediaWiki' || wgCanonicalNamespace == 'Special')		return;	var disabled_urls = new Array('action=history');	for (var i = 0; i < disabled_urls.length; i++)	{		if (document.location.href.indexOf(disabled_urls[i]) != -1)			return;	}	var unique_url = false;	var wikiPreview = new Array('action=edit', 'action=submit');	for (var i = 0; i < wikiPreview.length; i++)	{		if (document.location.href.indexOf(wikiPreview[i]) != -1)			unique_url = 'wikiPreview';	}	var element_id = unique_url ? unique_url : 'bodyContent';	document.getElementById(element_id).innerHTML = 		document.getElementById(element_id).innerHTML.replace(/(\d\d):(\d\d), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/g, adjustTime); }); function add_leading_zero(number) {	if (number < 10) number = "0" + number; return number; } function adjustTime(str, old_hour, old_minute, old_day, old_month, old_year, offset, s) { var today = new Date; var yesterday = new Date; yesterday.setDate(yesterday.getDate - 1); // set the date entered var time = new Date; time.setUTCHours(old_hour); time.setUTCMinutes(old_minute); // fix for when the date is the 31st of the month if (old_day == '31') time.setUTCDate('30'); else time.setUTCDate(old_day); time.setUTCMonth(convert_month_to_number(old_month)); time.setUTCFullYear(old_year); // figure out what the time offset is	var utc_offset = -1 * time.getTimezoneOffset / 60; if (utc_offset >= 0) utc_offset = '+' + utc_offset; // set the date bits to output var year = time.getFullYear; var month = add_leading_zero(time.getMonth + 1); // fix for when the date is the 31st of the month if (old_day == '31') var day = time.getDate + 1; else var day = time.getDate; var hour = add_leading_zero(parseInt(time.getHours)); var minute = add_leading_zero(time.getMinutes); // output am or pm depending on the date var ampm = 'am'; if (hour > 11) ampm = 'pm'; if (hour > 12) hour -= 12; if (hour == '00') hour = 12; // Return 'today' or 'yesterday' if that is the case if (year == today.getFullYear && month == add_leading_zero(today.getMonth + 1) && day == today.getDate) var date = 'Today'; else if (year == yesterday.getFullYear && month == add_leading_zero(yesterday.getMonth + 1) && day == yesterday.getDate) var date = 'Yesterday'; else {		// Calculate day of week var day_names = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var day_of_the_week = day_names[time.getDay]; // The distance in days from today and last Monday? today = new Date(today.getYear, today.getMonth, today.getDate); time = new Date(time.getYear, time.getMonth, time.getDate); // Calculate time difference var milliseconds_ago = today.getTime - time.getTime; var days_ago = milliseconds_ago / 1000 / 60 / 60 / 24; days_ago = Math.round(days_ago); if (days_ago <= 7) var last = 'last '; else var last = ''; // Calculate as accurately as possible, difference in days and weeks var difference = new Date(today.valueOf - time.valueOf); var descriptive_difference = []; if (difference.getYear - 70 > 0) {			var years_ago = (difference.getYear - 70) + ' ' + 'year'.pluralize(difference.getYear - 70, 'years') + ' ago'; descriptive_difference.push(years_ago); }		if (difference.getMonth > 0) {			var months_ago = difference.getMonth + ' ' + 'month'.pluralize(difference.getMonth, 'months') + ' ago'; descriptive_difference.push(months_ago); }		if (difference.getDate > 0) {			var days_ago = difference.getDate + ' ' + 'day'.pluralize(difference.getDate, 'days') + ' ago'; descriptive_difference.push(days_ago); }		var date = year + '-' + month + '-' + add_leading_zero(day) + ', ' + last + day_of_the_week + ' (' + descriptive_difference.join(', ') + ')'; }	var time = hour + ':' + minute + ' ' + ampm; var return_date = date + ', ' + time + ' (UTC' + utc_offset + ')'; return "<span style='font-size: 90%;' title='" + str + "'>" + return_date.replace(/ /g, ' ') + ' '; } function convert_month_to_number(month) {  var tmp = new Date(month + " 1, 2006"); return tmp.getMonth; } String.prototype.pluralize = function(count, plural) { if (plural == null) plural = this + 's'; return (count == 1 ? this : plural) } // END LOCALIZE DATE CODE