icons
This commit is contained in:
parent
3f1fcac663
commit
fec251aea9
13 changed files with 41 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
dist
|
||||
.vscode
|
||||
web-ext-artifacts
|
||||
.amo-upload-uuid
|
2
dist/koboprice.js
vendored
Normal file
2
dist/koboprice.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
dist/koboprice.js.map
vendored
Normal file
7
dist/koboprice.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
icons/16.png
Normal file
BIN
icons/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
icons/32.png
Normal file
BIN
icons/32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
icons/48.png
Normal file
BIN
icons/48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -1,5 +1,5 @@
|
|||
import { bookUrl } from "./bookUrl";
|
||||
import { extractPriceFrom } from "./extractPriceFrom";
|
||||
import { extractPrice } from "./extractPrice";
|
||||
import { getRate } from "./rates";
|
||||
import { convertPrice } from "./convertPrice";
|
||||
import { cacheBookPrice, getBookPrice } from "./cache";
|
||||
|
@ -17,7 +17,7 @@ export const bookPriceFor = async (country) => {
|
|||
return fromCache;
|
||||
}
|
||||
|
||||
const countryPrice = await extractPriceFrom(url);
|
||||
const countryPrice = await extractPrice(url);
|
||||
|
||||
let convertedPrice;
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
export const bookUrl = (country) => {
|
||||
const urlPattern = /^https:\/\/www\.kobo\.com\/../;
|
||||
const newPath = `https://www.kobo.com/${country}`;
|
||||
const url = window.location.href.replace(urlPattern, newPath);
|
||||
|
||||
return window.location.href.replace(urlPattern, newPath);
|
||||
l("url for country", country, url);
|
||||
|
||||
return url;
|
||||
};
|
||||
|
|
|
@ -5,9 +5,9 @@ const observePriceOnPage = (page) =>
|
|||
timeout(10000).then(() => rej("price not found"));
|
||||
|
||||
var observer = new MutationObserver(() => {
|
||||
const price = page.querySelector(
|
||||
const price = page?.querySelector(
|
||||
".primary-right-container .pricing-details .active-price span",
|
||||
).textContent;
|
||||
)?.textContent;
|
||||
|
||||
if (price) {
|
||||
l("found price", price);
|
||||
|
@ -24,7 +24,7 @@ const observePriceOnPage = (page) =>
|
|||
});
|
||||
});
|
||||
|
||||
export const extractPriceFrom = async (url) => {
|
||||
export const extractPrice = async (url) => {
|
||||
try {
|
||||
l("going to", url);
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "Kobo Price",
|
||||
"description": "Find lowest book price on kobo.com",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.4",
|
||||
"manifest_version": 3,
|
||||
"permissions": ["activeTab"],
|
||||
"content_scripts": [
|
||||
{
|
||||
"js": ["dist/index.js"],
|
||||
"js": ["dist/koboprice.js"],
|
||||
"run_at": "document_end",
|
||||
"matches": [
|
||||
"https://www.kobo.com/*/*/ebook/*",
|
||||
|
@ -18,5 +18,12 @@
|
|||
"gecko": {
|
||||
"id": "koboprice@tertyshny.dev"
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"16": "icons/16.png",
|
||||
"32": "icons/32.png",
|
||||
"48": "icons/48.png",
|
||||
"128": "icons/128.png"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "eslint --fix",
|
||||
"build": "esbuild lib/index.js --bundle --minify --sourcemap --target=chrome58,firefox57,safari11 --outfile=dist/index.js",
|
||||
"build": "esbuild lib/index.js --bundle --minify --sourcemap --target=chrome58,firefox57,safari11 --outfile=dist/koboprice.js",
|
||||
"watch-build": "npm run build -- --watch",
|
||||
"watch-ext": "web-ext run --start-url kobo.com",
|
||||
"watch": "concurrently npm:watch-build npm:watch-ext"
|
||||
"watch": "concurrently npm:watch-build npm:watch-ext",
|
||||
"ext-build": "web-ext build"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
|
|
11
userscript/koboprice.user.js
Normal file
11
userscript/koboprice.user.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
// ==UserScript==
|
||||
// @name Kobo Price
|
||||
// @description finds lowest book price on kobo.com
|
||||
// @icon https://github.com/fotonmoton/koboprice/blob/master/icon.png?raw=true
|
||||
// @namespace https://github.com/fotonmoton
|
||||
// @run-at document-end
|
||||
// @noframes
|
||||
// @match https://www.kobo.com/*/*/ebook/*
|
||||
// @match https://www.kobo.com/*/*/audiobook/*
|
||||
// @require ../dist/koboprice.js
|
||||
// ==/UserScript==
|
Loading…
Reference in a new issue