Skip to content

Commit

Permalink
Clean: Export as default
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Oct 29, 2023
1 parent 1a8a210 commit bcd1a04
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/class/ClassApplicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const rainbowTextShadow = "rainbow-text-shadow";
// 要素にclassNameを追加します
// baseとclassesで追加するclassNameを指定し、applyで適用、removeで削除します
// selectorで適用されるセレクタを取得できます
// baseは初期化に必ず指定する必要があり書き換えるべきではありませんが、classesは追加で個別の設定を行うために指定できます
// classesは追加で任意のクラスを同時に指定できます
export class classApplicator {
#base: string[];
classes: string[];
Expand Down
1 change: 1 addition & 0 deletions src/class/Kyomu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { GundaiWebSite } from "../UnivWebsite";

export const Kyomu = new GundaiWebSite("kyomu");
export default Kyomu;

Kyomu.rainbow.enable = function () {
// ログインボタン
Expand Down
2 changes: 2 additions & 0 deletions src/class/Media/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { GundaiWebSite } from "../UnivWebsite";

export const Media = new GundaiWebSite("media");
export default Media;

Media.rainbow.enable = function () {
this.bgShadow.apply(".banner_list li");
this.bgShadow.apply(".banner_list li a");
Expand Down
6 changes: 6 additions & 0 deletions src/class/Moodle/common.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";

export const injectLink = () => {
const supportSection = document.querySelector(".footer-support-link");
if (supportSection)
Expand All @@ -11,3 +13,7 @@ export const replaceLMSLogo = () => {
if (e.getAttribute("src")) e.setAttribute("src", chrome.runtime.getURL("assets/GULMS.png"));
});
};

export const replaceImagesToDefault = () => {
changeQueryInnerHTML("#instance-320-header", "現在のログイン人数");
};
12 changes: 0 additions & 12 deletions src/class/Moodle/disable-utils.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/class/Moodle/disableHidden.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { HiddenApplicator } from "../ClassApplicator";

export default function disableHidden(this: HiddenApplicator) {}
16 changes: 16 additions & 0 deletions src/class/Moodle/disableRainbow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RainbowApplicator } from "../ClassApplicator";
import Moodle from ".";
import { replaceImagesToDefault } from "./common";

export default function disableRainbow(this: RainbowApplicator) {
this.bg.remove(".navbar", ".addinghtml");
this.bg.remove(".page-header-headings h1");
this.bg.remove("a");

replaceImagesToDefault();

const headerText = Moodle.additionalInfo.headerText;
document.querySelectorAll(".page-header-headings h1").forEach((e) => {
if (e.innerHTML.includes(headerText)) e.innerHTML.replace(headerText, "");
});
}
8 changes: 8 additions & 0 deletions src/class/Moodle/enableHidden.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function enableHidden() {
const cardElement = document.querySelector(".card-text .no-overflow");
if (!cardElement) return;
const playCountUnderTextElement = cardElement.getElementsByTagName("p")[1];
if (!playCountUnderTextElement) return;

playCountUnderTextElement.innerHTML = "想定最大利用者乳首数:4,000";
}
5 changes: 4 additions & 1 deletion src/class/Moodle/enableRainbow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { RainbowApplicator } from "../ClassApplicator";
import { GundaiWebSite } from "../UnivWebsite";
import Moodle from ".";
import { injectLink, replaceLMSLogo } from "./common";
import { MoodleAdditionalInfo } from "./type";

Expand Down Expand Up @@ -50,7 +51,9 @@ const headerHover = () => {
});
};

