User:Dev920/Monobook.js
Appearance
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. |
Documentation for this user script can be added at User:Dev920/Monobook. |
// [[User:Outriggr/metadatatest.js]] <nowiki>
importScript('User:Outriggr/metadatatest.js');
assessmentMyTemplateCode = ["{{LGBTProject|class=|importance=}}", "{{WPBiography|class=|importance=}}", "{{BradProject|class=|importance=}}"];
assessmentDefaultProject = "LGBTProject";
// </nowiki>
/**** afd helper ****/
document.write('<script type="text/javascript"' +
'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' +
'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */
$(function () {
if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;
if (!document.forms[0] || !document.forms[0].namespace) return;
var link = document.createElement('a');
link.id = 'listSince';
link.href = '#listSince'; // must have a href to show as link!
var then = +(new Date());
var fixLinkHref = function () {
var url = window.location.href.split('#')[0];
var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
if (url.match(/[?&]days=/))
this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
else
this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
return true;
};
link.onclick = fixLinkHref;
link.onmousedown = fixLinkHref; // react to middle clicks too
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(' | '));
frag.appendChild(link);
link.appendChild(document.createTextNode('Changes'));
frag.appendChild(document.createTextNode(' since last load.'));
// just one little ID attribute would be _so_ nice...
var nsSelectForm = document.getElementsByTagName('form')[0];
nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);
});
//
// addPurge
$(function () {
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
'purge', 'ca-purge', 'Purge server cache for this page', '0');
});
//
//Please leave the following line
//[[user:Where/easy db]]
//Start db script
//<nowiki>
$(function()
{
//check if called from deletion request
if (document.title.indexOf("Editing ") != -1)
{
if (document.URL.lastIndexOf("&fakeaction=huff") == -1)
return;
if (document.URL.lastIndexOf("&reason=off") != -1)
{
var type = prompt("Enter criteria for speedy deletion, e.g. A1, G3");
if (type == null)
return;
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type + "]])";
f.wpSave.click();
return;
}
else if (document.URL.lastIndexOf("&reason=on") != -1)
{
var type = prompt("Enter reason for speedy deletion");
if (type == null)
return;
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db|" + type + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion";
f.wpSave.click();
return;
}
}
if (wgCanonicalNamespace == "Special")
return;
mw.util.addPortletLink("p-cactions", "javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");
mw.util.addPortletLink("p-cactions", "javascript:easyDb(1)", "db (reason)", "ca-db1", "Request speedy deletion with reason", "");
});
//</nowiki>
function easyDb(n)
{
if (n == 0)
{
//edit page
location.assign("/w/index.php?title=" + wgPageName + "&action=edit&fakeaction=huff&reason=off");
}
if (n == 1)
{
//edit page
location.assign("/w/index.php?title=" + wgPageName + "&action=edit&fakeaction=huff&reason=on");
}
}
//End db script
//