Compare commits

..

10 Commits
1.3.0 ... main

10 changed files with 166 additions and 1044 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
node_modules
src/content-script.js
src/popup.js
src/manifest.json
dist

View File

@ -1,6 +1,6 @@
# MetamorPOV
When enabled for a website, this extension will look for markers (such as Y/n, pov/s, and vrb/do/present/) used to replace specific pronouns. If found, it will replace those markers with your pronouns. You can also choose what point-of-view you want to read in: first, second, or third-person perspective.
When enabled for a website, this extension will translate specific markers such as Y/n, pov/s, and vrb/present/do/ into your pronouns. You can also choose what point-of-view you want to read in: first, second, or third-person perspective.
- Your choice of name
- Your choice of pronouns, including neopronouns
@ -47,8 +47,8 @@ npm run test-chrome
## Copyright and License
- Portions of MetamorPOV are derived from [InteractiveFics](https://github.com/interactivefics/interactive-fics), licensed under [MIT](third-party-licenses/LICENSE-InteractiveFics), copyrighted 2015-2023 by Mariam Maarouf.
- MetamorPOV supports verb conjugation with [RosaeNLG](https://rosaenlg.org/), licensed under [Apache-2.0](third-party-licenses/LICENSE-RosaeNLG), copyrighted 2019-2024 by Ludan Stoecklé, 2015 by Forbes Lindesay, and 2009-2014 by TJ Holowaychuk.
- MetamorPOV is themed with [Primary](https://primary-theme.github.io/), licensed under [GPL-3.0](third-party-licenses/LICENSE-Primary), copyrighted 2021-2024 by Cecilia May.
- Icons, excepting the butterfly, are redistributed from [Luicide](https://lucide.dev), licensed under [ISC](third-party-licenses/LICENSE-Luicide), copyrighted 2022-2025 by Lucide Contributors. Luicide contains portions of Feather, licensed under [MIT](third-party-licenses/LICENSE-Feather), copyrighted 2013-2022 by Cole Bemis.
- All other portions of MetamorPOV are licensed under [GPL-3.0-or-later](LICENSE), copyrighted 2024-2025 by Jean Viscogliosi-Pate.
- Portions of MetamorPOV are derived from [InteractiveFics](https://github.com/interactivefics/interactive-fics), licensed under [MIT](third-party-licenses/LICENSE-InteractiveFics), copyrighted 20152023 by Mariam Maarouf.
- MetamorPOV is themed with [Primary](https://primary-theme.github.io/), licensed under [GPL-3.0](third-party-licenses/LICENSE-Primary), copyrighted 20212024 by Cecilia May.
- Icons, excepting the butterfly, are redistributed from [Luicide](https://lucide.dev), licensed under [ISC](third-party-licenses/LICENSE-Luicide), copyrighted 20222025 by Lucide Contributors. Luicide contains portions of Feather, licensed under [MIT](third-party-licenses/LICENSE-Feather), copyrighted 20132022 by Cole Bemis.
- Translation logic is provided by the [MetamorPOV library](https://git.viscogliosi-pate.com/metamorpov-library), licensed under [GPL-3.0-or-later](LICENSE) copyrighted 2025 by Jean Viscogliosi-Pate.
- All other portions of MetamorPOV are licensed under [GPL-3.0-or-later](LICENSE), copyrighted 20242025 by Jean Viscogliosi-Pate.

View File

@ -2,14 +2,18 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=",
"path": "/nix/store/yw6kg4rb9v8s3ypjbpspig5r81m4lr5s-source",
"type": "path"
"lastModified": 1755175540,
"narHash": "sha256-V0j2S1r25QnbqBLzN2Rg/dKKil789bI3P3id7bDPVc4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a595dde4d0d31606e19dcec73db02279db59d201",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {

View File

@ -1,6 +1,6 @@
{
inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
@ -13,7 +13,7 @@
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs_22
pkgs.nodejs_24
pkgs.firefox
pkgs.chromium
];

486
package-lock.json generated
View File

@ -1,44 +1,54 @@
{
"name": "metamorpov",
"version": "1.2.0",
"version": "2.0.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "metamorpov",
"version": "1.2.0",
"version": "2.0.2",
"license": "GPL-3.0-or-later",
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "15.3.0",
"english-verbs-gerunds": "3.3.1",
"english-verbs-helper": "3.3.1",
"english-verbs-irregular": "3.3.1",
"metamorpov": "^1.0.2",
"rollup": "^4.27.3",
"web-ext": "^8.3.0",
"web-ext": "^8.9.0",
"webextension-polyfill": "^0.12.0"
}
},
"../Library": {
"name": "metamorpov",
"version": "1.0.2",
"dev": true,
"license": "GPL-3.0-or-later",
"dependencies": {
"english-verbs-gerunds": "^3.4.0",
"english-verbs-helper": "^3.4.0",
"english-verbs-irregular": "^3.4.0",
"indefinite": "^2.5.1"
}
},
"node_modules/@babel/code-frame": {
"version": "7.26.2",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
"integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
"integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/helper-validator-identifier": "^7.25.9",
"@babel/helper-validator-identifier": "^7.27.1",
"js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
"picocolors": "^1.1.1"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "7.25.9",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
"integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
"dev": true,
"license": "MIT",
"engines": {
@ -308,9 +318,9 @@
"license": "MIT"
},
"node_modules/@mdn/browser-compat-data": {
"version": "6.0.23",
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-6.0.23.tgz",
"integrity": "sha512-LdoI2lPd0bHn3IL4kJ2hxmh4kLE59GarffTR2oqllXc/LIWJNolznUk2lmzUxfColwM07Q3PbN38+ZqHdzmf3A==",
"version": "6.0.32",
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-6.0.32.tgz",
"integrity": "sha512-XXZ0RbkrIw8mr71WbVYmtZk+zWYutS71+/8/E+gyPE3yt/ZNiW4UU5/NcrpgLO4NfIB+VBuWhPzSN6Pb1VxAWA==",
"dev": true,
"license": "CC0-1.0"
},
@ -774,13 +784,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.0.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.4.tgz",
"integrity": "sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA==",
"version": "24.2.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz",
"integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.8.0"
"undici-types": "~7.10.0"
}
},
"node_modules/@types/resolve": {
@ -807,19 +817,6 @@
"dev": true,
"license": "ISC"
},
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"dev": true,
"license": "MIT",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/acorn": {
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
@ -844,15 +841,15 @@
}
},
"node_modules/addons-linter": {
"version": "7.15.0",
"resolved": "https://registry.npmjs.org/addons-linter/-/addons-linter-7.15.0.tgz",
"integrity": "sha512-Q8obxw1vrud4jcbLP4VWhJL5JS/JrC2ohZVh3NqJ98byPs71Hw+2Yq4Lqt+OpMov60uSS7BC1mdy3LloQ2KlYA==",
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/addons-linter/-/addons-linter-7.18.0.tgz",
"integrity": "sha512-XJ2FiBjwuprKaFte/5KEOPgym3OuBJw1sutUipeYtQ8q2StVzXqwKY+Fwp0wciDlFkmiQmxP9AMeDiKrc0MdRw==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"@fluent/syntax": "0.19.0",
"@fregante/relaxed-json": "2.0.0",
"@mdn/browser-compat-data": "6.0.23",
"@mdn/browser-compat-data": "6.0.32",
"addons-moz-compare": "1.3.0",
"addons-scanner-utils": "9.13.0",
"ajv": "8.17.1",
@ -869,7 +866,7 @@
"fast-json-patch": "3.1.1",
"image-size": "2.0.2",
"json-merge-patch": "1.0.2",
"pino": "8.20.0",
"pino": "9.7.0",
"semver": "7.7.2",
"source-map-support": "0.5.21",
"upath": "2.0.1",
@ -883,122 +880,6 @@
"node": ">=18.0.0"
}
},
"node_modules/addons-linter/node_modules/pino": {
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/pino/-/pino-8.20.0.tgz",
"integrity": "sha512-uhIfMj5TVp+WynVASaVEJFTncTUe4dHBq6CWplu/vBgvGHhvBvQfxz+vcOrnnBQdORH3izaGEurLfNlq3YxdFQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"atomic-sleep": "^1.0.0",
"fast-redact": "^3.1.1",
"on-exit-leak-free": "^2.1.0",
"pino-abstract-transport": "^1.1.0",
"pino-std-serializers": "^6.0.0",
"process-warning": "^3.0.0",
"quick-format-unescaped": "^4.0.3",
"real-require": "^0.2.0",
"safe-stable-stringify": "^2.3.1",
"sonic-boom": "^3.7.0",
"thread-stream": "^2.0.0"
},
"bin": {
"pino": "bin.js"
}
},
"node_modules/addons-linter/node_modules/pino-abstract-transport": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-1.2.0.tgz",
"integrity": "sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"readable-stream": "^4.0.0",
"split2": "^4.0.0"
}
},
"node_modules/addons-linter/node_modules/pino-std-serializers": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz",
"integrity": "sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==",
"dev": true,
"license": "MIT"
},
"node_modules/addons-linter/node_modules/process-warning": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-3.0.0.tgz",
"integrity": "sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==",
"dev": true,
"license": "MIT"
},
"node_modules/addons-linter/node_modules/readable-stream": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
"integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
"dev": true,
"license": "MIT",
"dependencies": {
"abort-controller": "^3.0.0",
"buffer": "^6.0.3",
"events": "^3.3.0",
"process": "^0.11.10",
"string_decoder": "^1.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/addons-linter/node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/addons-linter/node_modules/sonic-boom": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.8.1.tgz",
"integrity": "sha512-y4Z8LCDBuum+PBP3lSV7RHrXscqksve/bi0as7mhwVnBW+/wUqKT/2Kb7um8yqcFy0duYbbPxzt89Zy2nOCaxg==",
"dev": true,
"license": "MIT",
"dependencies": {
"atomic-sleep": "^1.0.0"
}
},
"node_modules/addons-linter/node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/addons-linter/node_modules/thread-stream": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-2.7.0.tgz",
"integrity": "sha512-qQiRWsU/wvNolI6tbbCKd9iKaTnCXsTwVxhhKM6nctPdujTyztjlbUkUTUymidWcMnZ5pWR0ej4a0tjsW021vw==",
"dev": true,
"license": "MIT",
"dependencies": {
"real-require": "^0.2.0"
}
},
"node_modules/addons-moz-compare": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/addons-moz-compare/-/addons-moz-compare-1.3.0.tgz",
@ -1052,9 +933,9 @@
}
},
"node_modules/agent-base": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
"integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
"dev": true,
"license": "MIT",
"engines": {
@ -1203,27 +1084,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@ -1262,9 +1122,9 @@
}
},
"node_modules/boxen/node_modules/chalk": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz",
"integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.5.0.tgz",
"integrity": "sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==",
"dev": true,
"license": "MIT",
"engines": {
@ -1275,9 +1135,9 @@
}
},
"node_modules/boxen/node_modules/type-fest": {
"version": "4.33.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.33.0.tgz",
"integrity": "sha512-s6zVrxuyKbbAsSAD5ZPTB77q4YIdRctkTbJ2/Dqlinwz+8ooH2gd+YA7VA6Pa93KML9GockVvoxjZ2vHP+mu8g==",
"version": "4.41.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz",
"integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
"dev": true,
"license": "(MIT OR CC0-1.0)",
"engines": {
@ -1298,31 +1158,6 @@
"concat-map": "0.0.1"
}
},
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@ -1677,9 +1512,9 @@
}
},
"node_modules/css-select": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
"integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==",
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",
"integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
@ -1694,9 +1529,9 @@
}
},
"node_modules/css-what": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
"integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",
"integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
@ -1916,9 +1751,9 @@
}
},
"node_modules/dot-prop/node_modules/type-fest": {
"version": "4.33.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.33.0.tgz",
"integrity": "sha512-s6zVrxuyKbbAsSAD5ZPTB77q4YIdRctkTbJ2/Dqlinwz+8ooH2gd+YA7VA6Pa93KML9GockVvoxjZ2vHP+mu8g==",
"version": "4.41.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz",
"integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
"dev": true,
"license": "(MIT OR CC0-1.0)",
"engines": {
@ -1935,31 +1770,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/english-verbs-gerunds": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/english-verbs-gerunds/-/english-verbs-gerunds-3.3.1.tgz",
"integrity": "sha512-j1lltTeuvPwgwa/ROAjT/1B1RBA8724uJ2tCjGyRqn87VGAU/YKtYO/camMB1G/WaHT3j5iI3cmdVoPj5H3K2w==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/english-verbs-helper": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/english-verbs-helper/-/english-verbs-helper-3.3.1.tgz",
"integrity": "sha512-8mFnB6Z5W44aX20MTA9Wu7Fqad3KkykFcpLAcD3I930J1mIlqmsJhS81Qs8b23QCg2Aq1QfN9t0Xa2hsENFWgQ==",
"dev": true,
"license": "Apache-2.0",
"funding": {
"type": "patreon",
"url": "https://www.patreon.com/ludan"
}
},
"node_modules/english-verbs-irregular": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/english-verbs-irregular/-/english-verbs-irregular-3.3.1.tgz",
"integrity": "sha512-Ji6a/4QbXKryxLD/yw+tp6xz7kCOcHOdaDcesEyFYHQxUNRnWbLWybXAYnoLn3VHC0AxXbQonZwO6Bw7JvoaVA==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
@ -2263,26 +2073,6 @@
"node": ">=0.10.0"
}
},
"node_modules/event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.x"
}
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@ -2456,9 +2246,9 @@
"license": "ISC"
},
"node_modules/fs-extra": {
"version": "11.3.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
"integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==",
"version": "11.3.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.1.tgz",
"integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -2746,27 +2536,6 @@
"node": ">= 14"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@ -3174,9 +2943,9 @@
"license": "MIT"
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz",
"integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -3210,9 +2979,9 @@
}
},
"node_modules/ky": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/ky/-/ky-1.7.4.tgz",
"integrity": "sha512-zYEr/gh7uLW2l4su11bmQ2M9xLgQLjyvx58UyNM/6nuqyWFHPX5ktMjvpev3F8QWdjSsHUpnWew4PBCswBNuMQ==",
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/ky/-/ky-1.8.2.tgz",
"integrity": "sha512-XybQJ3d4Ea1kI27DoelE5ZCT3bSJlibYTtQuMsyzKox3TMyayw1asgQdl54WroAm+fIA3ZCr8zXW2RpR7qWVpA==",
"dev": true,
"license": "MIT",
"engines": {
@ -3263,33 +3032,34 @@
}
},
"node_modules/lighthouse-logger": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-2.0.1.tgz",
"integrity": "sha512-ioBrW3s2i97noEmnXxmUq7cjIcVRjT5HBpAYy8zE11CxU9HqlWHHeRxfeN1tn8F7OEMVPIC9x1f8t3Z7US9ehQ==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-2.0.2.tgz",
"integrity": "sha512-vWl2+u5jgOQuZR55Z1WM0XDdrJT6mzMP8zHUct7xTlWhuQs+eV0g+QL0RQdFjT54zVmbhLCP8vIVpy1wGn/gCg==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"debug": "^2.6.9",
"debug": "^4.4.1",
"marky": "^1.2.2"
}
},
"node_modules/lighthouse-logger/node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/lighthouse-logger/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
"dev": true,
"license": "MIT"
},
"node_modules/lines-and-columns": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz",
@ -3347,6 +3117,10 @@
"dev": true,
"license": "Apache-2.0"
},
"node_modules/metamorpov": {
"resolved": "../Library",
"link": true
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@ -3462,16 +3236,16 @@
}
},
"node_modules/open": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/open/-/open-10.1.2.tgz",
"integrity": "sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==",
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz",
"integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==",
"dev": true,
"license": "MIT",
"dependencies": {
"default-browser": "^5.2.1",
"define-lazy-prop": "^3.0.0",
"is-inside-container": "^1.0.0",
"is-wsl": "^3.1.0"
"wsl-utils": "^0.1.0"
},
"engines": {
"node": ">=18"
@ -3480,22 +3254,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open/node_modules/is-wsl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
"integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-inside-container": "^1.0.0"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/optionator": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
@ -3781,16 +3539,6 @@
"node": ">= 0.8.0"
}
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@ -3949,9 +3697,9 @@
}
},
"node_modules/registry-auth-token": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.3.tgz",
"integrity": "sha512-1bpc9IyC+e+CNFRaWyn77tk4xGG4PPUyfakSmA6F6cvUDjrm58dfyJ3II+9yb10EDkHoy1LaPSmHaWLOH3m6HA==",
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.0.tgz",
"integrity": "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -4502,9 +4250,9 @@
"license": "MIT"
},
"node_modules/undici-types": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
"dev": true,
"license": "MIT"
},
@ -4555,9 +4303,9 @@
}
},
"node_modules/update-notifier/node_modules/chalk": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz",
"integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.5.0.tgz",
"integrity": "sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==",
"dev": true,
"license": "MIT",
"engines": {
@ -4619,15 +4367,15 @@
}
},
"node_modules/web-ext": {
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/web-ext/-/web-ext-8.8.0.tgz",
"integrity": "sha512-8ecasYMN3zsGUq5ZT73cRrwffDffGC7jnaKKXnZFDSEArWqCf/GNc6/IkvKLDStUocB3CSW5hGffAUHKKi1VrA==",
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/web-ext/-/web-ext-8.9.0.tgz",
"integrity": "sha512-X2IeYfWSf7c/Tireuv48FRfgHougaINBWwwMoYOd9xcXbQGrYXK3IALZZf0cbPpq4AidNxNO8HTKw3SUeWvJgw==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"@babel/runtime": "7.27.6",
"@devicefarmer/adbkit": "3.3.8",
"addons-linter": "7.15.0",
"addons-linter": "7.18.0",
"camelcase": "8.0.0",
"chrome-launcher": "1.2.0",
"debounce": "1.2.1",
@ -4640,7 +4388,7 @@
"jszip": "3.10.1",
"multimatch": "6.0.0",
"node-notifier": "10.0.1",
"open": "10.1.2",
"open": "10.2.0",
"parse-json": "7.1.1",
"pino": "9.7.0",
"promise-toolbox": "0.21.0",
@ -4798,6 +4546,38 @@
"dev": true,
"license": "ISC"
},
"node_modules/wsl-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz",
"integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-wsl": "^3.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/wsl-utils/node_modules/is-wsl": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
"integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-inside-container": "^1.0.0"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/xdg-basedir": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-5.1.0.tgz",

