4,456
רעדאגירונגען
אין תקציר עריכה צייכן: אַנולירונג |
(test) צייכן: צוריקגעשטעלט |
||
| שורה 1: | שורה 1: | ||
mw.loader.using(['mediawiki.util', 'jquery'], function () { | mw.loader.using(['mediawiki.util', 'jquery'], function () { | ||
$(document).ready(function () { | $(document).ready(function () { | ||
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 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 () { | $('.tanach-citation').each(function () { | ||
var $link = $(this); | var $link = $(this); | ||
| שורה 55: | שורה 42: | ||
var pasuk = $link.data('pasuk'); | var pasuk = $link.data('pasuk'); | ||
if (!sefer || !perek || !pasuk) return; | if (!sefer || !perek || !pasuk) return; | ||
var sefariaUrl = 'https://www.sefaria.org/' + encodeURIComponent(sefer) + '.' + encodeURIComponent(perek) + '.' + encodeURIComponent(pasuk); | 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>') | |||
var | .attr('href', '#') | ||
.attr('href | .attr('title', 'View Links') | ||
.html('<img src="' + mainIcon + '" style="width:14px; height:14px; margin-left:3px;">') | |||
.attr('title', ' | .on('click', function (e) { | ||
.html('<img src="' + | 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(); | |||
} | |||
}); | |||
} | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
רעדאגירונגען