מעדיעװיקי:Edittoolbar.js

פֿון װיקיביבליאָטעק

אַכטונג: נאכן אויפֿהיטן, ברויכט איר אפשר נאך אַריבערגיין דעם בלעטערערס זאַפאַס צו זען די ענדערונגען.

  • פֿייערפוקס/סאפֿארי: האלט אראפ שיפֿט בשעתן דרוקן Reload, אדער דרוקט Ctrl-F5 אדער Ctrl-R (אויף א מאקינטאש ⌘-R)
  • גוגל כראם: דרוקט Ctrl-Shift-R (אויף א מאקינטאש ⌘-Shift-R)
  • אינטערנעט עקספלארער: האלט אראפ Ctrl בשעתן קליקן Refresh, אדער דרוקט Ctrl-F5
  • אפערע: גייט צו מעניו → שטעלונגען ( אפערע → פרעפערנצן אויף א מעק) און דערנאך צו פריוואטקייט & און זיכערהייט → אראפראמען בלעטערן דאטן → בילדער און טעקעס אין זאפאס
/* הרחבת שורת הלחצנים מעל לתיבת העריכה */

/* הוספת כפתור טבלה, המעלה כלי ליצירת טבלאות */
/* גרסה 0.1, נלקח מוויקיפדיה בצרפתית, נכתב במקור על־ידי Dake */
function generateTableau( nbCol, nbRow, border, styleHeader, styleLine ) {
    var code = "\n";
    if ( styleHeader ) {
        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 i = 0; i < nbRow; i++ ) {
        if( i %2 == 1 && styleLine ) {
            code += '|- style="background-color: #EFEFEF;"\n';
        } else {                
            code += "|-\n";
        }

        for( var j = 0; j < nbCol; j++ ) {
            code += "| תא\n";
        }
    }

    code += "|}";
    insertTags( "", "", code );
}

function popupTableau() {
    var popup = window.open( "", "popup", "height=240,width=250" );


    popup.document.write('<html><head><title>פרמטרים לטבלה</title>');
    popup.document.write('<script type="text/javascript">function insertCode() {');
    popup.document.write('var row = parseInt( document.paramForm.inputRow.value ); ');
    popup.document.write('var col = parseInt( document.paramForm.inputCol.value ); ');
    popup.document.write('var bord = parseInt( document.paramForm.inputBorder.value ); ');
    popup.document.write('var styleHeader = document.paramForm.inputHeader.checked; ');
    popup.document.write('var styleLine = document.paramForm.inputLine.checked; ');
    popup.document.write('window.opener.generateTableau( col, row, bord, styleHeader, styleLine ); ');
    popup.document.write('}</script>');
    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() {
    if( document.getElementById("toolbar") ) {
        var tableButton = document.createElement("img");
        tableButton.width = 23;
        tableButton.height = 22;
        tableButton.src = "//upload.wikimedia.org/wikipedia/he/6/60/Button_insert_table.png";
        tableButton.border = 0;
        tableButton.alt = "הוספת טבלה";
        tableButton.title = "הוספת טבלה";
        tableButton.style.cursor = "pointer";
        tableButton.onclick = popupTableau;
        if( document.getElementById("toolbar").lastChild.id == "templatesList" ) {
            document.getElementById("toolbar").insertBefore( tableButton, document.getElementById("templatesList") );
        } else {
            document.getElementById("toolbar").appendChild( tableButton );
        }
    }
}

// $(tableButton);