אונטערשייד צווישן ווערסיעס פון "באַניצער:תנא קמא/tanachLinks.js"

קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
שורה 3: שורה 3:
         // Define favicon URLs
         // Define favicon URLs
         var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';
         var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';
        var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico';
        // Define the mapping between Sefaria and AlHaTorah book names
        const bookNameMapping = {
            'Genesis': 'Bereshit',
            'Exodus': 'Shemot',
            'Leviticus': 'Vayikra',
            'Numbers': 'Bemidbar',
            'Deuteronomy': 'Devarim',
            'Joshua': 'Yehoshua',
            'Judges': 'Shofetim',
            'Samuel I': 'Shemuel I',
            'Samuel II': 'Shemuel II',
            'Kings I': 'Melakhim I',
            'Kings II': 'Melakhim II',
            'Isaiah': 'Yeshayahu',
            'Jeremiah': 'Yirmeyahu',
            'Ezekiel': 'Yechezkel',
            'Hosea': 'Hoshea',
            'Joel': 'Yoel',
            'Amos': 'Amos',
            'Obadiah': 'Ovadyah',
            'Jonah': 'Yonah',
            'Micah': 'Mikhah',
            'Nahum': 'Nachum',
            'Habakkuk': 'Chavakkuk',
            'Zephaniah': 'Zephanyah',
            'Haggai': 'Chaggai',
            'Zechariah': 'Zekharyah',
            'Malachi': 'Malakhi',
            'Psalms': 'Tehillim',
            'Proverbs': 'Mishlei',
            'Job': 'Iyyov',
            'Song of Songs': 'Shir HaShirim',
            'Ruth': 'Rut',
            'Lamentations': 'Eikhah',
            'Ecclesiastes': 'Kohelet',
            'Esther': 'Esther',
            'Daniel': 'Daniel',
            'Ezra': 'Ezra',
            'Nehemiah': 'Nechemyah',
            'Chronicles I': 'Divrei HaYamim I',
            'Chronicles II': 'Divrei HaYamim II'
        };


         // Iterate over each Tanakh citation link
         // Iterate over each Tanakh citation link
שורה 10: שורה 54:
             var perek = $link.data('perek');
             var perek = $link.data('perek');
             var pasuk = $link.data('pasuk');
             var pasuk = $link.data('pasuk');
            // Ensure the necessary data exists
            if (!sefer || !perek || !pasuk) return;


             // Construct Sefaria URL
             // Construct Sefaria URL
             var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefer) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);
             var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefer) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);


             // Create the Sefaria icon link
             // Create and append the Sefaria icon
             var sefariaIcon = $('<a>')
             var sefariaIcon = $('<a>')
                 .attr('href', sefariaUrl)
                 .attr('href', sefariaUrl)
שורה 20: שורה 67:
                 .attr('title', 'עפן אין ספריא')
                 .attr('title', 'עפן אין ספריא')
                 .html('<img src="' + sefariaFavicon + '" alt="Sefaria" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
                 .html('<img src="' + sefariaFavicon + '" alt="Sefaria" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
            // Append the Sefaria icon next to the link
             $link.after(sefariaIcon);
             $link.after(sefariaIcon);
        });
    });
});
mw.loader.using(['mediawiki.util', 'jquery'], function () {
    $(document).ready(function () {
        // Define the mapping between Sefaria and AlHaTorah book names
        const bookNameMapping = {
    'Genesis': 'Bereshit',
    'Exodus': 'Shemot',
    'Leviticus': 'Vayikra',
    'Numbers': 'Bemidbar',
    'Deuteronomy': 'Devarim',
    'Joshua': 'Yehoshua',
    'Judges': 'Shofetim',
    'Samuel I': 'Shemuel I',
    'Samuel II': 'Shemuel II',
    'Kings I': 'Melakhim I',
    'Kings II': 'Melakhim II',
    'Isaiah': 'Yeshayahu',
    'Jeremiah': 'Yirmeyahu',
    'Ezekiel': 'Yechezkel',
    'Hosea': 'Hoshea',
    'Joel': 'Yoel',
    'Amos': 'Amos',
    'Obadiah': 'Ovadyah',
    'Jonah': 'Yonah',
    'Micah': 'Mikhah',
    'Nahum': 'Nachum',
    'Habakkuk': 'Chavakkuk',
    'Zephaniah': 'Zephanyah',
    'Haggai': 'Chaggai',
    'Zechariah': 'Zekharyah',
    'Malachi': 'Malakhi',
    'Psalms': 'Tehillim',
    'Proverbs': 'Mishlei',
    'Job': 'Iyyov',
    'Song of Songs': 'Shir HaShirim',
    'Ruth': 'Rut',
    'Lamentations': 'Eikhah',
    'Ecclesiastes': 'Kohelet',
    'Esther': 'Esther',
    'Daniel': 'Daniel',
    'Ezra': 'Ezra',
    'Nehemiah': 'Nechemyah',
    'Chronicles I': 'Divrei HaYamim I',
    'Chronicles II': 'Divrei HaYamim II'
        };
        // Iterate over each Tanakh citation link
        $('.tanach-citation').each(function () {
            var $link = $(this);
            var sefer = $link.data('sefer');
            var perek = $link.data('perek');
            var pasuk = $link.data('pasuk');


             // Map Sefaria book name to AlHaTorah's naming convention
             // Map Sefaria book name to AlHaTorah's naming convention
שורה 87: שורה 77:
                     '.' + encodeURIComponent(pasuk);
                     '.' + encodeURIComponent(pasuk);


                 // Create the AlHaTorah icon link
                 // Create and append the AlHaTorah icon
                 var alHaTorahIcon = $('<a>')
                 var alHaTorahIcon = $('<a>')
                     .attr('href', alHaTorahUrl)
                     .attr('href', alHaTorahUrl)
                     .attr('target', '_blank')
                     .attr('target', '_blank')
                     .attr('title', 'View on AlHaTorah')
                     .attr('title', 'עפן אין על התורה')
                     .html('<img src="https://mg.alhatorah.org/favicon.ico" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
                     .html('<img src="' + alHaTorahFavicon + '" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
 
                // Append the icon next to the link
                 $link.after(alHaTorahIcon);
                 $link.after(alHaTorahIcon);
             }
             }