מדיה ויקי:Templateslist.js: הבדלים בין גרסאות בדף

החלפת הדף בתוכן "←‏Empty.: "
מ (גרסה אחת יובאה)
(החלפת הדף בתוכן "←‏Empty.: ")
תגית: החלפה
 
שורה 1: שורה 1:
// הוספת רשימת תבניות בסרגל הכלים.
/* Empty. */
// הועתק מוויקיפדיה, נכתב על־ידי [[משתמש:Yonidebest]] ו[[משתמש:ערן]]
// הותאם לוויקיציטוט על־ידי [[משתמש:דולב]]
 
// התצוגה של רשימת התבניות; אפשרויות:
// * "toolbar" - הרשימה מוצגת ליד סרגל הכלים (ברירת המחדל)
// * "bottom" - הרשימה מוצגת למטה
// * false - הרשימה אינה מצוגת
var templatesList = "toolbar";
 
var templates = ['בחרו תבנית כדי להוסיף', 'קטגוריה', 'פירוש נוסף', 'מפנה', 'בעבודה', 'לקריאה נוספת', 'קישורים חיצוניים', 'ראו גם', 'הודעת פוטנציאל', 'דף הפניה', 'פירושונים','הפניה להערת שוליים', 'כותרת הערת שוליים', 'הפרת זכויות יוצרים', 'הבהרת חשיבות', 'דף בבדיקה'];
 
var templatesText = new Array();
 
templatesText[1] = [];
templatesText[1][0] = "\n[" + "[קטגוריה:";
templatesText[1][1] = "שם הקטגוריה";
templatesText[1][2] = "]]";
 
templatesText[2] = [];
templatesText[2][0] = "{" + "{פירוש נוסף|";
templatesText[2][1] = "נוכחי=|אחר=|ראו=";
templatesText[2][2] = "}}";
 
templatesText[3] = [];
templatesText[3][0] = "{" + "{מפנה|";
templatesText[3][1] = "הדף המפנה|הסבר על הדף האחר|שם הדף האחר";
templatesText[3][2] = "}}";
 
templatesText[4] = [];
templatesText[4][0] = "\n";
templatesText[4][1] = "{" + "{בעבודה}}";
templatesText[4][2] = "\n";
 
templatesText[5] = [];
templatesText[5][0] = "\n== לקריאה נוספת ==\n";
templatesText[5][1] = "* שם סופר, '''שם ספר''', שם הוצאה, תאריך הוצאה.\n";
templatesText[5][2] = "";
 
templatesText[6] = [];
templatesText[6][0] = "\n== קישורים חיצוניים ==\n";
templatesText[6][1] = "* שם כותב, [" + "Address תיאור המאמר], שם האתר\n";
templatesText[6][2] = "";
 
templatesText[7] = [];
templatesText[7][0] = "\n== ראו גם ==\n";
templatesText[7][1] = "* [" + "[שם דף הציטוטים]]\n";
templatesText[7][2] = "";
 
templatesText[8] = [];
templatesText[8][0] = "";
templatesText[8][1] = "\n{" + "{פוטנציאל}}";
templatesText[8][2] = "";
 
templatesText[9] = [];
templatesText[9][0] = "#" + "הפניה [[";
templatesText[9][1] = "שם הדף המופנה";
templatesText[9][2] = "]]";
 
templatesText[10] = [];
templatesText[10][0] = "\n{" + "{פירושונים|" + "\n";
templatesText[10][1] = "* [[" + "דף ציטוטים 1]] - הסבר קצר על מהותו של דף 1\n* [[" + "דף ציטוטים 2]] - הסבר קצר על מהותו של דף 2";
templatesText[10][2] = "\n}}";
 
templatesText[11] = [];
templatesText[11][0] = "<" + 'ref name="ref-name" />';
templatesText[11][1] = "";
templatesText[11][2] = "";
 
templatesText[12] = [];
templatesText[12][0] = "\n== הערות שוליים ==";
templatesText[12][1] = "\n<" + "references />";
templatesText[12][2] = "";
 
templatesText[13] = [];
templatesText[13][0] = "\n{" + "{הפרת זכויות יוצרים|מקור=";
templatesText[13][1] = " המקור שממנו הועתק התוכן ";
templatesText[13][2] = "|זמן={" + "{ס:יום נוכחי}}/{" + "{ס:חודש נוכחי}}/{" + "{ס:שנה נוכחית}}(~~" + "~~" + "~)}}\n";
 
templatesText[14] = [];
templatesText[14][0] = "{" + "{ס:הבהרת חשיבות}}";
templatesText[14][1] = "";
templatesText[14][2] = "";
 
templatesText[15] = [];
templatesText[15][0] = "{" + "{בבדיקה";
templatesText[15][1] = "";
templatesText[15][2] = "|זמן={" + "{ס:יום נוכחי}}/{" + "{ס:חודש נוכחי}}/{" + "{ס:שנה נוכחית}}(~~" + "~~" + "~)}}";
 
function initTemplatesList() {
    if( !templatesList ) return; // user doesn't want the template list
    if( mw.config.get('wgAction') != 'edit' && mw.config.get('wgAction') != 'submit') return; // not edit page
    var toolbar = document.getElementById( "toolbar" );
    if( !toolbar && templatesList == "toolbar" ) return; // no toolbar
 
    var select = document.createElement("select");
    select.id = "templatesList";
    select.onchange = function() {
        insertTemplate( this.selectedIndex );
        this.selectedIndex = 0;
        return false;
    }
 
    for( var i = 0; i < templates.length; i++ ) {
        select = createOptionElement( select, templates[i] );
    }
 
    // add list to the end of tool
    if( templatesList == "toolbar" ) {
        // add to toolbar
        toolbar.appendChild( select );
    } else {
        // add to the bottom of the page
        addEditSelect( "תבנית", select );
    }
}
 
function insertTemplate( index ) {
    if( index > 0 ) {
        insertTags( templatesText[index][0], templatesText[index][2], templatesText[index][1] );
    }
}
 
hookEvent("load", initTemplatesList);