View File

@ -1,8 +1,8 @@
{
"name": "metamorpov",
"title": "MetamorPOV",
"version": "1.2.0",
"description": "Enables customization of reader-insert stories by replacing author-provided hooks such as Y/n, pov/s, and vrb/do/present/.",
"version": "2.0.3",
"description": "Enables customization of reader-insert stories by translating specific markers such as Y/n, pov/s, and vrb/present/do/.",
"type": "module",
"repository": {
"type": "git",
@ -14,17 +14,15 @@
"test": "cp src/manifest-firefox.json src/manifest.json && npx rollup -c && npx web-ext run -s src && rm src/manifest.json",
"test-chrome": "cp src/manifest-chrome.json src/manifest.json && npx rollup -c && chromium && rm src/manifest.json",
"build": "cp src/manifest-firefox.json src/manifest.json && npx rollup -c && npx web-ext build -s src -a dist --ignore-files replace-words.js save-load-options.js manifest-* service-worker* -n {name}-{version}.xpi -o && rm src/manifest.json",
"build-chrome": "cp src/manifest-chrome.json src/manifest.json && npx rollup -c && npx web-ext build -s src -a dist --ignore-files replace-words.js save-load-options.js manifest-* background.js -n {name}-{version}-chrome.zip -o && rm src/manifest.json"
"build-chrome": "cp src/manifest-chrome.json src/manifest.json && npx rollup -c && npx web-ext build -s src -a dist --ignore-files replace-words.js save-load-options.js manifest-* background.js -n {name}-{version}.zip -o && rm src/manifest.json"
},
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "15.3.0",
"english-verbs-gerunds": "3.3.1",
"english-verbs-helper": "3.3.1",
"english-verbs-irregular": "3.3.1",
"metamorpov": "^1.0.2",
"rollup": "^4.27.3",
"web-ext": "^8.3.0",
"web-ext": "^8.9.0",
"webextension-polyfill": "^0.12.0"
}
}

