4,456
רעדאגירונגען
אין תקציר עריכה |
ק (הגהה) |
||
| (26 מיטלסטע ווערסיעס פון 2 באַניצער נישט געוויזן.) | |||
| שורה 2: | שורה 2: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
// Define favicon URLs | // Define favicon URLs | ||
var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon. | 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 | |||
function hebrewNumeralToInt(hebrew) { | |||
const gematria = { | |||
'א': 1, 'ב': 2, 'ג': 3, 'ד': 4, 'ה': 5, | |||
'ו': 6, 'ז': 7, 'ח': 8, 'ט': 9, | |||
'י': 10, 'כ': 20, 'ל': 30, 'מ': 40, 'נ': 50, | |||
'ס': 60, 'ע': 70, 'פ': 80, 'צ': 90, | |||
'ק': 100, 'ר': 200, 'ש': 300, 'ת': 400 | |||
}; | |||
// Remove gershayim/geresh | |||
hebrew = hebrew.replace(/["״׳']/g, ''); | |||
let total = 0; | |||
for (const letter of hebrew) { | |||
total += gematria[letter] || 0; | |||
} | |||
return total; | |||
} | |||
// Define the mapping between Hebrew book names and their English and AlHaTorah equivalents | // Define the mapping between Hebrew book names and their English and AlHaTorah equivalents | ||
| שורה 33: | שורה 54: | ||
'זכריה': { english: 'Zechariah', alHaTorah: 'Zekharyah' }, | 'זכריה': { english: 'Zechariah', alHaTorah: 'Zekharyah' }, | ||
'מלאכי': { english: 'Malachi', alHaTorah: 'Malakhi' }, | 'מלאכי': { english: 'Malachi', alHaTorah: 'Malakhi' }, | ||
' | 'תהלים': { english: 'Psalms', alHaTorah: 'Tehillim' }, | ||
'משלי': { english: 'Proverbs', alHaTorah: 'Mishlei' }, | 'משלי': { english: 'Proverbs', alHaTorah: 'Mishlei' }, | ||
'איוב': { english: 'Job', alHaTorah: 'Iyyov' }, | 'איוב': { english: 'Job', alHaTorah: 'Iyyov' }, | ||
| שורה 52: | שורה 73: | ||
var $link = $(this); | var $link = $(this); | ||
var sefer = $link.data('sefer'); | var sefer = $link.data('sefer'); | ||
var | var perekRaw = $link.data('perek'); | ||
var | var pasukRaw = $link.attr('data-pasuk'); | ||
// Ensure the necessary data exists | // Ensure the necessary data exists | ||
if (!sefer || !perek | if (!sefer || !perekRaw) return; | ||
var seferNames = bookNameMapping[sefer]; | |||
if (!seferNames) return; | |||
var perek = hebrewNumeralToInt(perekRaw); | |||
var pasuk = (pasukRaw && pasukRaw.trim() !== '') ? hebrewNumeralToInt(pasukRaw) : null; | |||
// Construct Sefaria URL | // Construct Sefaria URL | ||
var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent( | 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 | ||
| שורה 67: | שורה 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;">'); | ||
$ | $container.append(sefariaIcon); | ||
// 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;">'); | |||
$container.append(alHaTorahIcon); | |||
// | // Create and append the Wikisource icon | ||
var | 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); | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
רעדאגירונגען