באַניצער:תנא קמא/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 () {
var sefariaFavicon = 'https://www.sefaria.org/static/icons/favicon.ico';
var alHaTorahFavicon = 'https://mg.alhatorah.org/favicon.ico';
var mainIcon = 'https://upload.wikimedia.org/wikipedia/commons/e/ec/External_link_icon.png'; // Main popup trigger icon
var bookNameMapping = {
'Genesis': 'Bereshit', 'Exodus': 'Shemot', 'Leviticus': 'Vayikra', 'Numbers': 'Bemidbar',
'Deuteronomy': 'Devarim', 'Joshua': 'Yehoshua', 'Judges': 'Shofetim', 'Samuel I': 'Shemuel I',
'Samuel II': 'Shemuel II', 'Kings I': 'Melakhim I', 'Kings II': 'Melakhim II', 'Isaiah': 'Yeshayahu',
'Jeremiah': 'Yirmeyahu', 'Ezekiel': 'Yechezkel', 'Hosea': 'Hoshea', 'Joel': 'Yoel', 'Amos': 'Amos',
'Obadiah': 'Ovadyah', 'Jonah': 'Yonah', 'Micah': 'Mikhah', 'Nahum': 'Nachum', 'Habakkuk': 'Chavakkuk',
'Zephaniah': 'Zephanyah', 'Haggai': 'Chaggai', 'Zechariah': 'Zekharyah', 'Malachi': 'Malakhi',
'Psalms': 'Tehillim', 'Proverbs': 'Mishlei', 'Job': 'Iyyov', 'Song of Songs': 'Shir HaShirim',
'Ruth': 'Rut', 'Lamentations': 'Eikhah', 'Ecclesiastes': 'Kohelet', 'Esther': 'Esther', 'Daniel': 'Daniel',
'Ezra': 'Ezra', 'Nehemiah': 'Nechemyah', 'Chronicles I': 'Divrei HaYamim I', 'Chronicles II': 'Divrei HaYamim II'
};
function createPopup(link, sefariaUrl, alHaTorahUrl) {
var popup = $('<div class="custom-popup">')
.css({
position: 'absolute', background: '#fff', border: '1px solid #ccc',
padding: '5px', 'border-radius': '5px', 'box-shadow': '0px 2px 5px rgba(0,0,0,0.2)',
display: 'none', 'z-index': 1000
})
.append(
$('<a>').attr({ href: sefariaUrl, target: '_blank', title: 'עפן אין ספריא' })
.html('<img src="' + sefariaFavicon + '" style="width:16px; height:16px; margin:3px;">'),
$('<a>').attr({ href: alHaTorahUrl, target: '_blank', title: 'עפן אין על התורה' })
.html('<img src="' + alHaTorahFavicon + '" style="width:16px; height:16px; margin:3px;">')
);
$('body').append(popup);
return popup;
}
$('.tanach-citation').each(function () {
var $link = $(this);
var sefer = $link.data('sefer');
var perek = $link.data('perek');
var pasuk = $link.data('pasuk');
if (!sefer || !perek || !pasuk) return;
var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefer) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);
var alHaTorahSefer = bookNameMapping[sefer] || sefer;
var alHaTorahUrl = 'https://mg.alhatorah.org/Full/' + encodeURIComponent(alHaTorahSefer) +
'/' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk);
var popup = createPopup($link, sefariaUrl, alHaTorahUrl);
var mainIconLink = $('<a>')
.attr('href', '#')
.attr('title', 'View Links')
.html('<img src="' + mainIcon + '" style="width:14px; height:14px; margin-left:3px;">')
.on('click', function (e) {
e.preventDefault();
var offset = $(this).offset();
popup.css({ top: offset.top + 20, left: offset.left }).toggle();
});
$link.after(mainIconLink);
$(document).on('click', function (e) {
if (!popup.is(e.target) && popup.has(e.target).length === 0 && !mainIconLink.is(e.target)) {
popup.hide();
}
});
});
});
});