مندرجات کا رخ کریں

"میڈیاویکی:Gadget-prota.js" کے نسخوں کے درمیان فرق

آزاد دائرۃ المعارف، ویکیپیڈیا سے
حذف شدہ مندرجات اضافہ شدہ مندرجات
کوئی خلاصۂ ترمیم نہیں
م Obaid Raza (تبادلۂ خیال) کی ترامیم واپس محمد شعیب کی گذشتہ تدوین کی جانب۔
سطر 1: سطر 1:
function () {
/* <pre> */
var = ("wpTextbox1");
function protaSwitchSetup() {
if (edit.length === 0) { return; }
var editform = document.getElementById("wpTextbox1");
if (editform == null) {
return;
}
$('<div>').append($.map(['Monospace', 'Sans-serif', 'Jameel Noori Nastaleeq', 'Alvi Nastaleeq', 'Times New Roman', 'Tahoma'], function (font) {
protaAddButton(editform, "نستعلیق", function(style) {
return $('<button>', { text: font }).click(function (e) {
style.fontFamily = "Jameel Noori Nastaleeq";
e.preventDefault();
});
edit.css('font-family', font);
protaAddButton(editform, "علوی", function(style) {
});
style.fontFamily = "Alvi Nastaleeq";
})).insertBefore(edit.parent());
});
});
protaAddButton(editform, "Sans-serif", function(style) {
style.fontFamily = "Sans-serif";
});
protaAddButton(editform, "Monospace", function(style) {
style.fontFamily = "Monospace";
});
protaAddButton(editform, "Tahoma", function(style) {
style.fontFamily = "Tahoma";
});
protaAddButton(editform, "Times New Roman", function(style) {
style.fontFamily = "Times New Roman";
});
var space = document.createTextNode(" ");
editform.parentNode.insertBefore(space, editform);
}

function protaAddButton(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', protaSwitchSetup);
/* </pre> */

نسخہ بمطابق 19:22، 3 ستمبر 2016ء

$(function () {
	var edit = $("#wpTextbox1");
	if (edit.length === 0) { return; }
	
	$('<div>').append($.map(['Monospace', 'Sans-serif', 'Jameel Noori Nastaleeq', 'Alvi Nastaleeq', 'Times New Roman', 'Tahoma'], function (font) {
		return $('<button>', { text: font }).click(function (e) {
			e.preventDefault();
			edit.css('font-family', font);
		});
	})).insertBefore(edit.parent());
});