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

פון המכלול
קפיצה לניווט קפיצה לחיפוש
אין תקציר עריכה
אין תקציר עריכה
שורה 23: שורה 23:
             // Append the Sefaria icon next to the link
             // 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': 'Shoftim',
            'Samuel': 'Shmuel',
            'Kings': 'Melakhim',
            'Isaiah': 'Yeshayahu',
            'Jeremiah': 'Yirmiyahu',
            'Ezekiel': 'Yehezkel',
            'Hosea': 'Hoshea',
            'Joel': 'Yoel',
            'Amos': 'Amos',
            'Obadiah': 'Ovadiah',
            'Jonah': 'Yonah',
            'Micah': 'Mikhah',
            'Nahum': 'Nahum',
            'Habakkuk': 'Habakuk',
            'Zephaniah': 'Tzefanyah',
            'Haggai': 'Chaggai',
            'Zechariah': 'Zekharyah',
            'Malachi': 'Malakhi',
            'Psalms': 'Tehillim',
            'Proverbs': 'Mishlei',
            'Job': 'Iyov',
            'Song of Songs': 'Shir HaShirim',
            'Ruth': 'Rut',
            'Lamentations': 'Eikhah',
            'Ecclesiastes': 'Kohelet',
            'Esther': 'Esther',
            'Daniel': 'Daniel',
            'Ezra': 'Ezra',
            'Nehemiah': 'Nechemyah',
            'Chronicles': 'Divrei Hayamim'
        };
        // 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
            var alHaTorahSefer = bookNameMapping[sefer];
            if (alHaTorahSefer) {
                // Construct AlHaTorah URL
                var alHaTorahUrl = 'https://mg.alhatorah.org/?v=1&book=' + encodeURIComponent(alHaTorahSefer) +
                    '&chapter=' + encodeURIComponent(perek) +
                    '&verse=' + encodeURIComponent(pasuk);
                // Create the AlHaTorah icon link
                var alHaTorahIcon = $('<a>')
                    .attr('href', alHaTorahUrl)
                    .attr('target', '_blank')
                    .attr('title', 'View on AlHaTorah')
                    .html('<img src="https://mg.alhatorah.org/favicon.ico" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
                // Append the icon next to the link
                $link.after(alHaTorahIcon);
            }
         });
         });
     });
     });
});
});

רעוויזיע פון 01:04, 4 אפריל 2025

mw.loader.using(['mediawiki.util', 'jquery'], function () {
    $(document).ready(function () {
        // Define favicon URLs
        var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';

        // 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');

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

            // Create the Sefaria icon link
            var sefariaIcon = $('<a>')
                .attr('href', sefariaUrl)
                .attr('target', '_blank')
                .attr('title', 'עפן אין ספריא')
                .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);
        });
    });
});

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': 'Shoftim',
            'Samuel': 'Shmuel',
            'Kings': 'Melakhim',
            'Isaiah': 'Yeshayahu',
            'Jeremiah': 'Yirmiyahu',
            'Ezekiel': 'Yehezkel',
            'Hosea': 'Hoshea',
            'Joel': 'Yoel',
            'Amos': 'Amos',
            'Obadiah': 'Ovadiah',
            'Jonah': 'Yonah',
            'Micah': 'Mikhah',
            'Nahum': 'Nahum',
            'Habakkuk': 'Habakuk',
            'Zephaniah': 'Tzefanyah',
            'Haggai': 'Chaggai',
            'Zechariah': 'Zekharyah',
            'Malachi': 'Malakhi',
            'Psalms': 'Tehillim',
            'Proverbs': 'Mishlei',
            'Job': 'Iyov',
            'Song of Songs': 'Shir HaShirim',
            'Ruth': 'Rut',
            'Lamentations': 'Eikhah',
            'Ecclesiastes': 'Kohelet',
            'Esther': 'Esther',
            'Daniel': 'Daniel',
            'Ezra': 'Ezra',
            'Nehemiah': 'Nechemyah',
            'Chronicles': 'Divrei Hayamim'
        };

        // 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
            var alHaTorahSefer = bookNameMapping[sefer];
            if (alHaTorahSefer) {
                // Construct AlHaTorah URL
                var alHaTorahUrl = 'https://mg.alhatorah.org/?v=1&book=' + encodeURIComponent(alHaTorahSefer) +
                    '&chapter=' + encodeURIComponent(perek) +
                    '&verse=' + encodeURIComponent(pasuk);

                // Create the AlHaTorah icon link
                var alHaTorahIcon = $('<a>')
                    .attr('href', alHaTorahUrl)
                    .attr('target', '_blank')
                    .attr('title', 'View on AlHaTorah')
                    .html('<img src="https://mg.alhatorah.org/favicon.ico" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');

                // Append the icon next to the link
                $link.after(alHaTorahIcon);
            }
        });
    });
});