Skip to content

Commit

Permalink
Clean: Rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Oct 28, 2023
1 parent 4a68a55 commit c74ba43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RainbowApplicator } from "../ClassApplicator";
import { GundaiWebSite } from "../UnivWebsite";
import { MoodleAdditionalInfo } from "./type";

export const EnableRainbowTextAndBg = (rainbow: RainbowApplicator) => {
export const enableRainbowTextAndBg = (rainbow: RainbowApplicator) => {
rainbow.bg.apply(".navbar", "#action-menu-0-menu");

rainbow.text.apply(".page-header-headings h1");
Expand All @@ -17,27 +17,27 @@ export const EnableRainbowTextAndBg = (rainbow: RainbowApplicator) => {
rainbow.text.remove(targetElementsSelector);
};

export const InjectLink = () => {
export const injectLink = () => {
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 const ReplaceLMSLogo = () => {
export const replaceLMSLogo = () => {
document.querySelectorAll(".logo").forEach((e) => {
if (e.getAttribute("src")) e.setAttribute("src", chrome.runtime.getURL("assets/GULMS.png"));
});
};

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

export const ReplaceTextToGaimg = (moodle: GundaiWebSite<MoodleAdditionalInfo>) => {
export const replaceTextToGaimg = (moodle: GundaiWebSite<MoodleAdditionalInfo>) => {
const headerText = moodle.additionalInfo.headerText;

document.querySelectorAll(".page-header-headings h1").forEach((e) => {
Expand Down
17 changes: 9 additions & 8 deletions src/class/Moodle/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// 情報の信頼性は社会の構築において重要な要素である
// 個人の信頼性は家庭の構築において重要な要素である
import { GundaiWebSite } from "../UnivWebsite";
import { DisableRainbowBg, ReplaceImagesToDefault } from "./DisableRainbow";
import { EnableRainbowTextAndBg, InjectLink, ReplaceImagesToGamimg, ReplaceLMSLogo, ReplaceTextToGaimg } from "./EnableRainbow";
import { DisableRainbowBg, ReplaceImagesToDefault } from "./disable-utils";
import { enableRainbowTextAndBg, injectLink, replaceImagesToGamimg, replaceLMSLogo, replaceTextToGaimg } from "./enable-utils";
import { MoodleAdditionalInfo } from "./type";

export const Moodle = new GundaiWebSite<MoodleAdditionalInfo>("moodle");
Expand All @@ -11,10 +11,11 @@ Moodle.additionalInfo = {
};

Moodle.rainbow.enable = function () {
EnableRainbowTextAndBg(this);
InjectLink();
ReplaceImagesToGamimg();
ReplaceTextToGaimg(Moodle);
enableRainbowTextAndBg(this);
injectLink();
replaceImagesToGamimg();
replaceTextToGaimg(Moodle);
replaceLMSLogo();

// メニューバーでホバー時にclassを追加
document.querySelectorAll(".moremenu .nav-link").forEach((e) => {
Expand All @@ -33,7 +34,7 @@ Moodle.rainbow.enable = function () {
Moodle.rainbow.disable = function () {
DisableRainbowBg(this);
ReplaceImagesToDefault();
ReplaceLMSLogo();
ReplaceImagesToDefault();

const headerText = Moodle.additionalInfo.headerText;
document.querySelectorAll(".page-header-headings h1").forEach((e) => {
Expand All @@ -52,7 +53,7 @@ Moodle.hidden.enable = () => {

Moodle.dark.enable = function () {
// 画像差し替え
ReplaceLMSLogo();
replaceLMSLogo();

// トップページ
Moodle.dark.bgBase.apply("#page,#page.drawers .main-inner,#region-main");
Expand Down

0 comments on commit c74ba43

Please sign in to comment.