export default function enableRainbow(moodle: GundaiWebSite<MoodleAdditionalInfo>) {
export default function enableRainbow() {
const moodle = Moodle;

textAndBg(moodle.rainbow);
headerHover();
injectLink();
Expand Down
27 changes: 7 additions & 20 deletions src/class/Moodle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,22 @@
// 個人の信頼性は家庭の構築において重要な要素である
import { GundaiWebSite } from "../UnivWebsite";
import enableDark from "./dark";
import { DisableRainbowBg, ReplaceImagesToDefault } from "./disable-utils";
import disableRainbow from "./disableRainbow";
import enableHidden from "./enableHidden";
import enableRainbow from "./enableRainbow";
import { MoodleAdditionalInfo } from "./type";

export const Moodle = new GundaiWebSite<MoodleAdditionalInfo>("moodle");
export default Moodle;

Moodle.additionalInfo = {
headerText: " Gaming Edition 🎮",
};

Moodle.rainbow.enable = () => enableRainbow(Moodle);

Moodle.rainbow.disable = function () {
DisableRainbowBg(this);
ReplaceImagesToDefault();
ReplaceImagesToDefault();
Moodle.rainbow.enable = enableRainbow;

const headerText = Moodle.additionalInfo.headerText;
document.querySelectorAll(".page-header-headings h1").forEach((e) => {
if (e.innerHTML.includes(headerText)) e.innerHTML.replace(headerText, "");
});
};
Moodle.rainbow.disable = disableRainbow;

Moodle.hidden.enable = () => {
const cardElement = document.querySelector(".card-text .no-overflow");
if (!cardElement) return;
const playCountUnderTextElement = cardElement.getElementsByTagName("p")[1];
if (!playCountUnderTextElement) return;

playCountUnderTextElement.innerHTML = "想定最大利用者乳首数:4,000";
};
Moodle.hidden.enable = enableHidden;

Moodle.dark.enable = enableDark;
1 change: 1 addition & 0 deletions src/class/MyLibrary/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ChangeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { GundaiWebSite } from "../UnivWebsite";

export const MyLibrary = new GundaiWebSite("mylibrary");
export default MyLibrary;

MyLibrary.rainbow.enable = function () {
if (location.pathname == "/portal/portal/selectLogin/") {
Expand Down
2 changes: 2 additions & 0 deletions src/class/SSO/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { GundaiWebSite } from "../UnivWebsite";

export const SSO = new GundaiWebSite("sso");
export default SSO;

SSO.rainbow.enable = function () {
this.bg.apply(".header_column", ".input_form", ".input_column");
changeQueryInnerHTML(".product", "群馬大学ゲーミングサインオンシステム");
Expand Down
2 changes: 1 addition & 1 deletion src/class/StorageTool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import IsTrue from "../../utils/isTrue";

type Keys = "dark" | "rainbow" | "enabled-hidden" | "show-hidden-option" | "installed";

export class StorageTool {
export default class StorageTool {
id: string;
constructor(id: string) {
this.id = id;
Expand Down
2 changes: 1 addition & 1 deletion src/class/UnivWebsite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import isTrue from "../../utils/isTrue";
import { DarkApplicator, HiddenApplicator, RainbowApplicator } from "../ClassApplicator";
import { StorageTool } from "../StorageTool";
import StorageTool from "../StorageTool";
//import Storage from "../../utils/Storage";

// UnivWebSiteはゲーミング化するウェブサイトを定義したクラス
Expand Down
2 changes: 1 addition & 1 deletion src/options/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Menu, Navbar } from "react-daisyui";
import { FaCog, FaGithub, FaInfo, FaTwitter } from "react-icons/fa";
import { Link, useLocation } from "react-router-dom";

import { StorageTool } from "../../class/StorageTool";
import StorageTool from "../../class/StorageTool";

export default function Header({ className }: { className?: string }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/options/pages/Top.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from "classnames";
import { useEffect, useState } from "react";

import { StorageTool } from "../../class/StorageTool";
import StorageTool from "../../class/StorageTool";
import CopyTootrip from "../../components/CopyBtn";
import Heading from "../../components/Heading";
import { Switches } from "../../components/Switches";
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StorageTool } from "../class/StorageTool";
import StorageTool from "../class/StorageTool";
import isTrue from "../utils/isTrue";
import OpenOptions from "../utils/openOptions";

Expand Down

0 comments on commit bcd1a04

Please sign in to comment.