מדיה ויקי:Gadget-editIntro.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
ויקיציטוט>Krenair |
(אין הבדלים)
|
גרסה מ־05:26, 26 באוקטובר 2016
//
// מועתק במקור מ[[w:ויקיפדיה:סקריפטים/12]]
// הסקריפט מוסיף אפשרות לערוך את ההקדמה של הערך
//
function addEditSection0() {
x = document.getElementById('ca-edit');
if (!x) return;
ta['ca-edit-0'] = ['', 'ערוך את ההקדמה'];
y = document.createElement('LI');
y.id = 'ca-edit-0';
// if is edit page and is section 0, then mark "0" as seleted and mark "עריכה" as unseleted
var isSelected = (x.className.indexOf('selected') != -1);
var isTalk = (x.className.indexOf('istalk') != -1);
var isSection0 = (/&action=edit§ion=0$/.test(window.location.href));
//alert(isSelected + " " + isTalk + " " + isSection0);
if (isSelected) {
if (isSection0) {
y.className = x.className;
x.className = (isTalk) ? 'istalk' : '';
} else {
if (isTalk) y.className = 'istalk';
}
}
// add the "0" li element
var z = document.createElement('A');
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
x.parentNode.insertBefore(y,x.nextSibling);
// add summary if editing section 0
if ( isSection0 )
document.getElementById("wpSummary").value = "/* עריכת ההקדמה */ ";
}
$(addEditSection0);