update
This commit is contained in:
parent
54cac427a2
commit
f95922e744
5 changed files with 17 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -173,3 +173,5 @@ dist
|
|||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
|
||||
tweaks_*.zip
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,15 +1,18 @@
|
|||
{
|
||||
"name": "tweaks",
|
||||
"version": "0.1.0",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite"
|
||||
"dev": "vite",
|
||||
"build": "vite build && npm-build-zip --source=dist --destination=."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.8.3",
|
||||
"@types/bun": "latest",
|
||||
"@types/lodash.isequal": "^4.5.8",
|
||||
"@types/webextension-polyfill": "^0.10.7",
|
||||
"npm-build-zip": "^1.0.4",
|
||||
"vite-plugin-web-extension": "^4.1.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import isEqual from "lodash.isequal";
|
||||
import { isPathEqual } from "./utils";
|
||||
|
||||
const REFRESH_RATE = 1000;
|
||||
|
||||
export async function waitForElementToExist(
|
||||
|
@ -49,7 +50,7 @@ export function addPageChangeHandler(func: (path: OsuPath) => void) {
|
|||
hash: location.hash,
|
||||
};
|
||||
|
||||
if (!isEqual(currentPath, newPath)) {
|
||||
if (!isPathEqual(currentPath, newPath)) {
|
||||
func(newPath);
|
||||
currentPath = newPath;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
// Color parsing function
|
||||
|
||||
import type { OsuPath } from "./dom";
|
||||
|
||||
// minified, original is from https://stackoverflow.com/a/68580275
|
||||
export function parseCssColor(str: string): [number, number, number] {
|
||||
const div = document.createElement("div");
|
||||
|
@ -10,3 +13,7 @@ export function parseCssColor(str: string): [number, number, number] {
|
|||
div.remove();
|
||||
return res;
|
||||
}
|
||||
|
||||
export function isPathEqual(a: OsuPath, b: OsuPath) {
|
||||
return a.pathname === b.pathname && a.hash === b.hash;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue