מדיה ויקי:Nosaving.js

מתוך ויקימסע

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

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
/* לא מאפשר לאנונימיים לשמור את הדף לפני לחיצה על תצוגה מקדימה */
function noSaving() {
    if( mw.config.get('wgUserName') == null && mw.config.get('wgAction') == "edit" && mw.config.get('wgNamespaceNumber') != 1 ) {
        saveButton = document.getElementById( "wpSave" );
        if( saveButton != null ) {
            saveButton.disabled = true;
            if( document.getElementById( "wpPreview" ) != null ) {
                document.getElementById( "wpPreview" ).value = "תצוגה מקדימה (חובה)";
            }
            if( document.getElementById( "wpSummary" ) != null ) {
                // אפשרות שמירה בהקשת Enter בתקציר העריכה
                addHandler( document.getElementById( "wpSummary" ), "keypress", saveOnEnter );
            }
        }
    }
}

function saveOnEnter(e) {
    e = (e) ? e : event;
    if( e.keyCode == 13 ) {
        document.getElementById( "wpPreview" ).name = "wpSave";
        document.getElementById( "wpPreview" ).click();
        document.getElementById( "wpPreview" ).name = "wpPreview";
    }
}

$(noSaving);