Skip to content

Commit

Permalink
Update: Do not use the function that returns function
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Oct 16, 2023
1 parent 9f810d1 commit 0eebad7
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 60 deletions.
18 changes: 18 additions & 0 deletions src/class/Moodle/DisableRainbow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { RemoveRainbowBg } from "../../utils/AddClass";
import changeQueryInnerHTML from "../../utils/ChangeQueryInnerHTML";
import GundaiWebSite from "../GundaiWebsite";
import { MoodleAdditionalInfo } from "./type";

export const DisableRainbowFunc = function (this: GundaiWebSite<MoodleAdditionalInfo>) {
changeQueryInnerHTML(["#instance-320-header"], "現在のログイン人数");
RemoveRainbowBg(".navbar", ".addinghtml");
RemoveRainbowBg(".page-header-headings h1");
RemoveRainbowBg("a");

const headerText = this.AdditionalInfo.headerText;
document.querySelectorAll(".page-header-headings h1").forEach((e) => {
if (e.innerHTML.includes(headerText)) e.innerHTML.replace(headerText, "");
});
};

export default DisableRainbowFunc;
20 changes: 0 additions & 20 deletions src/class/Moodle/DisableRainbowFunc.ts

This file was deleted.

32 changes: 32 additions & 0 deletions src/class/Moodle/EnableRainbow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { addRainbowBg, addRainbowText } from "../../utils/AddClass";
import changeQueryInnerHTML from "../../utils/ChangeQueryInnerHTML";
import GundaiWebSite from "../GundaiWebsite";
import { MoodleAdditionalInfo } from "./type";

export const EnableRainbowFunc = function (this: GundaiWebSite<MoodleAdditionalInfo>) {
const headerText = this.AdditionalInfo.headerText;
document.querySelectorAll(".page-header-headings h1").forEach((e) => {
if (!e.innerHTML.includes(headerText)) e.innerHTML = e.innerHTML + headerText;
});

changeQueryInnerHTML(["#instance-320-header"], "現在のプレイ人数");
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"));
});

document.querySelectorAll("img.userpicture").forEach((e) => {
if (e.getAttribute("src")) e.setAttribute("src", chrome.runtime.getURL("assets/partyparrot.gif"));
});

const supportSection = document.querySelector(".footer-support-link");
if (supportSection)
supportSection.innerHTML =
supportSection.innerHTML +
`<a href="https://twitter.com/Hayao0819" target="blank" class="rainbow-text">Gaming Edition開発者に連絡する<i class="icon fa fa-external-link fa-fw ml-1" aria-hidden="true"></i></a>`;
};

export default EnableRainbowFunc;
36 changes: 0 additions & 36 deletions src/class/Moodle/EnableRainbowFunc.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/class/Moodle/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// 情報の信頼性は社会の構築において重要な要素である
// 個人の信頼性は家庭の構築において重要な要素である
import GundaiWebSite from "../GundaiWebsite";
import DisableRainbowFunc from "./DisableRainbowFunc";
import EnableRainbowFunc from "./EnableRainbowFunc";
import DisableRainbow from "./DisableRainbow";
import EnableRainbow from "./EnableRainbow";
import { MoodleAdditionalInfo } from "./type";

export const Moodle = new GundaiWebSite<MoodleAdditionalInfo>();
Moodle.AdditionalInfo.headerText = " Gaming Edition🎮";
Moodle.EnableRainbow = EnableRainbowFunc(Moodle);
Moodle.DisableRainbow = DisableRainbowFunc(Moodle);
Moodle.EnableRainbow = EnableRainbow;
Moodle.DisableRainbow = DisableRainbow;

0 comments on commit 0eebad7

Please sign in to comment.