From f129880276b3e67e09f752d727b6120b7608340d Mon Sep 17 00:00:00 2001 From: hayao Date: Tue, 17 Oct 2023 03:07:38 +0900 Subject: [PATCH] Update: Add media center website --- src/class/Media/index.ts | 12 ++++++++---- src/scripts/content_common.ts | 3 +-- src/scripts/content_kyomu.ts | 2 ++ src/scripts/content_media.ts | 2 ++ src/scripts/content_moodle.ts | 2 ++ src/scripts/content_mylib.ts | 2 +- src/scripts/content_sso.ts | 2 ++ src/styles/gaming.scss | 8 ++++++++ src/styles/media.scss | 12 ++++++++++++ src/utils/AddClass.ts | 18 ++++++++++++++++-- tsconfig.json | 1 - webpack.config.babel.js | 4 +++- 12 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 src/styles/media.scss diff --git a/src/class/Media/index.ts b/src/class/Media/index.ts index 71e42e7..f985f6d 100644 --- a/src/class/Media/index.ts +++ b/src/class/Media/index.ts @@ -1,8 +1,12 @@ // メディアは人類にとっての第四の権力である 権力を持つ者はそれを正しく使わなければならない // 情報は現代の石油である 情報を多く持つものは資本主義で言うところの富を得る +import { AddClass, AddRainbowBg, AddRainbowBgWithShadow, AddRainbowText } from "../../utils/AddClass"; import GundaiWebSite from "../GundaiWebsite"; -export const Media = new GundaiWebSite( - () => {}, - () => {}, -); +export const Media = new GundaiWebSite(() => { + AddRainbowBgWithShadow(".banner_list li"); + AddClass([".banner_list li a"], ["rainbow-bg-shadow"]); + AddRainbowBgWithShadow(".menu_category h3"); + AddRainbowText("#news_list li a"); + AddRainbowBg("#news_category_list .active"); +}); diff --git a/src/scripts/content_common.ts b/src/scripts/content_common.ts index 59df46a..ee7978f 100644 --- a/src/scripts/content_common.ts +++ b/src/scripts/content_common.ts @@ -1,5 +1,4 @@ -import "../styles/gaming.scss"; -import "../styles/kyomu.scss"; +import "/styles/gaming.scss"; chrome.runtime.onMessage.addListener((message) => { if (message === "reload") { diff --git a/src/scripts/content_kyomu.ts b/src/scripts/content_kyomu.ts index cdf02ed..a946da8 100644 --- a/src/scripts/content_kyomu.ts +++ b/src/scripts/content_kyomu.ts @@ -1,3 +1,5 @@ +import "/styles/kyomu.scss"; + import { Kyomu } from "../class"; import LoadGamingWebsite from "../utils/LoadGamingWebsite"; diff --git a/src/scripts/content_media.ts b/src/scripts/content_media.ts index 5530a93..f2356c4 100644 --- a/src/scripts/content_media.ts +++ b/src/scripts/content_media.ts @@ -1,3 +1,5 @@ +import "/styles/media.scss"; + import { Media } from "../class"; import loadGamingWebsite from "../utils/LoadGamingWebsite"; diff --git a/src/scripts/content_moodle.ts b/src/scripts/content_moodle.ts index a3175db..dc6665d 100644 --- a/src/scripts/content_moodle.ts +++ b/src/scripts/content_moodle.ts @@ -1,3 +1,5 @@ +import "/styles/moodle.scss"; + import { Moodle } from "../class"; import loadGamingWebsite from "../utils/LoadGamingWebsite"; diff --git a/src/scripts/content_mylib.ts b/src/scripts/content_mylib.ts index d123ad2..ba12c10 100644 --- a/src/scripts/content_mylib.ts +++ b/src/scripts/content_mylib.ts @@ -1,4 +1,4 @@ -import "../styles/mylibrary.scss"; +import "/styles/mylibrary.scss"; import { MyLibrary } from "../class"; import LoadGamingWebsite from "../utils/LoadGamingWebsite"; diff --git a/src/scripts/content_sso.ts b/src/scripts/content_sso.ts index 3ab7cd2..1c9a2b6 100644 --- a/src/scripts/content_sso.ts +++ b/src/scripts/content_sso.ts @@ -1,3 +1,5 @@ +import "/styles/sso.scss"; + import { SSO } from "../class"; import loadGamingWebsite from "../utils/LoadGamingWebsite"; diff --git a/src/styles/gaming.scss b/src/styles/gaming.scss index bd2155b..3e1331a 100644 --- a/src/styles/gaming.scss +++ b/src/styles/gaming.scss @@ -28,3 +28,11 @@ font-weight: bold; color: transparent; } + +.rainbow-text-shadow { + text-shadow: 0px 0px 40px black; +} + +.rainbow-bg-shadow { + box-shadow: 0px 0px 40px white; +} diff --git a/src/styles/media.scss b/src/styles/media.scss new file mode 100644 index 0000000..b702814 --- /dev/null +++ b/src/styles/media.scss @@ -0,0 +1,12 @@ +.banner_list li a { + font-weight: bold; +} +.menu_category h3{ + color: black; + font-weight: bold; + font-size: larger; +} + +#news_list li a{ + font-weight: bolder; +} diff --git a/src/utils/AddClass.ts b/src/utils/AddClass.ts index 1d869c4..b091fc5 100644 --- a/src/utils/AddClass.ts +++ b/src/utils/AddClass.ts @@ -13,7 +13,9 @@ export function RemoveClass(queries: string[], classNames: string[]) { const elements = document.querySelectorAll(query); elements.forEach((element) => { //console.log("removing classes from", element); - element.classList.remove(...classNames); + classNames.forEach((className) => { + if (element.classList.contains(className)) element.classList.remove(className); + }); }); }); } @@ -22,14 +24,26 @@ 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"]); + RemoveClass(queries, ["rainbow-text", "rainbow-text-shadow"]); } diff --git a/tsconfig.json b/tsconfig.json index ba12c82..060ec0e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "target": "es5", - "rootDir": "./src", "module": "commonjs", "outDir": "dist", "strict": true, diff --git a/webpack.config.babel.js b/webpack.config.babel.js index ba175e0..81c40d3 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -24,6 +24,7 @@ module.exports = { resolve: { extensions: [".ts", ".js"], + roots: [path.resolve(__dirname, "node_modules"), path.resolve(__dirname, "src")], }, module: { @@ -64,5 +65,6 @@ module.exports = { }), new ESLintPlugin(), ], - //devtool: "source-map", + + devtool: "source-map", };