Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
0a906d8432 | |
|
eb660f3a3d | |
|
1c022e5180 | |
|
cb1302c6f6 | |
|
30f76620c2 | |
|
167da7c263 |
|
@ -1,3 +1,4 @@
|
|||
node_modules
|
||||
src/content-script.js
|
||||
src/popup.js
|
||||
dist
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
"english-verbs-helper": "3.3.1",
|
||||
"english-verbs-irregular": "3.3.1",
|
||||
"rollup": "^4.27.3",
|
||||
"web-ext": "^8.3.0"
|
||||
"web-ext": "^8.3.0",
|
||||
"webextension-polyfill": "^0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
|
@ -5277,6 +5278,13 @@
|
|||
"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": {
|
||||
"version": "3.7.7",
|
||||
"resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "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/.",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
@ -12,16 +12,17 @@
|
|||
"license": "GPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"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": {
|
||||
"@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",
|
||||
"rollup": "^4.27.3",
|
||||
"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 json from '@rollup/plugin-json';
|
||||
|
||||
export default {
|
||||
input: 'src/replace-words.js',
|
||||
output: {
|
||||
file: 'src/content-script.js',
|
||||
format: 'iife',
|
||||
name: 'contentScript'
|
||||
export default [
|
||||
{
|
||||
input: 'src/save-load-options.js',
|
||||
output: {
|
||||
file: 'src/popup.js',
|
||||
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()]
|
||||
}
|
||||
];
|
||||
|
|
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1022 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | 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",
|
||||
"author": "Jean Viscogliosi-Pate",
|
||||
"version": "1.1.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"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/.",
|
||||
|
||||
|
@ -15,15 +14,15 @@
|
|||
"gecko_android": {}
|
||||
},
|
||||
|
||||
"browser_action": {
|
||||
"action": {
|
||||
"default_title": "MetamorPOV",
|
||||
"default_icon": {
|
||||
"16": "metamorpov.svg",
|
||||
"32": "metamorpov.svg",
|
||||
"48": "metamorpov.svg",
|
||||
"64": "metamorpov.svg",
|
||||
"96": "metamorpov.svg",
|
||||
"128": "metamorpov.svg"
|
||||
"16": "icons/16x.png",
|
||||
"32": "icons/32x.png",
|
||||
"48": "icons/48x.png",
|
||||
"64": "icons/64x.png",
|
||||
"96": "icons/96x.png",
|
||||
"128": "icons/128x.png"
|
||||
},
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
|
@ -33,13 +32,18 @@
|
|||
"tabs"
|
||||
],
|
||||
|
||||
"host_permissions": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
|
||||
"icons": {
|
||||
"16": "metamorpov.svg",
|
||||
"32": "metamorpov.svg",
|
||||
"48": "metamorpov.svg",
|
||||
"64": "metamorpov.svg",
|
||||
"96": "metamorpov.svg",
|
||||
"128": "metamorpov.svg"
|
||||
"16": "icons/16x.png",
|
||||
"32": "icons/32x.png",
|
||||
"48": "icons/48x.png",
|
||||
"64": "icons/64x.png",
|
||||
"96": "icons/96x.png",
|
||||
"128": "icons/128x.png"
|
||||
},
|
||||
|
||||
"content_scripts": [
|
||||
|
@ -54,9 +58,5 @@
|
|||
}
|
||||
],
|
||||
|
||||
"background": {
|
||||
"page": "popup.html"
|
||||
},
|
||||
|
||||
"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 verbsIrregular = require("english-verbs-irregular/dist/verbs.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 */
|
||||
function replaceAll() {
|
||||
browser.storage.local.get(null, (options) => {
|
||||
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; }
|
||||
|
@ -308,10 +310,13 @@ function verbMethod(node, searchTerm, options) {
|
|||
} 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);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
var browser = require("webextension-polyfill");
|
||||
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
|
||||
function init() {
|
||||
|
@ -14,14 +16,15 @@ function init() {
|
|||
function loadDomain() {
|
||||
let tabs = browser.tabs.query({ active: true, currentWindow: true });
|
||||
tabs.then((tabs) => {
|
||||
const hostname = new URL(tabs[0].url).hostname;
|
||||
document.querySelector("#domain").textContent = hostname;
|
||||
const url = new URL(tabs[0].url);
|
||||
const isAllowedProtocol = url.protocol == "https:" || url.protocol == "http:";
|
||||
|
||||
if (!hostname) {
|
||||
if (!isAllowedProtocol) {
|
||||
disableToggle();
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelector("#domain").textContent = url.hostname;
|
||||
let storage = browser.storage.local.get("domains");
|
||||
storage.then((storage) => {
|
||||
const hostname = document.querySelector("#domain").innerHTML;
|
||||
|
@ -252,15 +255,15 @@ async function removeLi() {
|
|||
also.removeChild(this.parentNode);
|
||||
let list = also.querySelectorAll("li");
|
||||
list.forEach((li, index) => {
|
||||
lhs = li.querySelector(".lhs");
|
||||
let lhs = li.querySelector(".lhs");
|
||||
lhs.id = "lhs-" + index;
|
||||
lhs.name = lhs.id;
|
||||
|
||||
rhs = li.querySelector(".rhs");
|
||||
let rhs = li.querySelector(".rhs");
|
||||
rhs.id = "rhs-" + index;
|
||||
rhs.name = rhs.id;
|
||||
|
||||
rhsLabel = li.querySelector("label");
|
||||
let rhsLabel = li.querySelector("label");
|
||||
rhsLabel.for = rhs.id;
|
||||
});
|
||||
}
|