User:Emil76~enwiki/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:Emil76~enwiki/monobook.css. |
// testing
var newline = document.createElement('div');
var newlink = document.createElement('a');
newlink.setAttribute('href','http://www.google.com/');
newlink.setAttribute('title','up yours');
newlink.setAttribute('class','sidebar-link');
newlink.setAttribute('style','color:gray !important;'); // temporary hack, move to CSS later
newlink.appendChild(document.createTextNode('test'));
newline.appendChild(newlink);
document.getElementById('f-list').appendChild(newline);
// alternative main page
var mpTitle = "Main Page";
var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle)
if (isMainPage)
{window.location="http://en.wikipedia.org/wiki/Wikipedia:Main_Page_alternative_%28Custom%29";}
// [[en:User:Lupin/popups.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://nl.wikipedia.org/w/index.php?title=Gebruiker:Henna/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
popupRevertSummary='Reverted changes to version %s using [[:en:Wikipedia:Tools/Navigation_popups|Popups]]';
var qPreviewKey = '`';
var qPreviewName = 'QPreview';
function qPreviewButton(){
addToolbarButton(qPreviewName, qPreview, 'btnQPreview', 'Quick Preview', qPreviewKey);
}
addOnloadHook(qPreviewButton);
function qPreview(){
var divPreview = document.getElementById('wikiPreview');
if (!divPreview) return;
var btnQPreview = document.getElementById('btnQPreview');
if (btnQPreview) btnQPreview.value = 'Wait...';
a = sajax_init_object();
a.open('POST', document.editform.action+'&live', true);
var Boundary = '--------p1415';
a.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+Boundary);
var PostData = '--' + Boundary
+ '\nContent-Disposition: form-data; name="wpTextbox1"\n\n'
+ document.getElementById('wpTextbox1').value + '\n--'+Boundary;
if (a.overrideMimeType) a.overrideMimeType('text/html');
a.send(PostData);
a.onreadystatechange = function(){
if (a.readyState != 4) return;
var html = a.responseText;
html = html.replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"').replace(/&/g,'&').replace(/'/g,"'");
divPreview.innerHTML = html;
if (btnQPreview) btnQPreview.value = qPreviewName;
};
}
//Adds a text button to edit toolbar
function addToolbarButton(name, onclick, id, tooltip, accesskey){
var toolbar = document.getElementById('toolbar');
if (!toolbar) return;
var newBtn = document.createElement('input');
newBtn.type = 'button';
newBtn.style.background = '#adbede';
newBtn.style.height = '22px';
newBtn.style.verticalAlign = 'middle';
if (name) newBtn.value = name;
if (onclick) newBtn.onclick = onclick;
if (id) newBtn.id = id;
if (tooltip) newBtn.title = tooltip;
if (accesskey) newBtn.accessKey = accesskey;
toolbar.appendChild(newBtn);
return newBtn;
}