אונטערשייד צווישן ווערסיעס פון "באַניצער:תנא קמא/tanachLinks.js"
קפיצה לניווט
קפיצה לחיפוש
אין תקציר עריכה |
אין תקציר עריכה צייכן: צוריקגעשטעלט |
||
| שורה 4: | שורה 4: | ||
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'; | var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico'; | ||
var wikisourceFavicon = 'https://he.wikisource.org/favicon.ico'; | |||
// Define the mapping between | // Define the mapping between Sefaria and AlHaTorah book names | ||
const bookNameMapping = { | 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': 'דברי הימים ב' | |||
}; | }; | ||
| שורה 65: | שורה 66: | ||
.attr('href', sefariaUrl) | .attr('href', sefariaUrl) | ||
.attr('target', '_blank') | .attr('target', '_blank') | ||
.attr('title', ' | .attr('title', 'View on Sefaria') | ||
.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); | $link.after(sefariaIcon); | ||
// Map | // Map Sefaria book name to AlHaTorah's naming convention | ||
var | var alHaTorahSefer = bookNameMapping[sefer]; | ||
if ( | if (alHaTorahSefer) { | ||
// Construct AlHaTorah URL | // Construct AlHaTorah URL | ||
var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent( | var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(alHaTorahSefer) + | ||
'/' + encodeURIComponent(perek) + | '/' + encodeURIComponent(perek) + | ||
'.' + encodeURIComponent(pasuk); | '.' + encodeURIComponent(pasuk); | ||
| שורה 81: | שורה 82: | ||
.attr('href', alHaTorahUrl) | .attr('href', alHaTorahUrl) | ||
.attr('target', '_blank') | .attr('target', '_blank') | ||
.attr('title', ' | .attr('title', 'View on AlHaTorah') | ||
.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); | $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); | |||
} | } | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
רעוויזיע פון 02:51, 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';
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);
}
});
});
});