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

ק
הגהה
אין תקציר עריכה
ק (הגהה)
 
(18 מיטלסטע ווערסיעס פון 2 באַניצער נישט געוויזן.)
שורה 2: שורה 2:
     $(document).ready(function () {
     $(document).ready(function () {
         // Define favicon URLs
         // Define favicon URLs
         var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';
         var sefariaFavicon = 'https://www.sefaria.org/static/icons/library/favicon.svg';
         var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico';
         var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico';
        var wikiSourceFavicon = 'https://he.wikisource.org/static/favicon/wikisource.ico';


         // Helper: Convert Hebrew numeral to integer
         // Helper: Convert Hebrew numeral to integer
שורה 53: שורה 54:
             'זכריה': { english: 'Zechariah', alHaTorah: 'Zekharyah' },
             'זכריה': { english: 'Zechariah', alHaTorah: 'Zekharyah' },
             'מלאכי': { english: 'Malachi', alHaTorah: 'Malakhi' },
             'מלאכי': { english: 'Malachi', alHaTorah: 'Malakhi' },
             'תהילים': { english: 'Psalms', alHaTorah: 'Tehillim' },
             'תהלים': { english: 'Psalms', alHaTorah: 'Tehillim' },
             'משלי': { english: 'Proverbs', alHaTorah: 'Mishlei' },
             'משלי': { english: 'Proverbs', alHaTorah: 'Mishlei' },
             'איוב': { english: 'Job', alHaTorah: 'Iyyov' },
             'איוב': { english: 'Job', alHaTorah: 'Iyyov' },
שורה 73: שורה 74:
             var sefer = $link.data('sefer');
             var sefer = $link.data('sefer');
             var perekRaw = $link.data('perek');
             var perekRaw = $link.data('perek');
             var pasukRaw = $link.data('pasuk');
             var pasukRaw = $link.attr('data-pasuk');


             // Ensure the necessary data exists
             // Ensure the necessary data exists
             if (!sefer || !perekRaw || !pasukRaw) return;
             if (!sefer || !perekRaw) return;


             var sefariaNames = bookNameMapping[sefer];
             var seferNames = bookNameMapping[sefer];
             if (!sefariaNames) return;
             if (!seferNames) return;


             var perek = hebrewNumeralToInt(perekRaw);
             var perek = hebrewNumeralToInt(perekRaw);
             var pasuk = hebrewNumeralToInt(pasukRaw);
             var pasuk = (pasukRaw && pasukRaw.trim() !== '') ? hebrewNumeralToInt(pasukRaw) : null;


             // Construct Sefaria URL
             // Construct Sefaria URL
             var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefariaNames.english) + '.' + perek + '.' + pasuk;
             var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(seferNames.english) + '.' + perek;
            if (pasuk !== null) {
                sefariaUrl += '.' + pasuk;
            }
 
            // Construct AlHaTorah URL
            var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(seferNames.alHaTorah) + '/' + perek;
            if (pasuk !== null) {
                alHaTorahUrl += '.' + pasuk;
            }
 
            // Construct Wikisource URL
            var wikiSourceUrl = 'https://he.wikisource.org/wiki/' + encodeURIComponent(sefer + '_' + perekRaw);
            if (pasukRaw && pasukRaw.trim() !== '') {
                wikiSourceUrl += '_' + pasukRaw;
            }
 
            // Create container span for the icons
            var $container = $('<span class="tanach-icons" style="white-space: nowrap; margin-right: 4px;"></span>');


             // Create and append the Sefaria icon
             // Create and append the Sefaria icon
שורה 93: שורה 112:
                 .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;">');
             $link.after(sefariaIcon);
             $container.append(sefariaIcon);
 
            // Construct AlHaTorah URL
            var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(sefariaNames.alHaTorah) + '/' + perek + '.' + pasuk;


             // Create and append the AlHaTorah icon
             // Create and append the AlHaTorah icon
שורה 104: שורה 120:
                 .attr('title', 'עפן אין על התורה')
                 .attr('title', 'עפן אין על התורה')
                 .html('<img src="' + alHaTorahFavicon + '" 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;">');
             $link.after(alHaTorahIcon);
            $container.append(alHaTorahIcon);
 
            // Create and append the Wikisource icon
            var wikiSourceIcon = $('<a>')
                .attr('href', wikiSourceUrl)
                .attr('target', '_blank')
                .attr('title', 'עפן אין ויקיטקסט')
                .html('<img src="' + wikiSourceFavicon + '" alt="Wikisource" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
            $container.append(wikiSourceIcon);
 
            // Insert the container before the original link
             $link.before($container);
         });
         });
     });
     });
});
});