User:Lar/monobook.js
< User:Lar
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the central discussion page, Scriptorium. The code will be executed when previewing this page under some skins, including Monobook. You can in the interim if you wish to refresh the content sooner under another skin. |
![]() | The accompanying .css page for this skin can be added at User:Lar/monobook.css. |
//<pre><nowiki>
//---------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script loading function by Quarl (http://en.wikipedia.org/wiki/User:Quarl)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// loads from en...
function winc(s) {
s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=' + s
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
// loads from commons...
/*** [[en:User:Lightdarkness]]'s include function ***/
function co_inc (file) {
var lt = String.fromCharCode(60);
var gt = String.fromCharCode(62);
document.writeln(lt+'script type="text/javascript" src="http://commons.wikimedia.org/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt);
}
function cur_date_year()
{
var months2 = new Array('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
var yearStr = date.getUTCFullYear();
var MoDayStr = months2[date.getUTCMonth()]+" "+date.getUTCDate();
var t = MoDayStr+", "+yearStr;
return t;
}
// for image upload page to automate the image information template insertion
function imageInfo()
{
// a page edit box is called wpTextbox1
// the description box on an upload page is called wpUploadDescription
// works for edit box but not here, wrong form and field
// var txt = document.editform.wpTextbox1;
// upload is the ID but not the name... so this fails
// var txt = document.upload.wpUploadDescription;
// this works but it is brittle
// var txt=document.forms[0].wpUploadDescription;
var txt=document.getElementById('upload').wpUploadDescription;
if(txt.value.length > 0) txt.value += '\n';
txt.value += "{{Information " +'\n'
+ "|Description= " +'\n'
+ "|Source=Picture taken by [[User:Lar]]" +'\n'
+ "|Date=" + cur_date_year() +'\n'
+ "|Author= Larry Pieniazek, [[User:Lar]], [[en:User:Lar]] (primary)" +'\n'
+ "|Permission=Dual licensed under [[w:GNU_Free_Documentation_License|GFDL]] and [[w:Creative Commons|Creative Commons]] [http://creativecommons.org/licenses/by/2.5/ Attribution 2.5] (CC-BY 2.5)" +'\n'
+ "|other_versions= none but contact author for other similar images" +'\n'
+ "}}" +'\n'
+ "== Licensing ==" +'\n'
+ "{{self2|GFDL|cc-by-2.5}}" +'\n';
txt.focus();
}
// add a {{subst:unsigned2|00:49, 27 May 2006|Joe Random User}}
// at the end of the current edit contents.
// will have problems at the change in years since it depends on date.getUTCFullYear()
function addUnsigned2()
{
// sample string to paste in is "18:32, 18 June 2006 FredUser" or "00:49, 27 May 2006 Timothy Usher "
var date = new Date();
var idString = prompt("ID string?");
var f = document.editform, t = f.wpTextbox1;
// a regexp for the date part of the string would be a better way to do this...
//... but slicing on year should almost always work
var pipeLoc= idString.indexOf(date.getUTCFullYear()); // assume 4 digit year, breaks after 9999
var idStringPiped= idString.substr(0,pipeLoc+4)+'|'+idString.substr(pipeLoc+5,idString.length);
t.value += "{{subst:unsigned2|" + idStringPiped + "}}";
f.wpSummary.value = "add {{tl|Unsigned2}} using string:" + idString;
}
// **** Add generic tab ****
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.appendChild(na);
tabs.appendChild(li);
return li;
}
// there is a version of the above in en:User:Voice_of_All/Addtabs/monobook.js
function addlimenu(tabs, name, id)
{
var na = document.createElement('a');
na.href = '#';
var mn = document.createElement('ul');
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.id = id;
li.className = 'tabmenu';
li.appendChild(na);
li.appendChild(mn);
tabs.appendChild(li);
return li;
}
// UTC clock
winc('[[User:Voice_of_All/UTCclock.js]]');
//---------------------------------------------------------------
/* like submitting the URL http://en.wikipedia.org/w/index.php?title={{{PAGENAME}}}&action=purge */
function addpurge() {
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-history');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(!x) return;
if(x.children) x = x.children[0];
else x = x.childNodes[0];
addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}
//---------------------------------------------------------------
//Toolbox links
// changes top links
function changelinks() {
if(!document.getElementById) return;
document.getElementById('pt-mytalk').firstChild.innerHTML = 'my Talk';
document.getElementById('pt-preferences').firstChild.innerHTML = 'Change Prefs';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'My Watchlist';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'My Contribs';
document.getElementById('pt-logout').firstChild.innerHTML = 'Log out';
}
// adds useful links
function addtoolboxlinks() {
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
addlilink(tb, '/wiki/Special:Log/newusers', 'New users', '');
addlilink(tb, '/wiki/Special:Log', 'Log', '');
addlilink(tb, '/wiki/Special:Log/delete', 'Delete log', '');
addlilink(tb, '/wiki/Special:Log/block', 'Block log', '');
addlilink(tb, '/wiki/Special:Ipblocklist', 'IPBlocklist', '');
}
// adds various tabs and menu tabs
function add_more_tabs()
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var username=document.getElementById("pt-userpage").textContent;
if (document.title.indexOf("Upload file") != -1) {
addlimenu(tabs, 'upTags', 'upFm');
var upFm = document.getElementById('upFm').getElementsByTagName('ul')[0];
addlilink(upFm,'javascript:imageInfo()','ImageInfo');
addlilink(upFm,'javascript:addUnsigned2()','Unsigned2');
}
// Only add for pages with "Editing User talk:" somewhere in the title
if (document.title.indexOf("Editing User talk:") != -1) {
addlimenu(tabs, 'artTalk msgs', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm,'javascript:addUnsigned2()','Unsigned2');
}
if (document.title.indexOf("Editing") != 0)
{
}
}
//END
$(Mainfast)
function Mainfast()
{
// changemovetab();
changelinks();
addpurge();
addtoolboxlinks();
add_more_tabs();
}
window.onload = Main;
function Main()
{
// addtoplink();
// LivePreviewInstall();
// if(addSinceTab)
// {addSinceTab();}
}
// slow load tools
//includes
// popups
co_inc ("User:Kylu/popups.js");;
//Tool2 (localized)
co_inc ("User:Kylu/Tool2/code.js");
//editcount toolbox link (not localized, just username adjusted)
co_inc ("User:Kylu/editcount.js");
// Popups options:
simplePopups = false;
popupFixRedirs = true;
popupSubpopups = false;
popupNavLinkSeparator = ' • ';
popupRedirAutoClick = 'wpPreview';
//Beta!
popupLiveOptions=true; //Lets you change frequently-changed Popups options while in-use
popupLiveOptionsExpanded=false; //Starts with the options tab open on popover (annoying)
// I am not an admin so do not use this
popupAdminLinks=false; // optional: enable admin links [[Category:VoA scripted admins]]
popupSubpopups=false;
popupStructure='shortmenus';
popupDelay=1.0; // optional: time in s before popup happens (slowed down from default of .5s
popupEditCounterTool='interiot'; // other value is 'kate' but I prefer interiot's as it has more features
popupOnEditSelection=false; // I do not want popups for links that I select while editing.
popupFixDabs=true; // I do want to be able to fix disambigs
popupExtendedRevertSummary='Revert to version $1 by $2 using [[:en:Wikipedia:Tools/Navigation_popups|popups]]';
//
//END
//</nowiki> </pre>