באַניצער:תנא קמא/tanachLinks.js
אַכטונג: נאכן היטן, ברויכט איר אפשר נאך אויסקרויזן דעם בראוזער'ס זאַפאַס צו זען די ענדערונגען.
- פייערפוקס/סאפארי: האלט אראפ שיפט בשעת'ן דרוקן Reload, אדער דרוקט Ctrl-F5 אדער Ctrl-R (אויף א מאקינטאש ⌘-R)
- גוגל כראם: דרוקט Ctrl-Shift-R (אויף א מאקינטאש ⌘-Shift-R)
- אינטערנעט עקספלארער: האלט אראפ Ctrl בשעת'ן קליקן Refresh, אדער דרוקט Ctrl-F5
- אפערע: גייט צו מעניו → שטעלונגען ( אפערע → פרעפערנצן אויף א מעק) און דערנאך צו פריוואטקייט & און זיכערהייט → רוימען בראוזער דאטא → בילדער און טעקעס אין זאפאס
mw.loader.using(['mediawiki.util', 'jquery'], function () {
$(document).ready(function () {
// Define favicon URLs
var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';
var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico';
var wikisourceFavicon = 'https://he.wikisource.org/favicon.ico';
// Define the mapping between Sefaria and AlHaTorah book names
const bookNameMapping = {
'Genesis': 'בראשית',
'Exodus': 'שמות',
'Leviticus': 'ויקרא',
'Numbers': 'במדבר',
'Deuteronomy': 'דברים',
'Joshua': 'יהושע',
'Judges': 'שופטים',
'Samuel I': 'שמואל א',
'Samuel II': 'שמואל ב',
'Kings I': 'מלכים א',
'Kings II': 'מלכים ב',
'Isaiah': 'ישעיהו',
'Jeremiah': 'ירמיהו',
'Ezekiel': 'יחזקאל',
'Hosea': 'הושע',
'Joel': 'יואל',
'Amos': 'עמוס',
'Obadiah': 'עובדיה',
'Jonah': 'יונה',
'Micah': 'מיכה',
'Nahum': 'נחום',
'Habakkuk': 'חבקוק',
'Zephaniah': 'צפניה',
'Haggai': 'חגי',
'Zechariah': 'זכריה',
'Malachi': 'מלאכי',
'Psalms': 'תהילים',
'Proverbs': 'משלי',
'Job': 'איוב',
'Song of Songs': 'שיר השירים',
'Ruth': 'רות',
'Lamentations': 'איכה',
'Ecclesiastes': 'קהלת',
'Esther': 'אסתר',
'Daniel': 'דניאל',
'Ezra': 'עזרא',
'Nehemiah': 'נחמיה',
'Chronicles I': 'דברי הימים א',
'Chronicles 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');
// Ensure the necessary data exists
if (!sefer || !perek || !pasuk) return;
// Construct Sefaria URL
var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefer) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);
// Create and append the Sefaria icon
var sefariaIcon = $('<a>')
.attr('href', sefariaUrl)
.attr('target', '_blank')
.attr('title', 'View on Sefaria')
.html('<img src="' + sefariaFavicon + '" alt="Sefaria" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
$link.after(sefariaIcon);
// Map Sefaria book name to AlHaTorah's naming convention
var alHaTorahSefer = bookNameMapping[sefer];
if (alHaTorahSefer) {
// Construct AlHaTorah URL
var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(alHaTorahSefer) +
'/' + encodeURIComponent(perek) +
'.' + encodeURIComponent(pasuk);
// Create and append the AlHaTorah icon
var alHaTorahIcon = $('<a>')
.attr('href', alHaTorahUrl)
.attr('target', '_blank')
.attr('title', 'View on AlHaTorah')
.html('<img src="' + alHaTorahFavicon + '" alt="AlHaTorah" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
$link.after(alHaTorahIcon);
}
// Map Sefaria book name to Wikisource's naming convention
var wikisourceSefer = bookNameMapping[sefer];
if (wikisourceSefer) {
// Construct Wikisource URL
var wikisourceUrl = 'https://he.wikisource.org/wiki/' + encodeURIComponent(wikisourceSefer) +
'_' + encodeURIComponent(perek) +
':' + encodeURIComponent(pasuk);
// Create and append the Wikisource icon
var wikisourceIcon = $('<a>')
.attr('href', wikisourceUrl)
.attr('target', '_blank')
.attr('title', 'View on Wikisource')
.html('<img src="' + wikisourceFavicon + '" alt="Wikisource" style="width:12px; height:12px; vertical-align:middle; margin-left: 3px;">');
$link.after(wikisourceIcon);
}
});
});
});