ميدياويكى:Common.js/edit.js
ملحوظه: بعد التسييف، ممكن تحتاج تفضى كاش البراوزر بتاعك عشان تشوف التغييرات اللى عملتها، بالطريقه دى:
- فايرفوكس وسفارى: دوس ⇧ Shift مع Reload او Ctrl-F5 او Ctrl-R (اللى هو: Command-R على ماكنتوش)
- جوجل كروم: دوس Ctrl-Shift-R (اللى هو: Command-Shift-R على ماكنتوش)
- انترنت اكسبلورر: دوس Ctrl مع Refresh فى نفس الوقت، او Ctrl-F5
- كونكرر: دوس Reload او F5
- اوبرا: فضى الكاش من Tools → Preferences
/* select subsection of special characters */
function chooseCharSubset(s) {
var l = document.getElementById('editpage-specialchars').getElementsByTagName('p');
for (var i = 0 ; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
/**
* تزويد شوية زراير
*/
if (mw.Ttolbar) {
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png",
"speedTip": "مسح",
"tagOpen": "<s>",
"tagClose": "</s>",
"sampleText": ""
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png",
"speedTip": "تنمير",
"tagOpen": "",
"tagClose": "",
"sampleText": "\n# بند 1\n# بند 2\n# بند 3"
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png",
"speedTip": "ليسته",
"tagOpen": "",
"tagClose": "",
"sampleText": "\n* بند ا\n* بند ب\n* بند ج"
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/f/fd/Button_blockquote.png",
"speedTip": "اقتباس",
"tagOpen": "<blockquote>\n",
"tagClose": "\n</blockquote>",
"sampleText": "الكلام بتاع الاقتباس"
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png",
"speedTip": "تعليق",
"tagOpen": "<!--",
"tagClose": "-->",
"sampleText": ""
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/a/ac/Button_redir_rtl.png",
"speedTip": "تحويله",
"tagOpen": "#تحويل [[",
"tagClose": "]]",
"sampleText": "المكان المقصود"
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png",
"speedTip": "قالب",
"tagOpen": "{{",
"tagClose": "}}",
"sampleText": ""
});
mw.toolbar.addButton({
"imageFile": "//upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png",
"speedTip": "تصنيف",
"tagOpen": "[[تصنيف:",
"tagClose": "]]",
"sampleText": ""
});
}
/* كود تزويد زرار عمل الجدول */
/* فتح شباك جدول */
function generateTableau(nbCol, nbRow, border, styleHeader, styleLine) {
var code = "\n";
if (styleHeader == 1) {
code += '{| class=\"wikitable\" border=\"' + border + '\"\n';
} else {
code += '{| border=\"' + border + '\"\n';
code += '|+ اسم\n';
}
for (var i = 0 ; i < nbCol ; i++) code += '! عمود ' + i + '\n'
for (var j = 0 ; j < nbRow ; j++) {
if ((j+1)%2 == 0 && styleLine == 1) {
code += '|- bgcolor=\"#EFEFEF\"\n'
} else {
code += '|-\n'
}
for (var i = 0 ; i < nbCol ; i++) code += '| سطر\n';
}
code += '|}';
insertTags('','', code);
}
function popupTableau() {
var popup = window.open('','name','height=200,width=250');
javaCode = '<script type=\"text\/javascript\">function insertCode(){';
javaCode += 'var row = parseInt(document.paramForm.inputRow.value); '
javaCode += 'var col = parseInt(document.paramForm.inputCol.value); '
javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); '
javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; '
javaCode += 'var styleLine = document.paramForm.inputLine.checked; '
javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); '
javaCode += '}<\/script>';
popup.document.write('<html><head><title>عمل جدول</title>');
popup.document.write(javaCode);
popup.document.write('</head><body>');
popup.document.write('<p> عمل جدول: </p>');
popup.document.write('<form name=\"paramForm\">');
popup.document.write('عدد الصفوف: <input type=\"text\" name=\"inputRow\" maxlength=\"3\" value=\"3\" style=\"width:50px;\"><p>');
popup.document.write('عدد العواميد: <input type=\"text\" name=\"inputCol\" maxlength=\"3\" value=\"3\" style=\"width:50px;\"><p>');
popup.document.write('الحدود: <input type=\"text\" name=\"inputBorder\" maxlength=\"2\" value=\"1\" style=\"width:50px;\"><p>');
popup.document.write('اسامى العواميد: <input type=\"checkbox\" name=\"inputHeader\" checked=\"1\" ><p>');
popup.document.write('اسامى السطور: <input type=\"checkbox\" name=\"inputLine\" checked=\"1\" ><p>');
popup.document.write('</form">');
popup.document.write('<p><a href=\"javascript:insertCode();self.close();\">اعمل</a></p>');
popup.document.write('<p><a href=\"javascript:self.close()\">اقفل</a></p>');
popup.document.write('</body></html>');
popup.document.close();
}
/* كود زرار الجدول */
function tableButton() {
tooly = document.getElementById('toolbar');
if (tooly != null) {
/* صورة الزرار وحجمه */
var tableButton=document.createElement("img");
tableButton.width = 23;
tableButton.height = 22;
tableButton.src = "//upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png";
tableButton.border = 0;
tableButton.alt = "جدول";
tableButton.title = "عمل جدول";
tableButton.style.cursor = "pointer";
tableButton.onclick = popupTableau;
tooly.appendChild(tableButton);
}
}
/* تبيين الزرار */
$(document).ready(tableButton);
//jQuery( document ).ready(addCharSubsetMenu);