אונטערשייד צווישן ווערסיעס פון "באַניצער:תנא קמא/tanachLinks.js"

פון המכלול
קפיצה לניווט קפיצה לחיפוש
(געשאַפן בלאַט מיט 'mw.hook('wikipage.content').add(function($content) { $content.find("span:contains('{{תנ""ך|')").each(function() { var text = $(this).text().trim(); var match = text.match(/^{{תנ"ך\|([^|]+)\|([^|]+)\|([^|]+)}}$/); if (match) { var sefer = match[1].trim(); var perek = match[2].trim(); var pasuk = match[3].trim(); var sefariaUrl = `https://www.sefaria.org/$...')
 
אין תקציר עריכה
שורה 1: שורה 1:
mw.hook('wikipage.content').add(function($content) {
mw.hook('wikipage.content').add(function($content) {
     $content.find("span:contains('{{תנ""ך|')").each(function() {
    console.log("Tanach Citation Script Running"); // Debugging message
         var text = $(this).text().trim();
     $content.find(".tanach-citation").each(function() {
         var match = text.match(/^{{תנ"ך\|([^|]+)\|([^|]+)\|([^|]+)}}$/);
         var $this = $(this);
       
         console.log("Found citation:", $this.text()); // Debugging each found citation
         if (match) {
 
            var sefer = match[1].trim();
         var sefer = $this.data("sefer");
            var perek = match[2].trim();
        var perek = $this.data("perek");
            var pasuk = match[3].trim();
        var pasuk = $this.data("pasuk") || 1;
           
 
            var sefariaUrl = `https://www.sefaria.org/${encodeURIComponent(sefer)}.${perek}.${pasuk}`;
        console.log("Extracted:", sefer, perek, pasuk); // Debugging extracted values
            var iconHtml = `<a href="${sefariaUrl}" target="_blank" title="View on Sefaria">
 
                <img src="https://www.sefaria.org/static/img/favicon.ico" style="width: 16px; height: 16px; vertical-align: middle;" />
        var sefariaUrl = `https://www.sefaria.org/${encodeURIComponent(sefer)}.${perek}.${pasuk}`;
            </a>`;
        var iconHtml = `<a href="${sefariaUrl}" target="_blank" title="View on Sefaria">
           
            <img src="https://www.sefaria.org/static/img/favicon.ico" style="width: 16px; height: 16px; vertical-align: middle;" />
            $(this).html(iconHtml);
        </a>`;
        }
 
        $this.append(' ' + iconHtml); // Append icon to the citation
     });
     });
});
});

רעוויזיע פון 23:23, 3 אפריל 2025

mw.hook('wikipage.content').add(function($content) {
    console.log("Tanach Citation Script Running"); // Debugging message
    $content.find(".tanach-citation").each(function() {
        var $this = $(this);
        console.log("Found citation:", $this.text()); // Debugging each found citation

        var sefer = $this.data("sefer");
        var perek = $this.data("perek");
        var pasuk = $this.data("pasuk") || 1;

        console.log("Extracted:", sefer, perek, pasuk); // Debugging extracted values

        var sefariaUrl = `https://www.sefaria.org/${encodeURIComponent(sefer)}.${perek}.${pasuk}`;
        var iconHtml = `<a href="${sefariaUrl}" target="_blank" title="View on Sefaria">
            <img src="https://www.sefaria.org/static/img/favicon.ico" style="width: 16px; height: 16px; vertical-align: middle;" />
        </a>`;

        $this.append(' ' + iconHtml); // Append icon to the citation
    });
});