User:Alan Isherwood/monobook.js
Appearance
(Redirected from User:DWZ/monobook.js)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin can be added at User:Alan Isherwood/monobook.css. |
/* [[User:Lupin/popups.js]] */
mw.loader.load(
'https://wiki.riteme.site/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/* Interiot's javascript edit counter */
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
mw.loader.load('https://wiki.riteme.site/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }
importScript('Wikipedia:WikiProject User scripts/Scripts/Time');
function unverified() {
// Find the edit box
var txt = document.editform.wpTextbox1;
// The tag to be included is an unverified image template
var tag = '\u007b\u007b' + 'unverified' + '\u007d\u007d';
// If the edit box doesn't already have this tag...
if (txt.value.indexOf(tag) == -1) {
// Append the tag
txt.value += tag;
// Add an edit summary
document.editform.wpSummary.value = 'Needs a source and copyright tag — see [[Wikipedia:Image copyright tags]]';
// Press the Save page button
document.editform.submit();
}
// If the tag was already there, turn the tab background red to indicate
// that the script is functioning properly, but that there is no action
// to do. This doesn't interrupt the user's work like an alert() would.
else {
document.getElementById('ca-unverified').firstChild.style.backgroundColor = "#ff4444";
document.getElementById('ca-unverified').style.backgroundColor = "#ff4444";
}
}
// Create a tab that calls this function when pressed
$(function () {
if(document.title.indexOf("Editing Image:") == 0) {
addLink('p-cactions', 'javascript:unverified()', 'tag', 'ca-unverified', 'Adds a tag to an unverified image', '', '');
}
});
//Localized time/date script
function numToMonth(num) {
if (num==0) {return "Janurary";}
else if (num==1) {return "February";}
else if (num==2) {return "March";}
else if (num==3) {return "April";}
else if (num==4) {return "May";}
else if (num==5) {return "June";}
else if (num==6) {return "July";}
else if (num==7) {return "August";}
else if (num==8) {return "September";}
else if (num==9) {return "October";}
else if (num==10) {return "November";}
else if (num==11) {return "December";}
}
function monthToNum(month) {
var tmp = new Date(month + " 1, 2006");
return tmp.getMonth();
}
function adjustTime(str, hour, minute, day, month, year, offset, s) {
var time = new Date();
time.setUTCHours(hour);
time.setUTCMinutes(minute);
time.setUTCDate(day);
time.setUTCMonth(monthToNum(month));
time.setUTCFullYear(year);
var timeStr = "";
if (time.getHours()<10) {timeStr += "0";}
timeStr += parseInt(time.getHours()) + ":";
if (time.getMinutes()<10) {timeStr += "0";}
timeStr += parseInt(time.getMinutes());
timeStr += ", ";
timeStr += time.getDate();
timeStr += " ";
timeStr += numToMonth(time.getMonth());
timeStr += " ";
timeStr += time.getFullYear();
timeStr += " (UTC";
var offset = -1*time.getTimezoneOffset()/60;
if (offset >= 0) {timeStr += "+";}
timeStr += offset + ")";
return timeStr;
}
function adjustTime2(str, hour, minute, month, day, year, offset, s) {
return adjustTime(str, hour, minute, day, month, year, offset, s);
}
$(function() {
if (document.title.indexOf("Editing ") == 0) {
return;
}
if (document.location.href.indexOf("action=history") != -1) {
return;
}
if (document.title.indexOf("Talk:") == 0 || document.title.indexOf("talk:") != -1 || document.title.indexOf("Wikipedia:") == 0) {
var newDoc = document.getElementById("column-content").innerHTML.replace(/(\d\d):(\d\d), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/g, adjustTime);
document.getElementById("column-content").innerHTML = newDoc;
}
/* if (document.location.href.indexOf("&action=history") != -1) {
var newDoc = document.getElementById("bodyContent").innerHTML.replace(/(\d\d):(\d\d), ([A-Z][a-z]+) (\d{1,2}), (\d{4})/g, adjustTime2);
document.getElementById("bodyContent").innerHTML = newDoc;
}*/
});