From 6871a3122325a6e28b1c3bf010a214ab20c15f45 Mon Sep 17 00:00:00 2001 From: yanirmr Date: Tue, 14 Mar 2023 16:09:00 +0200 Subject: [PATCH] init commit --- content.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ icon.png | Bin 0 -> 6181 bytes manifest.json | 18 +++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 content.js create mode 100644 icon.png create mode 100644 manifest.json diff --git a/content.js b/content.js new file mode 100644 index 0000000..1af73f7 --- /dev/null +++ b/content.js @@ -0,0 +1,54 @@ +function replaceMandaicCharacters() { + const mandaicLetters = "\u{0840}\u{0841}\u{0842}\u{0843}\u{0844}\u{0845}\u{0846}\u{0847}\u{0848}\u{0849}\u{084A}\u{084B}\u{084C}\u{084D}\u{084E}\u{084F}\u{0850}\u{0851}\u{0852}\u{0853}\u{0854}\u{0855}"; + const hebrewLetters = "אבגדחוזהטיכלמנסעפצקרשת"; + const targetTags = ["b", "td"]; + + // Replace Mandaic characters in specific HTML tags + for (const tag of targetTags) { + const elements = document.getElementsByTagName(tag); + for (const element of elements) { + const originalText = element.textContent; + const regex = new RegExp(`[${mandaicLetters}\u{0856}]`, "g"); + const newText = originalText.replace(regex, (match) => { + if (match === '\u{0856}') { + return '\u{05D3}\u{05B7}'; + } + const index = mandaicLetters.indexOf(match); + return hebrewLetters.charAt(index); + }); + // const regex = new RegExp(`[${mandaicLetters}]`, "g"); + // const newText = originalText.replace(regex, (match) => { + // const index = mandaicLetters.indexOf(match); + //return hebrewLetters.charAt(index); + // }); + if (newText !== originalText) { + element.textContent = newText; + } + } + } + + // Replace Mandaic characters in all text nodes on the webpage + const textNodes = document.evaluate( + "//text()", + document, + null, + XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, + null + ); + for (let i = 0; i < textNodes.snapshotLength; i++) { + const textNode = textNodes.snapshotItem(i); + const originalText = textNode.textContent; + const regex = new RegExp(`[${mandaicLetters}]`, "g"); + const newText = originalText.replace(regex, (match) => { + const index = mandaicLetters.indexOf(match); + return hebrewLetters.charAt(index); + }); + if (newText !== originalText) { + textNode.textContent = newText; + } + } +} + +// Call replaceMandaicCharacters() whenever the DOM is updated +const observer = new MutationObserver(replaceMandaicCharacters); +observer.observe(document, { subtree: true, childList: true }); \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5f0e6188f98459a3f189e775186455dc9e6d91d6 GIT binary patch literal 6181 zcmV+=7~1EFP)EX>4Tx04R}tkv&MmKpe$iQ>7|Z2Rn#3WT;M7L`58>ibb$c+6t{Ym|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfb#YR3krMxx6k5c1aNLh~_a1le0HI!Hs@X9CsG4OY zV^J}aT@?eb@S_ji7{`FbOg)}jOv7`0-NVP%y9m$nKKJM7RdOZ+d?N82(+!JwgLr1s z(mC%FhgeZkh|h_~47wokBiCh@-#8Z>7Ik9zor9DjmbGPz1% zthv24_i_3Fq^Yar8{ps& z7%foty2rb_+I#!=OtZfqbs%!6+Z~^;00006VoOIv0RI600RN!9r;`8x010qNS#tmY z4c7nw4c7reD4Tcy000McNliru=K~H2FfMGXjLHB279vSRK~#9!?VWjiRMpwXf9KAf zeJ06dAv;TeZ0v#&sH{c>+-kM8v{tBV!Ply-wS25~YpHFu3LkB2#id#WUbRSz3xee> zf+9#*gs>!G5weGDlgUhGx%a$(kh!@xGnp-SlG)BbbLQ^%e4lfkLw z2T%r}7(g0;6eNh4gePboTQZQC4_9(YPEX_AvDnEA^|>pGJur;?glVA zfioiD548UbfS2ud`(M)1(#(Sr07|K%7yMI+S{@bf#lP(Uer+%qULu5WK??w-G!MXf z0CN%;qYl0}{~61&KhWuPbpZIbjYs&P)er)_`gJx zA2aX;gOO4?-()f!9#8;!oBgi>giJ%y(ybz z+4YoC#zO!A+?z1?Vi&$BKd-&L{T_)5==Jl@CiH&H!*}P~D5Yc4($dU~sP-q|#|L~+ zN>d3TD*=G?hIeZK6eMuQ1$_6Wv#F`61%y&M8^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+{4y1U351`TJfxmYciP*vn)FmKuiRQguVk+c>4|_Q|Hq!oD5&) z4Zg$(9N@v3_V)IB0Q{Cxni?x=!P;Yo&E|-CSC24?#}{9<@XunMACv&NQ)_E$5+P(I zrSvXJX+bQg1-Ew)ixECX!Mp~SW3AiO^Ob`77%-)jw6?aE0Vt=GUIw6;Qko9H6pbx| zxFv{2_=KR7r}P3tNHrL;m*KJPs;d_6A%q0Htl0kpx)F>Qu;zM700000NkvXXu0mjf Dq+rG( literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..23f46c9 --- /dev/null +++ b/manifest.json @@ -0,0 +1,18 @@ +{ + "name": "Mandaic Transcriber Plugin", + "version": "1.0", + "manifest_version": 3, + "host_permissions": [ + "" + ], + "content_scripts": [ + { + "matches": [ + "" + ], + "js": [ + "content.js" + ] + } + ] +}