Jump to content

User:Cricketgirl/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var wikEdComboPresetOptions = [];
wikEdComboPresetOptions['summary'] = [
'copyedit', 'copyedit intro', 'copyedit first paragraph', 'reply', 'comment', 
'linkfix', 'fixing typos', 'reverting vandalism', 'formatting source text', '{wikEdUsing}'
];


// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

importScript("User:Lupin/recent2.js");



/* Watchlist notifier ([[User:Ais523/watchlistnotifier.js]]); displays a message every time a watched page changes. */
//<pre><nowiki>
 
var wmwpajax;
// From [[WP:US]] mainpage (wpajax renamed to wmwpajax)
wmwpajax={
download:function(bundle) {
// mandatory: bundle.url
// optional:  bundle.onSuccess (xmlhttprequest, bundle)
// optional:  bundle.onFailure (xmlhttprequest, bundle)
// optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure
 
var x = window.XMLHttpRequest ? new XMLHttpRequest()
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
: false;
 
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && wmwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,true);
x.send(null); 
}
return x;
},
 
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url));
}
};
 
// Example:
// function dlComplete(xmlreq, data) {
//      alert(data.message + xmlreq.responseText);
// }
//  wmwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw', 
//                   onSuccess: dlComplete, message: "Here's what we got:\n\n" });
 
// End of [[WP:US]] quote
 
function wmWatchEditFound(xmlreq, data) {
var watchrev, watchsum, watchrevold, watchpage, junk;
watchrev=xmlreq.responseText.split('timestamp="')[1].split('"')[0];
if(wgPageName == "Special:Watchlist")
document.cookie="ais523wmwatchrev="+watchrev+".; path=/";
else
{
watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0];
watchpage=xmlreq.responseText.split('title="')[1].split('"')[0];
try
{
watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0];
}
catch(junk) {watchrevold=0;}
watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;');
watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;');
if(watchrev!=watchrevold)
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>\""+watchpage+'" changed: "'+watchsum+'".</div>';
}
}
 
$(function() {
/* Find the top item in the watchlist, and its edit summary. We only need one item, so
set the limit to 1 to ease the load on the server. */
//if(location.href.indexOf("/wiki/")!=-1)
wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+
'wldir=older&format=xml&wlprop=comment|timestamp|title', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// [[Category:Wikipedia scripts]]



// <nowiki>If you are editing a page, click the wikify button on your tab bar to add "{{Wikify|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked for wikification" as the edit summary, mark it as a minor edit, and submit.</nowiki>

function doQwikify() {
document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Marked for wikification';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}

$(function() {
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
// wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?
return;
}
if (document.editform) {
mw.util.addPortletLink("p-cactions", "javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
}
});

// by [[User:Raylu|raylu]]

// CleanupTab.js
//
// This script adds a "cleanup" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doCleanup() {
document.editform.wpTextbox1.value = '{' + '{' + 'Cleanup|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Marked for cleanup.';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}

$(function() {
if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
return;
}
if (document.editform) {
mw.util.addPortletLink("p-cactions", "javascript:doCleanup()", "cleanup", "ca-cleanup", "Mark for cleanup", "");
}
});

// 
//



//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510
function addSinceTab() {
if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
do_since_I_last_edited()
}
else if (wgCanonicalNamespace != "Special") {
mw.util.addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true", 'since', '', "since");
}
}
function do_since_I_last_edited() {
var csub=document.getElementById("contentSub");
var msg=document.createElement("p");
msg.appendChild(document.createTextNode
("Parsing history... please wait..."));
msg.className="error";
csub.insertBefore(msg, csub.firstChild)

var username=document.getElementById("pt-userpage").textContent;
var hists=document.getElementById("pagehistory").getElementsByTagName('li');
for (n=0;n<hists.length;n++) {
if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) {
document.location=hists[n].childNodes[1].href; 
return;
}
}

msg.replaceChild(document.createTextNode
("You have not edited this page! (recently)"),
msg.firstChild);
}

$(addSinceTab);

if (wgNamespaceNumber >= 0)
$(function(){
var pCactions = document.getElementById('p-cactions');
if (!pCactions) return;
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = document.getElementById('ca-talk');
var caEdit = document.getElementById('ca-edit');
if (!caEdit) caEdit = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
if (!caMain || !caTalk || !caEdit || !caHistory) return;
var el_move, el_create, id2;
if (wgNamespaceNumber % 2) { //talk space
el_move = caTalk; el_create = caMain; id2 = '';
} else {
el_move = caMain; el_create = caTalk; id2 = 'discussion';
}
caEdit.firstChild.innerHTML = 'edit';
caHistory.firstChild.innerHTML = 'hist';
el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
var href = el_create.firstChild.getAttribute('href', 2);
if (el_create.className.indexOf('new') < 0){
mw.util.addPortletLink('p-cactions', href + '?action=history', 'hist',
'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',
'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
} 
caMain.style.marginRight = '0.3em'; 
caTalk.style.marginRight = '0.3em'; 
caTalk.style.marginLeft  = '1.6em'; 
})
// 

//



importScript('User:AzaToth/twinkle.js');



if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') 
$(function () {
var frm = document.getElementsByTagName('form')[0];
frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
var lnk = document.createElement('a');
lnk.appendChild(document.createTextNode('Unwatch…'));
lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
frm.parentNode.insertBefore(lnk, frm);
})




// [[User:Outriggr/metadatatest.js]] 
importScript('User:Outriggr/metadatatest.js'); 
assessmentMyTemplateCode = ["{{WPMILHIST|class=}}"];
assessmentDefaultProject = "WPMILHIST";
assessmentOverrideWatchPref = true;
//