{"version":3,"sources":["webpack://email-protect/./src/index.ts"],"names":[],"mappings":"eAgBA,KAAM,GAAW,GACN,EACF,MAAM,IACN,IAAK,GAAkB,OAAO,aAAa,EAAK,WAAW,GAAK,IAChE,KAAK,IAIR,EAAkB,qBAClB,EAAgB,2BAEhB,EAA0C,SAAS,iBAAiB,IAAI,MAG9E,SAFwD,iBAAiB,IAAI,MAEtE,QAAS,GAA6B,CAC1C,EAAK,iBAAiB,QAAU,GAAM,CA/BzC,MAgCO,EAAE,iBACF,OAAO,SAAS,KAAO,UAAY,EAAQ,KAAK,aAAa,KAAlB,OAAoC,QAItF,EAAU,QAAS,GAA2B,CArC9C,MAsCI,EAAK,YAAc,EAAQ,KAAK,aAAa,KAAlB,OAAsC","file":"js/email-protect.js","sourcesContent":["/**\n * Copyright (c) 2021 CodeLeaf\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nconst decrypt = (str : string) : string => {\n return str\n .split(\"\")\n .map((char : string) => String.fromCharCode(char.charCodeAt(0) - 2))\n .join(\"\")\n ;\n}\n\nconst addressSelector = 'data-email-protect';\nconst clickSelector = 'data-email-protect-click';\n\nconst addresses : NodeListOf = document.querySelectorAll(`[${addressSelector}]`);\nconst clicks : NodeListOf = document.querySelectorAll(`[${clickSelector}]`);\n\nclicks.forEach((elem : HTMLAnchorElement) => {\n elem.addEventListener('click', (e) => {\n e.preventDefault();\n window.location.href = 'mailto:' + decrypt(elem.getAttribute(clickSelector) ?? \"\");\n });\n});\n\naddresses.forEach((elem : HTMLSpanElement) => {\n elem.textContent = decrypt(elem.getAttribute(addressSelector) ?? \"\");\n});"],"sourceRoot":""}