Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
0a906d8432 | |
|
eb660f3a3d | |
|
1c022e5180 | |
|
cb1302c6f6 | |
|
30f76620c2 | |
|
167da7c263 |
|
@ -1,3 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
src/content-script.js
|
src/content-script.js
|
||||||
|
src/popup.js
|
||||||
dist
|
dist
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
"english-verbs-helper": "3.3.1",
|
"english-verbs-helper": "3.3.1",
|
||||||
"english-verbs-irregular": "3.3.1",
|
"english-verbs-irregular": "3.3.1",
|
||||||
"rollup": "^4.27.3",
|
"rollup": "^4.27.3",
|
||||||
"web-ext": "^8.3.0"
|
"web-ext": "^8.3.0",
|
||||||
|
"webextension-polyfill": "^0.12.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
|
@ -5277,6 +5278,13 @@
|
||||||
"npm": ">=8.0.0"
|
"npm": ">=8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webextension-polyfill": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.12.0.tgz",
|
||||||
|
"integrity": "sha512-97TBmpoWJEE+3nFBQ4VocyCdLKfw54rFaJ6EVQYLBCXqCIpLSZkwGgASpv4oPt9gdKCJ80RJlcmNzNn008Ag6Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0"
|
||||||
|
},
|
||||||
"node_modules/when": {
|
"node_modules/when": {
|
||||||
"version": "3.7.7",
|
"version": "3.7.7",
|
||||||
"resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz",
|
"resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "metamorpov",
|
"name": "metamorpov",
|
||||||
"title": "MetamorPOV",
|
"title": "MetamorPOV",
|
||||||
"version": "0.1.0",
|
"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/.",
|
"description": "Enables customization of reader-insert stories by replacing author-provided hooks such as Y/n, pov/s, and vrb/do/present/.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -12,16 +12,17 @@
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npx rollup -c && npx web-ext run -s src",
|
"test": "npx rollup -c && npx web-ext run -s src",
|
||||||
"build": "npx rollup -c && npx web-ext build -s src -a dist --ignore-files replace-words.js -o"
|
"build": "npx rollup -c && npx web-ext build -s src -a dist --ignore-files replace-words.js save-load-options.js icons/metamorpov.svg icons/svg-to-png.sh -o"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "28.0.2",
|
"@rollup/plugin-commonjs": "28.0.2",
|
||||||
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
"@rollup/plugin-node-resolve": "15.3.0",
|
"@rollup/plugin-node-resolve": "15.3.0",
|
||||||
"english-verbs-gerunds": "3.3.1",
|
"english-verbs-gerunds": "3.3.1",
|
||||||
"english-verbs-helper": "3.3.1",
|
"english-verbs-helper": "3.3.1",
|
||||||
"english-verbs-irregular": "3.3.1",
|
"english-verbs-irregular": "3.3.1",
|
||||||
"rollup": "^4.27.3",
|
"rollup": "^4.27.3",
|
||||||
"web-ext": "^8.3.0",
|
"web-ext": "^8.3.0",
|
||||||
"@rollup/plugin-json": "^6.1.0"
|
"webextension-polyfill": "^0.12.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,24 @@ import resolve from '@rollup/plugin-node-resolve';
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import json from '@rollup/plugin-json';
|
import json from '@rollup/plugin-json';
|
||||||
|
|
||||||
export default {
|
export default [
|
||||||
input: 'src/replace-words.js',
|
{
|
||||||
output: {
|
input: 'src/save-load-options.js',
|
||||||
file: 'src/content-script.js',
|
output: {
|
||||||
format: 'iife',
|
file: 'src/popup.js',
|
||||||
name: 'contentScript'
|
format: 'iife',
|
||||||
|
name: 'popup'
|
||||||
|
},
|
||||||
|
plugins: [resolve(), commonjs(), json()]
|
||||||
},
|
},
|
||||||
plugins: [resolve(), commonjs(), json()]
|
|
||||||
};
|
{
|
||||||
|
input: 'src/replace-words.js',
|
||||||
|
output: {
|
||||||
|
file: 'src/content-script.js',
|
||||||
|
format: 'iife',
|
||||||
|
name: 'contentScript'
|
||||||
|
},
|
||||||
|
plugins: [resolve(), commonjs(), json()]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
Binary file not shown.
After ![]() (image error) Size: 15 KiB |
Binary file not shown.
After ![]() (image error) Size: 1022 B |
Binary file not shown.
After ![]() (image error) Size: 2.7 KiB |
Binary file not shown.
After ![]() (image error) Size: 4.6 KiB |
Binary file not shown.
After ![]() (image error) Size: 6.8 KiB |
Binary file not shown.
After ![]() (image error) Size: 11 KiB |
Before (image error) Size: 6.6 KiB After (image error) Size: 6.6 KiB |
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p inkscape
|
||||||
|
# Uses Inkscape to generate .png files from the provided input
|
||||||
|
|
||||||
|
inkscape -o 16x.png -w 16 $1
|
||||||
|
inkscape -o 32x.png -w 32 $1
|
||||||
|
inkscape -o 48x.png -w 48 $1
|
||||||
|
inkscape -o 64x.png -w 64 $1
|
||||||
|
inkscape -o 96x.png -w 96 $1
|
||||||
|
inkscape -o 128x.png -w 128 $1
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 3,
|
||||||
"name": "MetamorPOV",
|
"name": "MetamorPOV",
|
||||||
"author": "Jean Viscogliosi-Pate",
|
"author": "Jean Viscogliosi-Pate",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"license": "GPL-3.0-or-later",
|
|
||||||
|
|
||||||
"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 replacing author-provided hooks such as Y/n, pov/s, and vrb/do/present/.",
|
||||||
|
|
||||||
|
@ -15,15 +14,15 @@
|
||||||
"gecko_android": {}
|
"gecko_android": {}
|
||||||
},
|
},
|
||||||
|
|
||||||
"browser_action": {
|
"action": {
|
||||||
"default_title": "MetamorPOV",
|
"default_title": "MetamorPOV",
|
||||||
"default_icon": {
|
"default_icon": {
|
||||||
"16": "metamorpov.svg",
|
"16": "icons/16x.png",
|
||||||
"32": "metamorpov.svg",
|
"32": "icons/32x.png",
|
||||||
"48": "metamorpov.svg",
|
"48": "icons/48x.png",
|
||||||
"64": "metamorpov.svg",
|
"64": "icons/64x.png",
|
||||||
"96": "metamorpov.svg",
|
"96": "icons/96x.png",
|
||||||
"128": "metamorpov.svg"
|
"128": "icons/128x.png"
|
||||||
},
|
},
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
},
|
},
|
||||||
|
@ -33,13 +32,18 @@
|
||||||
"tabs"
|
"tabs"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"host_permissions": [
|
||||||
|
"http://*/*",
|
||||||
|
"https://*/*"
|
||||||
|
],
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "metamorpov.svg",
|
"16": "icons/16x.png",
|
||||||
"32": "metamorpov.svg",
|
"32": "icons/32x.png",
|
||||||
"48": "metamorpov.svg",
|
"48": "icons/48x.png",
|
||||||
"64": "metamorpov.svg",
|
"64": "icons/64x.png",
|
||||||
"96": "metamorpov.svg",
|
"96": "icons/96x.png",
|
||||||
"128": "metamorpov.svg"
|
"128": "icons/128x.png"
|
||||||
},
|
},
|
||||||
|
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
|
@ -54,9 +58,5 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"background": {
|
|
||||||
"page": "popup.html"
|
|
||||||
},
|
|
||||||
|
|
||||||
"homepage_url": "https://git.viscogliosi-pate.com/jean/metamorpov"
|
"homepage_url": "https://git.viscogliosi-pate.com/jean/metamorpov"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
var browser = require("webextension-polyfill");
|
||||||
const verbsHelper = require("english-verbs-helper");
|
const verbsHelper = require("english-verbs-helper");
|
||||||
const verbsIrregular = require("english-verbs-irregular/dist/verbs.json");
|
const verbsIrregular = require("english-verbs-irregular/dist/verbs.json");
|
||||||
const verbsGerunds = require("english-verbs-gerunds/dist/gerunds.json");
|
const verbsGerunds = require("english-verbs-gerunds/dist/gerunds.json");
|
||||||
|
@ -5,7 +6,8 @@ const verbsData = verbsHelper.mergeVerbsData(verbsIrregular, verbsGerunds);
|
||||||
|
|
||||||
/* Replaces verbs, point-of-view, name, pronouns, and "also" terms */
|
/* Replaces verbs, point-of-view, name, pronouns, and "also" terms */
|
||||||
function replaceAll() {
|
function replaceAll() {
|
||||||
browser.storage.local.get(null, (options) => {
|
let options = browser.storage.local.get();
|
||||||
|
options.then((options) => {
|
||||||
const hostname = window.location.hostname;
|
const hostname = window.location.hostname;
|
||||||
const isEnabled = !(options.domains === undefined) && options.domains.includes(hostname);
|
const isEnabled = !(options.domains === undefined) && options.domains.includes(hostname);
|
||||||
if (!isEnabled) { return; }
|
if (!isEnabled) { return; }
|
||||||
|
@ -308,10 +310,13 @@ function verbMethod(node, searchTerm, options) {
|
||||||
} else {
|
} else {
|
||||||
povIndex = getPovIndex(options.pov, options);
|
povIndex = getPovIndex(options.pov, options);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case "b":
|
case "b":
|
||||||
povIndex = getPovIndex(options.pov, options);
|
povIndex = getPovIndex(options.pov, options);
|
||||||
|
break;
|
||||||
case "N": /* N and n are always third-person */
|
case "N": /* N and n are always third-person */
|
||||||
povIndex = getPovIndex("third-singular", null);
|
povIndex = getPovIndex("third-singular", null);
|
||||||
|
break;
|
||||||
case "n":
|
case "n":
|
||||||
povIndex = getPovIndex("third", options);
|
povIndex = getPovIndex("third", options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var browser = require("webextension-polyfill");
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", init);
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -14,14 +16,15 @@ function init() {
|
||||||
function loadDomain() {
|
function loadDomain() {
|
||||||
let tabs = browser.tabs.query({ active: true, currentWindow: true });
|
let tabs = browser.tabs.query({ active: true, currentWindow: true });
|
||||||
tabs.then((tabs) => {
|
tabs.then((tabs) => {
|
||||||
const hostname = new URL(tabs[0].url).hostname;
|
const url = new URL(tabs[0].url);
|
||||||
document.querySelector("#domain").textContent = hostname;
|
const isAllowedProtocol = url.protocol == "https:" || url.protocol == "http:";
|
||||||
|
|
||||||
if (!hostname) {
|
if (!isAllowedProtocol) {
|
||||||
disableToggle();
|
disableToggle();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.querySelector("#domain").textContent = url.hostname;
|
||||||
let storage = browser.storage.local.get("domains");
|
let storage = browser.storage.local.get("domains");
|
||||||
storage.then((storage) => {
|
storage.then((storage) => {
|
||||||
const hostname = document.querySelector("#domain").innerHTML;
|
const hostname = document.querySelector("#domain").innerHTML;
|
||||||
|
@ -252,15 +255,15 @@ async function removeLi() {
|
||||||
also.removeChild(this.parentNode);
|
also.removeChild(this.parentNode);
|
||||||
let list = also.querySelectorAll("li");
|
let list = also.querySelectorAll("li");
|
||||||
list.forEach((li, index) => {
|
list.forEach((li, index) => {
|
||||||
lhs = li.querySelector(".lhs");
|
let lhs = li.querySelector(".lhs");
|
||||||
lhs.id = "lhs-" + index;
|
lhs.id = "lhs-" + index;
|
||||||
lhs.name = lhs.id;
|
lhs.name = lhs.id;
|
||||||
|
|
||||||
rhs = li.querySelector(".rhs");
|
let rhs = li.querySelector(".rhs");
|
||||||
rhs.id = "rhs-" + index;
|
rhs.id = "rhs-" + index;
|
||||||
rhs.name = rhs.id;
|
rhs.name = rhs.id;
|
||||||
|
|
||||||
rhsLabel = li.querySelector("label");
|
let rhsLabel = li.querySelector("label");
|
||||||
rhsLabel.for = rhs.id;
|
rhsLabel.for = rhs.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Reference in New Issue