User:Jwestbrook/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. |
The accompanying .css page for this skin is at User:Jwestbrook/monobook.css. |
// [[User:Lupin/popups.js]] - please include this line
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
popupDelay=1;
popupActionsMenu=false;
popupImages=true;
imagePopupsForImages=false;
popupFixDabs=true;
popupLastModified=false;
popupRevertSummary="Reverted Edits Back to Revision %s";
//add google link
// This script adds "Google search" and "Yahoo search" links to the toolbox. Requires [[Wikipedia:WikiProject User scripts/Scripts/addLink]].
function addGoogleLink () {
var title;
if (!(title = document.getElementById('t-whatlinkshere') )) return;
if (!(title = title.getElementsByTagName('a')[0] )) return;
if (!(title = title.href )) return;
if (!(title = title.replace(/^.*Special:Whatlinkshere&target=/, '') )) return;
if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return;
if (!(title = title.replace(/("|%22)/g, '') )) return;
if (!(title = title.replace(/_/g, '%20') )) return;
addLink('p-cactions', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8',
'Google search', 't-googlesearch', 'Search Google for "'+decodeURIComponent(title)+'"', 'G', null);
}
function addDLLink () {
var title;
if (!(title = document.getElementById('t-whatlinkshere') )) return;
if (!(title = title.getElementsByTagName('a')[0] )) return;
if (!(title = title.href )) return;
if (!(title = title.replace(/^.*Special:Whatlinkshere&target=/, '') )) return;
if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return;
if (!(title = title.replace(/("|%22)/g, '') )) return;
if (!(title = title.replace(/_/g, '%20') )) return;
addLink('p-cactions', 'http://en.wikipedia.org/wiki/Special:Log/Delete?page='+title,
'WP:DL Lookup', 't-dllookup', 'Lookup "'+decodeURIComponent(title)+'" in WP:DL', 'D', null);
}
setTimeout("addGoogleLink()", 500) // this is equivalent of onload
setTimeout("addDLLink()", 501) // this is equivalent of onload
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Jwestbrook/tmpltmenu.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
if(document.location.href.match(/Special:Newpages/))
{
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Jwestbrook/dynnewpages.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
/*Better History
document.write('<script src="http://gladstone.uoregon.edu/~chill1/betterhistory/betterhistory.js"><\/script>');
End*/
//Auto AFD
//Auto AFD script
//Please include the two following lines
//Modified version of AutoVFD script to work with AFD
//Script Modified by User:Jtkiefer
// This needs to change depending on skin used.
function add_link(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
tabs.appendChild(li);
}
function strip_namespace(target)
{
var colon = target.indexOf(':');
if (colon != -1)
{
var spaces = new Array('User', 'Wikipedia', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
var ns = target.substring(0, colon);
if (ns == '' || ns == 'Talk')
return target.substring(colon + 1);
else
for (var i = 0; i < spaces.length; ++i)
{
if (ns == spaces[i]
|| ns == spaces[i] + '_talk')
return target.substring(colon + 1);
}
}
return target;
}
//Force Edit Summary
function addForceSummary()
{
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
}
function forceSummary()
{
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
{
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
addOnloadHook(addForceSummary);
//End Force Edit Summary
//add link
function addLink(where, url, name, id, title, key, after){
//* where is the id of the toolbar where the button should be added;
// i.e. one of "p-cactions", "p-personal", or "p-navigation".
//* url is the URL which will be called when the button is clicked.
// javascript: urls can be used to do more complex things.
//* name is what will appear as the name of the button.
//* id is the id of the button; it's best to define one.
// Use a prefix to make sure its unique. Optional.
//* title is the tooltip title that gives a longer description
// of the button; if you define a accesskey, mention it here. Optional.
//* key is the char you want for the accesskey. Optional.
//* after is the id of the button you want to follow this one. Optional.
var na = document.createElement('a');
na.href = url;
na.target = "_new";
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}