User:Emil76~commonswiki/monobook.js

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
var UploadForm_forcebasic = true; //Oude vertrouwde uploadwizard

// Nederlandstalige hoofdpagina als standaard

var mpTitle = "Main Page";
var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle)
if (isMainPage) 
{window.location="http://commons.wikimedia.org/w/index.php?title=Hoofdpagina&uselang=nl";}

// [[en:User:Lupin/popups.js]] - please include this line 

mw.loader.load('https://nl.wikipedia.org/w/index.php?title=Gebruiker:Henna/popups.js' 
             + '&action=raw&ctype=text/javascript');

popupRevertSummary='Wijzigingen m.b.v. [[:en:Wikipedia:Tools/Navigation_popups|Popups]] hersteld tot versie %s';

var qPreviewKey = '`';
var qPreviewName = 'QPreview';

function qPreviewButton(){ 
	addToolbarButton(qPreviewName, qPreview, 'btnQPreview', 'Quick Preview', qPreviewKey);
}
$(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(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&').replace(/&apos;/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;
}