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

קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
שורה 58: שורה 58:
             if (!sefer || !perek || !pasuk) return;
             if (!sefer || !perek || !pasuk) return;


            // Map Hebrew book name to Sefaria's naming convention
// Lookup
            var sefariaNames = bookNameMapping[sefer];
var names = bookNameMapping[sefer];
            if (sefariaNames) {
if (names) {
            // Construct Sefaria URL
    // Sefaria URL using English name
                var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefariaNames.english) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);
    var sefariaUrl = 'https://www.sefaria.org/' +
        encodeURIComponent(names.english) + '.' +
        encodeURIComponent(perek) + '.' +
        encodeURIComponent(pasuk);


    // Add Sefaria icon
    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;">');
    $link.after(sefariaIcon);


            // Create and append the Sefaria icon
    // AlHaTorah URL using alHaTorah name
            var sefariaIcon = $('<a>')
    var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' +
                .attr('href', sefariaUrl)
        encodeURIComponent(names.alHaTorah) + '/' +
                .attr('target', '_blank')
        encodeURIComponent(perek) + '.' +
                .attr('title', 'עפן אין ספריא')
        encodeURIComponent(pasuk);
                .html('<img src="' + sefariaFavicon + '" alt="Sefaria" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
            $link.after(sefariaIcon);


            // Map Hebrew book name to AlHaTorah's naming convention
    // Add AlHaTorah icon
            var alHaTorahNames = bookNameMapping[sefer];
    var alHaTorahIcon = $('<a>')
            if (alHaTorahNames) {
        .attr('href', alHaTorahUrl)
                // Construct AlHaTorah URL
        .attr('target', '_blank')
                var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(alHaTorahNames.alHaTorah) +
        .attr('title', 'עפן אין על התורה')
                    '/' + encodeURIComponent(perek) +
        .html('<img src="' + alHaTorahFavicon + '" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
                    '.' + encodeURIComponent(pasuk);
    $link.after(alHaTorahIcon);
}


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