ויקיציטוט:סקריפטים/12

מתוך ויקיציטוט, מאגר הציטוטים החופשי.

// // סקריפט 12: לקוח מויקיציטוט:סקריפטים/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&section=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 + '&section=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 = "/* עריכת ההקדמה */ ";

} addOnloadHook(addEditSection0); // עד כאן סקריפט 12