From c545bb511dd8dd2d1b1de7783ac9025bd640821f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20=C4=90=2E?= Date: Wed, 18 Sep 2024 23:19:46 +0200 Subject: [PATCH] fixed the problems with git --- wungle-extension/3y3 | 1 - wungle-extension/lib/3y3.js | 34 ++++++++++++++++++++++++++++++++++ wungle-extension/lib/README.md | 19 +++++++++++++++++++ wungle-extension/manifest.json | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) delete mode 160000 wungle-extension/3y3 create mode 100644 wungle-extension/lib/3y3.js create mode 100644 wungle-extension/lib/README.md diff --git a/wungle-extension/3y3 b/wungle-extension/3y3 deleted file mode 160000 index b01edc6..0000000 --- a/wungle-extension/3y3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b01edc645dcc7a6a3153d459c992e5d446e44b3f diff --git a/wungle-extension/lib/3y3.js b/wungle-extension/lib/3y3.js new file mode 100644 index 0000000..bbf4c47 --- /dev/null +++ b/wungle-extension/lib/3y3.js @@ -0,0 +1,34 @@ +const encode = (/**@type {string}*/ text) => { + const codePoints = [...text].map((c) => c.codePointAt(0)); + + const output = []; + for (const char of codePoints) { + output.push( + String.fromCodePoint( + char + (0x00 < char && char < 0x7f ? 0xe0000 : 0) + ).toString() + ); + } + + return output.join(""); +}; + +const decode = (/**@type {string}*/ text) => { + const codePoints = [...text].map((c) => c.codePointAt(0)); + + const output = []; + for (const char of codePoints) { + output.push( + String.fromCodePoint( + char - (0xe0000 < char && char < 0xe007f ? 0xe0000 : 0) + ).toString() + ); + } + + return output.join(""); +}; + +const detect = (/**@type {string}*/ text) => { + const codePoints = [...text].map((c) => c.codePointAt(0)); + return codePoints.some((c) => 0xe0000 < c && c < 0xe007f); +}; diff --git a/wungle-extension/lib/README.md b/wungle-extension/lib/README.md new file mode 100644 index 0000000..ead7306 --- /dev/null +++ b/wungle-extension/lib/README.md @@ -0,0 +1,19 @@ +# 3y3 +Hide text in plain sight, using invisible characters. + +# Credit +Credit goes to [@yourcompanionAI](https://github.com/twilight-sparkle-irl), source: https://synthetic.garden/3y3.htm + +I only re-implemented their algorithm into easy-to-use encode/decode functions.
+Below is the original source code: +```js +function secondsightify(t) { + if ([...t].some(x => (0xe0000 < x.codePointAt(0) && x.codePointAt(0) < 0xe007f))) { + // 3y3 text detected. Revealing... + return (t => ([...t].map(x => (0xe0000 < x.codePointAt(0) && x.codePointAt(0) < 0xe007f) ? String.fromCodePoint(x.codePointAt(0) - 0xe0000) : x).join("")))(t) + } else { + // No 3y3 text was found, Encoding... + return (t => [...t].map(x => (0x00 < x.codePointAt(0) && x.codePointAt(0) < 0x7f) ? String.fromCodePoint(x.codePointAt(0)+0xe0000) : x).join(""))(t) + } +} +``` diff --git a/wungle-extension/manifest.json b/wungle-extension/manifest.json index 26e224d..6734f4e 100644 --- a/wungle-extension/manifest.json +++ b/wungle-extension/manifest.json @@ -10,7 +10,7 @@ "content_scripts": [ { "matches": ["*://*.tumblr.com/*"], - "js": ["3y3/3y3.js", "content_script.js"] + "js": ["lib/3y3.js", "content_script.js"] } ], "browser_action": {