diff --git a/index.html b/index.html index 9ec2f9c..47a35ca 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -isbot: Recognise bots/crawlers/spiders using the user agent string

Is this a bot user agent string?

Powered by Javascript package isbot@5.1.15

\ No newline at end of file +isbot: Recognise bots/crawlers/spiders using the user agent string

Is this a bot user agent string?

Powered by Javascript package isbot@5.1.16

\ No newline at end of file diff --git a/script.bc5c124c.js b/script.21ed213d.js similarity index 55% rename from script.bc5c124c.js rename to script.21ed213d.js index f31a0a4..a285f05 100644 --- a/script.bc5c124c.js +++ b/script.21ed213d.js @@ -1,6 +1,6 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c0&&void 0!==arguments[0]?arguments[0]:n.innerHTML;for(e=e.trim();o.firstChild;)o.removeChild(o.firstChild);""!==e?o.appendChild(u(e)):o.appendChild(document.createTextNode("Insert user agent string in the text box"))}n.childNodes.forEach(function(e){var t;return null===(t=e.parentNode)||void 0===t?void 0:t.removeChild(e)}),n.appendChild(document.createTextNode(i||navigator.userAgent)),n.addEventListener("keyup",a),n.addEventListener("paste",a),n.addEventListener("focus",function(){return n.select()}),l(),d.addEventListener("click",function(e){e.preventDefault();var t=document.location,o=t.protocol,d=t.host,r=t.pathname;navigator.clipboard.writeText([o,"//",d,r,"?ua=",encodeURIComponent(n.value)].join(""));var i=document.createElement("dialog");i.appendChild(document.createTextNode("copied to clipboard")),document.body.appendChild(i),i.showModal(),setTimeout(function(){i.addEventListener("transitionend",function(){i.close(),document.body.removeChild(i)}),i.style.opacity="0"},1e3)})} },{"..":"mdAn"}]},{},["g4tf"], null) -//# sourceMappingURL=script.bc5c124c.js.map \ No newline at end of file +//# sourceMappingURL=script.21ed213d.js.map \ No newline at end of file diff --git a/script.21ed213d.js.map b/script.21ed213d.js.map new file mode 100644 index 0000000..9f3b4c1 --- /dev/null +++ b/script.21ed213d.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../index.mjs","script.ts"],"names":["pattern","patterns_default","fullPattern","naivePattern","getPattern","RegExp","error","list","exports","isbotNaive","userAgent","Boolean","test","isbot","createIsbot","customPattern","createIsbotFromList","list2","pattern2","join","isbotMatch","_a","_b","match","isbotMatches","map","part","filter","isbotPattern","find","isbotPatterns"],"mappings":";AAqNwH,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,oBAAA,QAAA,iBAAA,EAAA,QAAA,WAAA,EAAA,QAAA,MAAA,EAAA,QAAA,KAAA,QAAA,cAAA,QAAA,aAAA,QAAA,WAAA,QAAA,aAAA,QAAA,gBAAA,EApNxH,IAkLIA,EAlLAC,EAAmB,CACrB,YACA,UACA,mBACA,6BACA,2DACA,yBACA,mBACA,kBACA,mBACA,SACA,SACA,gBACA,KACA,2EACA,cACA,WACA,iBACA,sBACA,UACA,cACA,SACA,iBACA,aACA,OACA,OACA,cACA,WACA,WACA,UACA,kBACA,aACA,gBACA,aACA,cACA,YACA,aACA,YACA,UACA,WACA,UACA,UACA,UACA,UACA,kBACA,eACA,yCACA,2BACA,gBACA,WACA,WACA,SACA,OACA,WACA,UACA,QACA,QACA,QACA,QACA,OACA,YACA,eACA,OACA,SACA,WACA,YACA,SACA,SACA,OACA,cACA,aACA,QACA,YACA,aACA,oBACA,SACA,UACA,WACA,qBACA,WACA,WACA,UACA,mBACA,YACA,gBACA,UACA,mBACA,UACA,QACA,WACA,UACA,oBACA,cACA,aACA,aACA,aACA,QACA,WACA,YACA,WACA,YACA,SACA,YACA,WACA,aACA,mBACA,OACA,UACA,cACA,aACA,WACA,UACA,2BACA,QACA,cACA,SACA,aACA,UACA,UACA,UACA,YACA,YACA,UACA,YACA,aACA,UACA,UACA,cACA,OACA,QACA,WACA,WACA,YACA,YACA,SACA,OACA,YACA,UACA,aACA,UACA,QACA,cACA,aACA,WACA,YACA,QACA,QACA,SACA,OACA,SACA,SACA,QACA,YACA,aACA,SACA,SACA,aACA,eACA,UACA,YACA,QACA,UACA,QACA,aACA,MACA,WACA,aACA,YACA,aACA,WACA,SAIEC,EAAc,+xDAGdC,EAAe,oCAEnB,SAASC,IACP,GAAIJ,aAAmBK,OACrB,OAAOL,EAET,IACEA,EAAU,IAAIK,OAAOH,EAAa,KAClC,MAAOI,GACPN,EAAUG,EAEZ,OAAOH,EAET,IAAIO,EAAIC,QAAAD,KAAGN,EACPQ,EAAUD,QAAAC,WAAG,SAACC,GAAS,OAAKC,QAAQD,IAAcP,EAAaS,KAAKF,IACxE,SAASG,EAAMH,GACb,OAAOC,QAAQD,IAAcN,IAAaQ,KAAKF,GAEjD,IAAII,EAAWN,QAAAM,YAAG,SAACC,GAAa,OAAK,SAACL,GAAS,OAAKC,QAAQD,IAAcK,EAAcH,KAAKF,KACzFM,EAAmBR,QAAAQ,oBAAG,SAACC,GACzB,IAAMC,EAAW,IAAIb,OAAOY,EAAME,KAAK,KAAM,KAC7C,OAAO,SAACT,GAAS,OAAKC,QAAQD,IAAcQ,EAASN,KAAKF,KAExDU,EAAUZ,QAAAY,WAAG,SAACV,GAChB,IAAIW,EAAIC,EACR,OAA4G,OAApGA,EAA0E,OAApED,EAAkB,MAAbX,OAAoB,EAASA,EAAUa,MAAMnB,WAAyB,EAASiB,EAAG,IAAcC,EAAK,MAEtHE,EAAYhB,QAAAgB,aAAG,SAACd,GAAS,OAAKH,EAAKkB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ACxB,EAAO,EAAU,KAAM,yBACvB,EAAO,EAAU,MAAO,QAExB,EACC,EACA,KACA,gEAGF,OAAO,EAGR,SAAS,IAAgC,IAA1B,EAAK,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAG,GAAA,EAAS,UAE/B,IADA,EAAQ,EAAM,OACP,EAAO,YACb,EAAO,YAAY,EAAO,YAEb,KAAV,EAOJ,EAAO,YAAY,EAAQ,IAN1B,EAAO,YACN,SAAS,eAAe,6CA5D3B,EAAS,WAAW,QAAQ,SAAC,GAAK,IAAA,EAAA,OAAqB,QAArB,EAAK,EAAM,kBAAN,IAAgB,OAAhB,EAAA,EAAkB,YAAY,KACrE,EAAS,YAAY,SAAS,eAAe,GAAM,UAAU,YAC7D,EAAS,iBAAiB,QAAS,GACnC,EAAS,iBAAiB,QAAS,GACnC,EAAS,iBAAiB,QAAS,WAAA,OAAM,EAAS,WAClD,IA+DA,EAAS,iBAAiB,QAAS,SAAC,GACnC,EAAM,iBACN,IAAA,EAAqC,SAAS,SAAtC,EAAQ,EAAR,SAAU,EAAI,EAAJ,KAAM,EAAQ,EAAR,SACxB,UAAU,UAAU,UACnB,CACC,EACA,KACA,EACA,EACA,OACA,mBAAmB,EAAS,QAC3B,KAAK,KAER,IAAM,EAAS,SAAS,cAAc,UACtC,EAAO,YAAY,SAAS,eAAe,wBAC3C,SAAS,KAAK,YAAY,GAC1B,EAAO,YACP,WAAW,WACV,EAAO,iBAAiB,gBAAiB,WACxC,EAAO,QACP,SAAS,KAAK,YAAY,KAE3B,EAAO,MAAM,QAAU,KACrB","file":"script.21ed213d.js","sourceRoot":"../page","sourcesContent":["// src/patterns.json\nvar patterns_default = [\n \" daum[ /]\",\n \" deusu/\",\n \" yadirectfetcher\",\n \"(?:^|[^g])news(?!sapphire)\",\n \"(? Boolean(userAgent) && naivePattern.test(userAgent);\nfunction isbot(userAgent) {\n return Boolean(userAgent) && getPattern().test(userAgent);\n}\nvar createIsbot = (customPattern) => (userAgent) => Boolean(userAgent) && customPattern.test(userAgent);\nvar createIsbotFromList = (list2) => {\n const pattern2 = new RegExp(list2.join(\"|\"), \"i\");\n return (userAgent) => Boolean(userAgent) && pattern2.test(userAgent);\n};\nvar isbotMatch = (userAgent) => {\n var _a, _b;\n return (_b = (_a = userAgent == null ? void 0 : userAgent.match(getPattern())) == null ? void 0 : _a[0]) != null ? _b : null;\n};\nvar isbotMatches = (userAgent) => list.map((part) => {\n var _a;\n return (_a = userAgent == null ? void 0 : userAgent.match(new RegExp(part, \"i\"))) == null ? void 0 : _a[0];\n}).filter(Boolean);\nvar isbotPattern = (userAgent) => {\n var _a;\n return userAgent ? (_a = list.find((pattern2) => new RegExp(pattern2, \"i\").test(userAgent))) != null ? _a : null : null;\n};\nvar isbotPatterns = (userAgent) => userAgent ? list.filter((pattern2) => new RegExp(pattern2, \"i\").test(userAgent)) : [];\nexport {\n createIsbot,\n createIsbotFromList,\n getPattern,\n isbot,\n isbotMatch,\n isbotMatches,\n isbotNaive,\n isbotPattern,\n isbotPatterns,\n list\n};\n","import { isbot, isbotMatch, isbotPatterns } from \"..\";\n\n{\n\tconst textarea = document.querySelector(\"textarea\") as HTMLTextAreaElement;\n\tconst output = document.querySelector(\"output\") as HTMLOutputElement;\n\tconst copyLink = document.querySelector(\n\t\t'[id=\"copy-link\"]',\n\t) as HTMLButtonElement;\n\tlet timer: ReturnType;\n\n\tconst url = new URL(window.location.href);\n\tconst ua = url.searchParams.get(\"ua\");\n\n\ttextarea.childNodes.forEach((child) => child.parentNode?.removeChild(child));\n\ttextarea.appendChild(document.createTextNode(ua || navigator.userAgent));\n\ttextarea.addEventListener(\"keyup\", change);\n\ttextarea.addEventListener(\"paste\", change);\n\ttextarea.addEventListener(\"focus\", () => textarea.select());\n\tcheck();\n\n\tfunction change({ target }: Event): void {\n\t\tconst { value } = target as HTMLTextAreaElement;\n\t\tclearTimeout(timer);\n\t\ttimer = setTimeout(check, 200, value);\n\t}\n\n\tfunction append(\n\t\tparent: DocumentFragment,\n\t\ttag: string | null,\n\t\tstring: string | boolean | null,\n\t): void {\n\t\tif (tag) {\n\t\t\tconst ele = document.createElement(\"kbd\");\n\t\t\tele.appendChild(document.createTextNode(`${string}`));\n\t\t\tparent.appendChild(ele);\n\t\t} else {\n\t\t\tparent.appendChild(document.createTextNode(`${string}`));\n\t\t}\n\t}\n\n\tfunction details(ua: string): DocumentFragment {\n\t\tconst fragment = document.createDocumentFragment();\n\t\tconst is = isbot(ua);\n\n\t\tif (is) {\n\t\t\tconst found = isbotMatch(ua) as string;\n\t\t\tconst patterns = isbotPatterns(ua);\n\t\t\tconst pattern = patterns.find((pattern: string): boolean =>\n\t\t\t\tnew RegExp(pattern, \"i\").test(found),\n\t\t\t) as string;\n\t\t\tconsole.log(patterns, pattern);\n\t\t\tappend(fragment, null, \"I think so, yes\\n\");\n\t\t\tappend(fragment, null, \"The substring \");\n\t\t\tappend(fragment, \"kbd\", found);\n\t\t\tappend(fragment, null, \" matches the pattern \");\n\t\t\tappend(fragment, \"kbd\", pattern);\n\t\t} else {\n\t\t\tappend(\n\t\t\t\tfragment,\n\t\t\t\tnull,\n\t\t\t\t\"I don't think so, no\\nI could not find a pattern I recognise\",\n\t\t\t);\n\t\t}\n\t\treturn fragment;\n\t}\n\n\tfunction check(value = textarea.innerHTML): void {\n\t\tvalue = value.trim();\n\t\twhile (output.firstChild) {\n\t\t\toutput.removeChild(output.firstChild);\n\t\t}\n\t\tif (value === \"\") {\n\t\t\toutput.appendChild(\n\t\t\t\tdocument.createTextNode(\"Insert user agent string in the text box\"),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\toutput.appendChild(details(value));\n\t}\n\n\tcopyLink.addEventListener(\"click\", (event: Event): void => {\n\t\tevent.preventDefault();\n\t\tconst { protocol, host, pathname } = document.location;\n\t\tnavigator.clipboard.writeText(\n\t\t\t[\n\t\t\t\tprotocol,\n\t\t\t\t\"//\",\n\t\t\t\thost,\n\t\t\t\tpathname,\n\t\t\t\t\"?ua=\",\n\t\t\t\tencodeURIComponent(textarea.value),\n\t\t\t].join(\"\"),\n\t\t);\n\t\tconst dialog = document.createElement(\"dialog\");\n\t\tdialog.appendChild(document.createTextNode(\"copied to clipboard\"));\n\t\tdocument.body.appendChild(dialog);\n\t\tdialog.showModal();\n\t\tsetTimeout((): void => {\n\t\t\tdialog.addEventListener(\"transitionend\", () => {\n\t\t\t\tdialog.close();\n\t\t\t\tdocument.body.removeChild(dialog);\n\t\t\t});\n\t\t\tdialog.style.opacity = \"0\";\n\t\t}, 1000);\n\t});\n}\n"]} \ No newline at end of file diff --git a/script.bc5c124c.js.map b/script.bc5c124c.js.map deleted file mode 100644 index c8b32c2..0000000 --- a/script.bc5c124c.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../index.mjs","script.ts"],"names":["pattern","patterns_default","fullPattern","naivePattern","getPattern","RegExp","error","list","exports","isbotNaive","userAgent","Boolean","test","isbot","createIsbot","customPattern","createIsbotFromList","list2","pattern2","join","isbotMatch","_a","_b","match","isbotMatches","map","part","filter","isbotPattern","find","isbotPatterns"],"mappings":";AAqNwH,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,oBAAA,QAAA,iBAAA,EAAA,QAAA,WAAA,EAAA,QAAA,MAAA,EAAA,QAAA,KAAA,QAAA,cAAA,QAAA,aAAA,QAAA,WAAA,QAAA,aAAA,QAAA,gBAAA,EApNxH,IAkLIA,EAlLAC,EAAmB,CACrB,YACA,UACA,mBACA,6BACA,2DACA,yBACA,mBACA,kBACA,mBACA,SACA,SACA,gBACA,KACA,2EACA,cACA,WACA,iBACA,sBACA,UACA,cACA,SACA,iBACA,aACA,OACA,OACA,cACA,WACA,WACA,UACA,kBACA,aACA,gBACA,aACA,cACA,YACA,aACA,YACA,UACA,WACA,UACA,UACA,UACA,UACA,kBACA,eACA,yCACA,2BACA,gBACA,WACA,WACA,SACA,OACA,WACA,UACA,QACA,QACA,QACA,QACA,OACA,YACA,eACA,OACA,SACA,WACA,YACA,SACA,SACA,OACA,cACA,aACA,QACA,YACA,aACA,oBACA,SACA,UACA,WACA,qBACA,WACA,WACA,UACA,mBACA,YACA,gBACA,UACA,mBACA,UACA,QACA,WACA,UACA,oBACA,cACA,aACA,QACA,aACA,aACA,QACA,WACA,YACA,WACA,YACA,SACA,YACA,WACA,aACA,mBACA,OACA,UACA,cACA,aACA,WACA,UACA,2BACA,QACA,cACA,SACA,aACA,UACA,UACA,UACA,YACA,YACA,UACA,YACA,aACA,UACA,UACA,cACA,OACA,QACA,WACA,WACA,YACA,YACA,SACA,OACA,YACA,UACA,aACA,UACA,QACA,cACA,aACA,WACA,YACA,QACA,QACA,SACA,OACA,SACA,SACA,QACA,YACA,aACA,SACA,SACA,aACA,UACA,YACA,QACA,UACA,QACA,aACA,MACA,WACA,aACA,YACA,aACA,WACA,SAIEC,EAAc,wxDAGdC,EAAe,oCAEnB,SAASC,IACP,GAAIJ,aAAmBK,OACrB,OAAOL,EAET,IACEA,EAAU,IAAIK,OAAOH,EAAa,KAClC,MAAOI,GACPN,EAAUG,EAEZ,OAAOH,EAET,IAAIO,EAAIC,QAAAD,KAAGN,EACPQ,EAAUD,QAAAC,WAAG,SAACC,GAAS,OAAKC,QAAQD,IAAcP,EAAaS,KAAKF,IACxE,SAASG,EAAMH,GACb,OAAOC,QAAQD,IAAcN,IAAaQ,KAAKF,GAEjD,IAAII,EAAWN,QAAAM,YAAG,SAACC,GAAa,OAAK,SAACL,GAAS,OAAKC,QAAQD,IAAcK,EAAcH,KAAKF,KACzFM,EAAmBR,QAAAQ,oBAAG,SAACC,GACzB,IAAMC,EAAW,IAAIb,OAAOY,EAAME,KAAK,KAAM,KAC7C,OAAO,SAACT,GAAS,OAAKC,QAAQD,IAAcQ,EAASN,KAAKF,KAExDU,EAAUZ,QAAAY,WAAG,SAACV,GAChB,IAAIW,EAAIC,EACR,OAA4G,OAApGA,EAA0E,OAApED,EAAkB,MAAbX,OAAoB,EAASA,EAAUa,MAAMnB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AQ,IAAI,EAAU,GACtB,EAAO,EAAU,KAAM,qBACvB,EAAO,EAAU,KAAM,kBACvB,EAAO,EAAU,MAAO,GACxB,EAAO,EAAU,KAAM,yBACvB,EAAO,EAAU,MAAO,QAExB,EACC,EACA,KACA,gEAGF,OAAO,EAGR,SAAS,IAAgC,IAA1B,EAAK,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAG,GAAA,EAAS,UAE/B,IADA,EAAQ,EAAM,OACP,EAAO,YACb,EAAO,YAAY,EAAO,YAEb,KAAV,EAOJ,EAAO,YAAY,EAAQ,IAN1B,EAAO,YACN,SAAS,eAAe,6CA5D3B,EAAS,WAAW,QAAQ,SAAC,GAAK,IAAA,EAAA,OAAqB,QAArB,EAAK,EAAM,kBAAN,IAAgB,OAAhB,EAAA,EAAkB,YAAY,KACrE,EAAS,YAAY,SAAS,eAAe,GAAM,UAAU,YAC7D,EAAS,iBAAiB,QAAS,GACnC,EAAS,iBAAiB,QAAS,GACnC,EAAS,iBAAiB,QAAS,WAAA,OAAM,EAAS,WAClD,IA+DA,EAAS,iBAAiB,QAAS,SAAC,GACnC,EAAM,iBACN,IAAA,EAAqC,SAAS,SAAtC,EAAQ,EAAR,SAAU,EAAI,EAAJ,KAAM,EAAQ,EAAR,SACxB,UAAU,UAAU,UACnB,CACC,EACA,KACA,EACA,EACA,OACA,mBAAmB,EAAS,QAC3B,KAAK,KAER,IAAM,EAAS,SAAS,cAAc,UACtC,EAAO,YAAY,SAAS,eAAe,wBAC3C,SAAS,KAAK,YAAY,GAC1B,EAAO,YACP,WAAW,WACV,EAAO,iBAAiB,gBAAiB,WACxC,EAAO,QACP,SAAS,KAAK,YAAY,KAE3B,EAAO,MAAM,QAAU,KACrB","file":"script.bc5c124c.js","sourceRoot":"../page","sourcesContent":["// src/patterns.json\nvar patterns_default = [\n \" daum[ /]\",\n \" deusu/\",\n \" yadirectfetcher\",\n \"(?:^|[^g])news(?!sapphire)\",\n \"(? Boolean(userAgent) && naivePattern.test(userAgent);\nfunction isbot(userAgent) {\n return Boolean(userAgent) && getPattern().test(userAgent);\n}\nvar createIsbot = (customPattern) => (userAgent) => Boolean(userAgent) && customPattern.test(userAgent);\nvar createIsbotFromList = (list2) => {\n const pattern2 = new RegExp(list2.join(\"|\"), \"i\");\n return (userAgent) => Boolean(userAgent) && pattern2.test(userAgent);\n};\nvar isbotMatch = (userAgent) => {\n var _a, _b;\n return (_b = (_a = userAgent == null ? void 0 : userAgent.match(getPattern())) == null ? void 0 : _a[0]) != null ? _b : null;\n};\nvar isbotMatches = (userAgent) => list.map((part) => {\n var _a;\n return (_a = userAgent == null ? void 0 : userAgent.match(new RegExp(part, \"i\"))) == null ? void 0 : _a[0];\n}).filter(Boolean);\nvar isbotPattern = (userAgent) => {\n var _a;\n return userAgent ? (_a = list.find((pattern2) => new RegExp(pattern2, \"i\").test(userAgent))) != null ? _a : null : null;\n};\nvar isbotPatterns = (userAgent) => userAgent ? list.filter((pattern2) => new RegExp(pattern2, \"i\").test(userAgent)) : [];\nexport {\n createIsbot,\n createIsbotFromList,\n getPattern,\n isbot,\n isbotMatch,\n isbotMatches,\n isbotNaive,\n isbotPattern,\n isbotPatterns,\n list\n};\n","import { isbot, isbotMatch, isbotPatterns } from \"..\";\n\n{\n\tconst textarea = document.querySelector(\"textarea\") as HTMLTextAreaElement;\n\tconst output = document.querySelector(\"output\") as HTMLOutputElement;\n\tconst copyLink = document.querySelector(\n\t\t'[id=\"copy-link\"]',\n\t) as HTMLButtonElement;\n\tlet timer: ReturnType;\n\n\tconst url = new URL(window.location.href);\n\tconst ua = url.searchParams.get(\"ua\");\n\n\ttextarea.childNodes.forEach((child) => child.parentNode?.removeChild(child));\n\ttextarea.appendChild(document.createTextNode(ua || navigator.userAgent));\n\ttextarea.addEventListener(\"keyup\", change);\n\ttextarea.addEventListener(\"paste\", change);\n\ttextarea.addEventListener(\"focus\", () => textarea.select());\n\tcheck();\n\n\tfunction change({ target }: Event): void {\n\t\tconst { value } = target as HTMLTextAreaElement;\n\t\tclearTimeout(timer);\n\t\ttimer = setTimeout(check, 200, value);\n\t}\n\n\tfunction append(\n\t\tparent: DocumentFragment,\n\t\ttag: string | null,\n\t\tstring: string | boolean | null,\n\t): void {\n\t\tif (tag) {\n\t\t\tconst ele = document.createElement(\"kbd\");\n\t\t\tele.appendChild(document.createTextNode(`${string}`));\n\t\t\tparent.appendChild(ele);\n\t\t} else {\n\t\t\tparent.appendChild(document.createTextNode(`${string}`));\n\t\t}\n\t}\n\n\tfunction details(ua: string): DocumentFragment {\n\t\tconst fragment = document.createDocumentFragment();\n\t\tconst is = isbot(ua);\n\n\t\tif (is) {\n\t\t\tconst found = isbotMatch(ua) as string;\n\t\t\tconst patterns = isbotPatterns(ua);\n\t\t\tconst pattern = patterns.find((pattern: string): boolean =>\n\t\t\t\tnew RegExp(pattern, \"i\").test(found),\n\t\t\t) as string;\n\t\t\tconsole.log(patterns, pattern);\n\t\t\tappend(fragment, null, \"I think so, yes\\n\");\n\t\t\tappend(fragment, null, \"The substring \");\n\t\t\tappend(fragment, \"kbd\", found);\n\t\t\tappend(fragment, null, \" matches the pattern \");\n\t\t\tappend(fragment, \"kbd\", pattern);\n\t\t} else {\n\t\t\tappend(\n\t\t\t\tfragment,\n\t\t\t\tnull,\n\t\t\t\t\"I don't think so, no\\nI could not find a pattern I recognise\",\n\t\t\t);\n\t\t}\n\t\treturn fragment;\n\t}\n\n\tfunction check(value = textarea.innerHTML): void {\n\t\tvalue = value.trim();\n\t\twhile (output.firstChild) {\n\t\t\toutput.removeChild(output.firstChild);\n\t\t}\n\t\tif (value === \"\") {\n\t\t\toutput.appendChild(\n\t\t\t\tdocument.createTextNode(\"Insert user agent string in the text box\"),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\toutput.appendChild(details(value));\n\t}\n\n\tcopyLink.addEventListener(\"click\", (event: Event): void => {\n\t\tevent.preventDefault();\n\t\tconst { protocol, host, pathname } = document.location;\n\t\tnavigator.clipboard.writeText(\n\t\t\t[\n\t\t\t\tprotocol,\n\t\t\t\t\"//\",\n\t\t\t\thost,\n\t\t\t\tpathname,\n\t\t\t\t\"?ua=\",\n\t\t\t\tencodeURIComponent(textarea.value),\n\t\t\t].join(\"\"),\n\t\t);\n\t\tconst dialog = document.createElement(\"dialog\");\n\t\tdialog.appendChild(document.createTextNode(\"copied to clipboard\"));\n\t\tdocument.body.appendChild(dialog);\n\t\tdialog.showModal();\n\t\tsetTimeout((): void => {\n\t\t\tdialog.addEventListener(\"transitionend\", () => {\n\t\t\t\tdialog.close();\n\t\t\t\tdocument.body.removeChild(dialog);\n\t\t\t});\n\t\t\tdialog.style.opacity = \"0\";\n\t\t}, 1000);\n\t});\n}\n"]} \ No newline at end of file