-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
128 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import "/styles/kyomu.css"; | ||
|
||
import { Kyomu } from "../class"; | ||
import LoadGamingWebsite from "../utils/LoadGamingWebsite"; | ||
import LoadGamingWebsite from "../utils/loadGamingWebsite"; | ||
|
||
LoadGamingWebsite(Kyomu); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import "/styles/media.css"; | ||
|
||
import { Media } from "../class"; | ||
import loadGamingWebsite from "../utils/LoadGamingWebsite"; | ||
import loadGamingWebsite from "../utils/loadGamingWebsite"; | ||
|
||
loadGamingWebsite(Media); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import "/styles/mylibrary.css"; | ||
|
||
import { MyLibrary } from "../class"; | ||
import LoadGamingWebsite from "../utils/LoadGamingWebsite"; | ||
import LoadGamingWebsite from "../utils/loadGamingWebsite"; | ||
|
||
LoadGamingWebsite(MyLibrary); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
export type Elements = HTMLElement | NodeListOf<HTMLElement> | string; | ||
|
||
export function addClass(elements: Elements[], classNames: string[]) { | ||
elements.forEach((element) => { | ||
if (typeof element === "string") { | ||
const elements = document.querySelectorAll(element); | ||
elements.forEach((element) => { | ||
//console.log("adding classes to", element); | ||
element.classList.add(...classNames); | ||
}); | ||
} else { | ||
let list: HTMLElement[]; | ||
if (element instanceof HTMLElement) list = [element]; | ||
else list = Array.from(element); | ||
|
||
list.forEach((element) => { | ||
//console.log("adding classes to", element); | ||
element.classList.add(...classNames); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
export function removeClass(elements: Elements[], classNames: string[]) { | ||
elements.forEach((element) => { | ||
if (typeof element === "string") { | ||
const elements = document.querySelectorAll(element); | ||
elements.forEach((element) => { | ||
element.classList.remove(...classNames); | ||
}); | ||
} else { | ||
let list: HTMLElement[]; | ||
if (element instanceof HTMLElement) list = [element]; | ||
else list = Array.from(element); | ||
|
||
list.forEach((element) => { | ||
element.classList.remove(...classNames); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
/* | ||
export function AddRainbowBg(...queries: string[]) { | ||
AddClass(queries, ["rainbow-bg"]); | ||
} | ||
export function AddRainbowBgWithShadow(...queries: string[]) { | ||
AddClass(queries, ["rainbow-bg", "rainbow-bg-shadow"]); | ||
} | ||
export function AddRainbowText(...queries: string[]) { | ||
AddClass(queries, ["rainbow-text"]); | ||
} | ||
export function AddRainbowTextWithShadow(...queries: string[]) { | ||
AddClass(queries, ["rainbow-text", "rainbow-text-shadow"]); | ||
} | ||
export function RemoveRainbowBg(...queries: string[]) { | ||
RemoveClass(queries, ["rainbow-bg"]); | ||
} | ||
export function RemoveRainbowBgWithShadow(...queries: string[]) { | ||
RemoveClass(queries, ["rainbow-bg", "rainbow-bg-shadow"]); | ||
} | ||
export function RemoveRainbowText(...queries: string[]) { | ||
RemoveClass(queries, ["rainbow-text", "rainbow-text-shadow"]); | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function changeQueryInnerHTML(query: string, innerHTML: string) { | ||
const elements = document.querySelectorAll(query); | ||
elements.forEach((element) => { | ||
element.innerHTML = innerHTML; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export default function isTrue(value: any) { | ||
return value === true || value === "true" || value === undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { UnivWebsite } from "../class/UnivWebsite"; | ||
import isTrue from "./isTrue"; | ||
//import RunFuncIfEnabled from "./RunFuncIfEnabled"; | ||
|
||
// ウィンドウが読み込まれたらGundaiWebsiteのEnableRainbowを実行する | ||
export default function loadGamingWebsite(website: UnivWebsite<unknown>) { | ||
window.addEventListener("load", async () => { | ||
const isEnabled = await website.storage.get("enabled"); | ||
if (isTrue(isEnabled)) { | ||
website.enable(); | ||
} else { | ||
website.disable(); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type OpenOptionsArgs = "home" | "about" | "thanks" | undefined; | ||
|
||
export default function openOptions(args: OpenOptionsArgs) { | ||
if (!args || args === "home") return chrome.tabs.create({ url: "options.html" }); | ||
|
||
return chrome.tabs.create({ url: `options.html#/${args}` }); | ||
} |