View File

@ -2,9 +2,9 @@
"manifest_version": 3,
"name": "MetamorPOV",
"author": "Jean Viscogliosi-Pate",
"version": "1.3.0",
"version": "2.0.3",
"description": "Enables customization of reader-insert stories by replacing author-provided hooks such as Y/n, pov/s, and vrb/do/present/.",
"description": "Enables customization of reader-insert stories by translating specific markers such as Y/n, pov/s, and vrb/present/do/.",
"action": {
"default_title": "MetamorPOV",

View File

@ -2,9 +2,9 @@
"manifest_version": 3,
"name": "MetamorPOV",
"author": "Jean Viscogliosi-Pate",
"version": "1.3.0",
"version": "2.0.3",
"description": "Enables customization of reader-insert stories by replacing author-provided hooks such as Y/n, pov/s, and vrb/do/present/.",
"description": "Enables customization of reader-insert stories by translating specific markers such as Y/n, pov/s, and vrb/present/do/.",
"browser_specific_settings": {
"gecko": {

View File

@ -1,472 +1,16 @@
var browser = require("webextension-polyfill");
const verbsHelper = require("english-verbs-helper");
const verbsIrregular = require("english-verbs-irregular/dist/verbs.json");
const verbsGerunds = require("english-verbs-gerunds/dist/gerunds.json");
const verbsData = verbsHelper.mergeVerbsData(verbsIrregular, verbsGerunds);
const metamorpov = require("metamorpov");
/* Replaces verbs, point-of-view, name, pronouns, and "also" terms */
function replaceAll() {
/* Uses MetamorPOV to translate page text */
function translate() {
let options = browser.storage.local.get();
options.then((options) => {
const hostname = window.location.hostname;
const isEnabled = !(options.domains === undefined) && options.domains.includes(hostname);
if (!isEnabled) { return; }
const isNameSet = !(options.name === undefined || options.name == "");
const isPronounsSet = !(options.preset === undefined || options.preset == "");
const isPovSet = !(options.pov === undefined || options.pov == "");
const isPovLegal = isPovSet && (options.pov != "third" || (isNameSet && isPronounsSet));
const isAllSet = isNameSet && isPronounsSet && isPovLegal;
if (isPovLegal) {
replaceVerbs(options);
replacePov(options);
replacePlv(options);
}
if (isNameSet) {
replaceName(options);
}
if (isPronounsSet) {
replacePronouns(options);
}
const isAlsoSet = !(options.also === undefined);
if (isAlsoSet) {
replaceAlso(options);
}
if (isAllSet) {
replaceExceptions(options);
replaceCuts();
replaceCapitals();
replaceMirror();
}
metamorpov.translate(document.body, options);
});
}
/* Replaces all instances of "Y/n" with the user's name */
function replaceName(options) {
const searchTerm = /\by\/n\b|\(y\/n\)|\[y\/n\]/ig;
walk(document.body, searchTerm, options["name"], directMethod);
}
/* Replaces all verb keys */
function replaceVerbs(options) {
const searchTerm = /(v)r([nb])\/([\w\s]+)\/(?:((?:(?:simple|progressive|perfect|perfect[ _]progressive|participle(?![ _]future))[ _])*(?:past|present|future))\/)*/i;
walk(document.body, searchTerm, options, verbMethod);
}
/* Replaces all pronoun keys */
/* This could be made faster if I give premade regexp expressions for each, but I don't want to do that! */
function replacePronouns(options) {
let pronouns = getPronouns(options.preset, options.other);
walk(document.body, /([Pp])rn\/s/, pronouns["subjective"], pronounMethod);
walk(document.body, /([Pp])rn\/o/, pronouns["objective"], pronounMethod);
walk(document.body, /([Pp])rn\/p/, pronouns["possessive"], pronounMethod);
walk(document.body, /([Pp])rn\/a/, pronouns["adjective"], pronounMethod);
walk(document.body, /([Pp])rn\/r/, pronouns["reflexive"], pronounMethod);
walk(document.body, /([Pp])rn\/H/, pronouns["honorific-abbr"], pronounMethod);
walk(document.body, /([Pp])rn\/h/, pronouns["honorific"], pronounMethod);
walk(document.body, /([Pp])rn\/N/, pronouns["adult"], pronounMethod);
walk(document.body, /([Pp])rn\/n/, pronouns["youth"], pronounMethod);
walk(document.body, /([Pp])rn\/F/, pronouns["parent"], pronounMethod);
walk(document.body, /([Pp])rn\/f/, pronouns["child"], pronounMethod);
walk(document.body, /([Pp])rn\/k/, pronouns["sibling"], pronounMethod);
walk(document.body, /([Pp])rn\/m/, pronouns["married"], pronounMethod);
walk(document.body, /([Pp])rn\/d/, pronouns["dating"], pronounMethod);
}
/* Gets pronouns based on the provided key (or user input) */
function getPronouns(key, other) {
switch (key) {
case "she":
return {
"subjective": "she",
"objective": "her",
"possessive": "her",
"adjective": "hers",
"reflexive": "herself",
"honorific-abbr": "Ms.",
"honorific": "miss",
"adult": "woman",
"youth": "girl",
"parent": "mother",
"child": "daughter",
"sibling": "sister",
"married": "wife",
"dating": "girlfriend",
"plurality": "singular"
};
case "he":
return {
"subjective": "he",
"objective": "him",
"possessive": "his",
"adjective": "his",
"reflexive": "himself",
"honorific-abbr": "Mr.",
"honorific": "mister",
"adult": "man",
"youth": "boy",
"parent": "father",
"child": "son",
"sibling": "brother",
"married": "husband",
"dating": "boyfriend",
"plurality": "singular"
};
case "they":
return {
"subjective": "they",
"objective": "them",
"possessive": "their",
"adjective": "theirs",
"reflexive": "themself",
"honorific-abbr": "Mx.",
"honorific": "mix",
"adult": "person",
"youth": "kid",
"parent": "parent",
"child": "child",
"sibling": "sibling",
"married": "spouse",
"dating": "partner",
"plurality": "plural"
};
case "first":
return {
"subjective": "I",
"objective": "me",
"possessive": "my",
"adjective": "mine",
"reflexive": "myself"
};
case "second":
return {
"subjective": "you",
"objective": "you",
"possessive": "your",
"adjective": "yours",
"reflexive": "yourself"
};
case "first-plural":
return {
"subjective": "we",
"objective": "us",
"possessive": "our",
"adjective": "ours",
"reflexive": "ourselves"
};
case "second-plural":
return {
"subjective": "you",
"objective": "you",
"possessive": "your",
"adjective": "yours",
"reflexive": "yourselves"
};
case "third-plural":
return {
"subjective": "they",
"objective": "them",
"possessive": "their",
"adjective": "theirs",
"reflexive": "themselves"
};
case "other":
return other;
}
}
/* Replaces all point-of-view keys */
function replacePov(options) {
let pronouns;
if (options.pov == "third") {
pronouns = getPronouns(options.preset, options.other);
walk(document.body, /([Pp])ov\/S/, options.name, pronounMethod);
walk(document.body, /([Pp])ov\/O/, options.name, pronounMethod);
walk(document.body, /([Pp])ov\/P/, options.name + "s", pronounMethod);
walk(document.body, /([Pp])ov\/A/, options.name + "s", pronounMethod);
walk(document.body, /([Pp])ov\/R/, options.name + "s self", pronounMethod);
} else {
pronouns = getPronouns(options.pov, null);
walk(document.body, /([Pp])ov\/S/, pronouns["subjective"], pronounMethod);
walk(document.body, /([Pp])ov\/O/, pronouns["objective"], pronounMethod);
walk(document.body, /([Pp])ov\/P/, pronouns["possessive"], pronounMethod);
walk(document.body, /([Pp])ov\/A/, pronouns["adjective"], pronounMethod);
walk(document.body, /([Pp])ov\/R/, pronouns["reflexive"], pronounMethod);
}
walk(document.body, /([Pp])ov\/s/, pronouns["subjective"], pronounMethod);
walk(document.body, /([Pp])ov\/o/, pronouns["objective"], pronounMethod);
walk(document.body, /([Pp])ov\/p/, pronouns["possessive"], pronounMethod);
walk(document.body, /([Pp])ov\/a/, pronouns["adjective"], pronounMethod);
walk(document.body, /([Pp])ov\/r/, pronouns["reflexive"], pronounMethod);
}
/* Replaces plural point-of-view keys */
function replacePlv(options) {
let pronouns = getPronouns(options.pov + "-plural", null);
walk(document.body, /([Pp])lv\/s/, pronouns["subjective"], pronounMethod);
walk(document.body, /([Pp])lv\/o/, pronouns["objective"], pronounMethod);
walk(document.body, /([Pp])lv\/p/, pronouns["possessive"], pronounMethod);
walk(document.body, /([Pp])lv\/a/, pronouns["adjective"], pronounMethod);
walk(document.body, /([Pp])lv\/r/, pronouns["reflexive"], pronounMethod);
}
/* Replaces additional terms specified by the user */
function replaceAlso(options) {
Object.entries(options.also).forEach(([key, value]) => {
escapeAndReplace(key, value, true);
});
}
/* Replaces exception statements by POV */
function replaceExceptions(options) {
const searchTerm = /exc\/([^\/]*)\/([^\/]*)\/(?:([^\/]*)\/)?/i;
walk(document.body, searchTerm, options, exceptionMethod);
}
/* Replaces cut statements with cuts */
function replaceCuts() {
const searchTerm = /cut\/([^\/]+)\/(off|only) (first|last) ([1-9][0-9]*)\//i;
walk(document.body, searchTerm, null, cutMethod);
}
/* Replaces capital statements statements with requested casing */
function replaceCapitals() {
const searchTerm = /(cap|Cap|CAP)\/([^\/]+)\//i;
walk(document.body, searchTerm, null, capitalMethod);
}
/* Replaces mirror statements with reversed phrases */
function replaceMirror() {
const searchTerm = /mrr\/([^\/]+)\//i;
walk(document.body, searchTerm, null, mirrorMethod);
}
/* Turns a term into regexp format and uses that to replace it */
function escapeAndReplace(searchTerm, replaceValue, caseSensitive) {
let searchTermEscaped = searchTerm.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
const flags = caseSensitive ? "g" : "ig"
if (searchTermEscaped[0].match(/[a-z]/i)) {
searchTermEscaped = `\\b${searchTermEscaped}`
}
if (searchTermEscaped[searchTermEscaped.length - 1].match((/[a-z]/i))) {
searchTermEscaped = `${searchTermEscaped}\\b`
}
const searchTermRegexp = new RegExp(searchTermEscaped, flags)
walk(document.body, searchTermRegexp, replaceValue, directMethod);
}
/* Traverses a node and its children to run the provided replacement method */
function walk(node, searchTerm, replaceValue, replaceMethod) {
if (node.contentEditable == "true" || node.type == "textarea" || node.type == "input") { return; }
let child, next;
switch (node.nodeType) {
case 1: /* ELEMENT_NODE */
case 9: /* DOCUMENT_NODE */
case 11: /* DOCUMENT_FRAGMENT_NODE */
child = node.firstChild;
while (child) {
next = child.nextSibling;
walk(child, searchTerm, replaceValue, replaceMethod);
child = next;
}
break;
case 3: /* TEXT_NODE */
replaceMethod(node, searchTerm, replaceValue);
}
}
/* Replaces every instance of the provided terms */
function directMethod(node, searchTerm, replaceValue) {
node.nodeValue = node.nodeValue.replaceAll(searchTerm, replaceValue);
}
/* Replaces all pronouns */
function pronounMethod(node, searchTerm, pronoun) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
const isCapital = /P/.test(match[1]);
let replaceValue = pronoun;
if (isCapital) {
replaceValue = capitalize(replaceValue);
}
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
pronounMethod(node, searchTerm, pronoun);
}
/* Replaces all verbs, not used for third-person plural */
function verbMethod(node, searchTerm, options) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
const isCapital = /V/.test(match[1]);
const category = match[2];
const verb = match[3];
let tense = match[4];
if (tense == null) {
tense = "PAST";
} else {
tense = tense.toUpperCase().replaceAll(" ", "_");
}
let povIndex;
switch (category) {
case "B": /* B and b vary by POV, capitalized to indicate a named subject */
if (options.pov == "third") {
povIndex = getPovIndex("third-singular", null);
} else {
povIndex = getPovIndex(options.pov, options);
}
break;
case "b":
povIndex = getPovIndex(options.pov, options);
break;
case "N": /* N and n are always third-person */
povIndex = getPovIndex("third-singular", null);
break;
case "n":
povIndex = getPovIndex("third", options);
}
let replaceValue = verbsHelper.getConjugation(verbsData, verb, tense, povIndex);
if (isCapital) {
replaceValue = capitalize(replaceValue);
}
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
verbMethod(node, searchTerm, options);
}
/* Allows for first, second, and third-person POV to read differently */
function exceptionMethod(node, searchTerm, options) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
let replaceValue;
const isFirstSecondSame = match[3] == null;
if (isFirstSecondSame) {
if (options.pov == "third") {
replaceValue = match[2];
} else {
replaceValue = match[1];
}
} else {
if (options.pov == "third") {
replaceValue = match[3];
} else if (options.pov == "second") {
replaceValue = match[2];
} else {
replaceValue = match[1];
}
}
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
exceptionMethod(node, searchTerm, options);
}
/* Allows for custom words to be truncated */
function cutMethod(node, searchTerm, unused) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
const target = match[1];
const length = target.length
const isOnly = match[2] == "only";
const isFirst = match[3] == "first";
const index = Number(match[4]);
let start, end;
if (isOnly) {
if (isFirst) { // only first n
start = 0;
end = Math.min(index, length - 1);
} else { // only last n
start = Math.max(length - index, 1);
end = length;
}
} else {
if (isFirst) { // off first n
start = Math.min(index, length - 1);;
end = length;
} else { // off last n
start = 0;
end = Math.max(length - index, 1);
}
}
const replaceValue = target.slice(start, end);
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
cutMethod(node, searchTerm, unused);
}
/* Allows for custom words to be capitalized */
function capitalMethod(node, searchTerm, unused) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
const style = match[1];
const target = match[2];
const isLowerCase = /c/.test(style.slice(0,1)); // cap
let replaceValue;
if (isLowerCase) {
replaceValue = target.toLowerCase();
} else {
const isStartCase = /a/.test(style.slice(1,2)); // Cap
if (isStartCase) {
replaceValue = capitalize(target);
} else { // CAP
replaceValue = target.toUpperCase();
}
}
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
capitalMethod(node, searchTerm, unused);
}
/* Allows for custom words to be mirrored */
function mirrorMethod(node, searchTerm, unused) {
const match = node.nodeValue.match(searchTerm);
if (match == null) { return; }
const target = match[1];
let replaceValue = target.split('').reverse().join('');
node.nodeValue = node.nodeValue.replace(searchTerm, replaceValue);
mirrorMethod(node, searchTerm, unused);
}
/* Returns the input word, capitalized */
function capitalize(word) {
return word.charAt(0).toUpperCase() + word.slice(1);
}
/* Determines the index for point-of-view to be used when conjugating verbs */
function getPovIndex(pov, options) {
switch (pov) {
case "first":
return 0;
case "second":
return 1;
case "third-singular":
return 2;
case "third":
if (getPronouns(options.preset, options.other).plurality == "singular") {
return 2;
} else { /* Plurality is plural, "they go" */
return 5;
}
return getThirdIndex(options);
}
}
replaceAll();
translate();

View File

@ -1,205 +0,0 @@
Copyright 2019 Ludan Stoecklé
Copyright 2015 Forbes Lindesay
Copyright 2009-2014 TJ Holowaychuk <tj@vision-media.ca>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.