Skip to content

Commit

Permalink
Clean: Rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Oct 16, 2023
1 parent d68ca83 commit f1e8895
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
7 changes: 6 additions & 1 deletion src/class/GundaiWebsite/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// 無駄とは人生である。無駄を極めよ。無駄を愛せ。無駄を生きろ。
// 無駄を以て物を成す者は、無駄を以て物を滅ぼす者に勝る。
// 無駄を以て物を成す者は、無駄を以て物を滅ぼす者に勝る。x

// GundaiWebSiteはゲーミング化するウェブサイトを定義したクラス
// 型変数とAdditionalInfoプロパティによって任意の情報を追加できる
export default class GundaiWebSite<T> {
EnableRainbow?: () => void;
DisableRainbow?: () => void;
Expand All @@ -10,3 +13,5 @@ export default class GundaiWebSite<T> {
}
AdditionalInfo: T;
}

// 型変数使うとかっこいいよね
22 changes: 11 additions & 11 deletions src/class/Kyomu/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 教務は学生の未来を担い、ゲーミングは学生の人生に彩りを加える
// この二つのシステムを統合することで、学生の人生をより豊かにすることができる
import { addRainbowBg, addRainbowText } from "../../utils/AddClass";
import changeQueryInnerHTML from "../../utils/ChangeQueryInnerHTML";
import { AddRainbowBg, AddRainbowText } from "../../utils/AddClass";
import ChangeQueryInnerHTML from "../../utils/ChangeQueryInnerHTML";
import GundaiWebSite from "../GundaiWebsite";

const EnableRainbow = () => {
Expand All @@ -13,32 +13,32 @@ const EnableRainbow = () => {
}

// ページ遷移リンク
addRainbowText(".commonTopPageLink", ".commonTopPageLinkWithPadding");
AddRainbowText(".commonTopPageLink", ".commonTopPageLinkWithPadding");

addRainbowText(
AddRainbowText(
"#CtlInfLstBfrLginEmrgncy_LblTitle",
"#CtlInfLstBfrLginNrml_LblTitle",
"#AllAnnualList_LblTitle",
"#JeLblSyllabiHeader_lbl",
);
addRainbowBg(".infoListEntryOrgName");
addRainbowBg(".infoListBeforeLoginGrid");
AddRainbowBg(".infoListEntryOrgName");
AddRainbowBg(".infoListBeforeLoginGrid");

// ログイン後のトップページ
addRainbowBg(".top_title_header", ".top_now_title");
AddRainbowBg(".top_title_header", ".top_now_title");

// トップページのウェルカムメッセージ
changeQueryInnerHTML(["#loginHeader_lblWelcome_1_lbl"], "よおこそ、群馬大学ゲーミング教務システムへ");
changeQueryInnerHTML(
ChangeQueryInnerHTML(["#loginHeader_lblWelcome_1_lbl"], "よおこそ、群馬大学ゲーミング教務システムへ");
ChangeQueryInnerHTML(
["#loginHeader_lblWelcome_2_lbl"],
"このサイトでは、プレーヤーの群馬大学での𝑮𝒂𝒎𝒊𝒏𝒈 𝑳𝒊𝒇𝒆 𝑺𝒕𝒚𝒍𝒆をいい感じにします",
);

// トップページのお知らせ
changeQueryInnerHTML(["#AllAnnualList_LblTitle"], "ゲーミング ライフ スタイル");
ChangeQueryInnerHTML(["#AllAnnualList_LblTitle"], "ゲーミング ライフ スタイル");

// 受信メッセージ一覧
addRainbowBg("#ctl00_phContents_ctlMesReceive_gridMes tr");
AddRainbowBg("#ctl00_phContents_ctlMesReceive_gridMes tr");
};

export const Kyomu = new GundaiWebSite(EnableRainbow);
8 changes: 4 additions & 4 deletions src/class/Moodle/EnableRainbow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addRainbowBg, addRainbowText } from "../../utils/AddClass";
import { AddRainbowBg, AddRainbowText } from "../../utils/AddClass";
import changeQueryInnerHTML from "../../utils/ChangeQueryInnerHTML";
import GundaiWebSite from "../GundaiWebsite";
import { MoodleAdditionalInfo } from "./type";
Expand All @@ -10,9 +10,9 @@ export const EnableRainbowFunc = function (this: GundaiWebSite<MoodleAdditionalI
});

changeQueryInnerHTML(["#instance-320-header"], "現在のプレイ人数");
addRainbowBg(".navbar", ".addinghtml");
addRainbowText(".page-header-headings h1");
addRainbowText("a");
AddRainbowBg(".navbar", ".addinghtml");
AddRainbowText(".page-header-headings h1");
AddRainbowText("a");

document.querySelectorAll(".logo").forEach((e) => {
if (e.getAttribute("src")) e.setAttribute("src", chrome.runtime.getURL("assets/GULMS.png"));
Expand Down
4 changes: 2 additions & 2 deletions src/utils/AddClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export function RemoveClass(queries: string[], classNames: string[]) {
});
}

export function addRainbowBg(...queries: string[]) {
export function AddRainbowBg(...queries: string[]) {
AddClass(queries, ["rainbow-bg"]);
}

export function addRainbowText(...queries: string[]) {
export function AddRainbowText(...queries: string[]) {
AddClass(queries, ["rainbow-text"]);
}

Expand Down

0 comments on commit f1e8895

Please sign in to comment.