User:Gangleri/monobook.js

From Wikipedia

يادونه: د غوره توبونو د خوندي کولو وروسته، ددې لپاره چې تاسو خپل سر ته رسولي ونجونه وګورۍ نو پکار ده چې د خپل بروزر ساتل شوې حافظه تازه کړی. د Mozilla / Firefox / Safari: لپاره د Shift تڼۍ نيولې وساتی کله مو چې په Reload، ټک واهه، او يا هم Ctrl-Shift-R تڼۍ کېښکاږۍ (په Apple Mac کمپيوټر باندې Cmd-Shift-R کېښکاږۍ); IE: د Ctrl تڼۍ کېښکاږۍ کله مو چې په Refresh ټک واهه، او يا هم د Ctrl-F5 تڼۍ کېښکاږۍ; Konqueror: بروزر کې يواځې Reload ته ټک ورکړۍ، او يا په F5; د Opera کارونکو ته پکار ده چې په بشپړه توګه د خپل کمپيوټر ساتل شوې حافظه تازه کړي چې پدې توګه کېږي Tools→Preferences.

function bidiSwitchSetup() {
	var editform = document.getElementById("wpTextbox1");
	if (editform == null) {
		return;
	}
 
	bidiAddButton(editform, "Default", function(style) {
		style.direction = "inherit";
		style.unicodeBidi = "inherit";
	});
	bidiAddButton(editform, "dir=ltr", function(style) {
		style.direction = "ltr";
	});
	bidiAddButton(editform, "dir=rtl", function(style) {
		style.direction = "rtl";
	});
	bidiAddButton(editform, "bidi=normal", function(style) {
		style.unicodeBidi = "normal";
	});
	bidiAddButton(editform, "bidi=override", function(style) {
		style.unicodeBidi = "bidi-override";
	});
}
 
function bidiAddButton(before, label, action) {
	var button = document.createElement("input");
	button.type = "button";
	button.value = label;
	button.onclick = function(event) {
		var box = document.getElementById("wpTextbox1");
		if (box == null) {
			alert("Broken! Edit box missing.");
		} else {
			//var style = document.getOverrideStyle(box, null);
			var style = box.style;
			action(style);
		}
	}
	before.parentNode.insertBefore(button, before);
}
 
hookEvent('load', bidiSwitchSetup);