מדיה ויקי:Gadget-editIntro.js

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

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
//
// מועתק במקור מ[[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&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 = "/* עריכת ההקדמה */ ";
}
$(addEditSection0);