Skip to content

Commit

Permalink
Update: Make base private
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Oct 27, 2023
1 parent 0785b21 commit 70b5de0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/class/ClassApplicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ const rainbowTextShadow = "rainbow-text-shadow";
// selectorで適用されるセレクタを取得できます
// baseは初期化に必ず指定する必要があり書き換えるべきではありませんが、classesは追加で個別の設定を行うために指定できます
export class classApplicator {
base: string[];
#base: string[];
classes: string[];
constructor(base: string[]) {
this.base = base;
this.#base = base;
this.classes = [];
}

apply(...elements: Elements[]) {
addClass(elements, [...this.base, ...this.classes]);
addClass(elements, [...this.#base, ...this.classes]);
}
remove(...elements: Elements[]) {
removeClass(elements, [...this.base, ...this.classes]);
removeClass(elements, [...this.#base, ...this.classes]);
}
selector() {
if (this.classes.length === 0) return `.${this.base}`;
else return `.${this.base}.${this.classes.join(".")}`;
if (this.classes.length === 0) return `.${this.#base}`;
else return `.${this.#base}.${this.classes.join(".")}`;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/class/Moodle/EnableRainbow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { removeClass } from "../../utils/addClass";
import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { RainbowApplicator } from "../ClassApplicator";
import { GundaiWebSite } from "../UnivWebsite";
Expand All @@ -14,7 +13,8 @@ export const EnableRainbowTextAndBg = (rainbow: RainbowApplicator) => {
// rainbowBgの中のrainbowTextを無効化
const rainbowBgSelector = rainbow.bg.selector();
const targetElementsSelector = `${rainbowBgSelector} ${rainbow.text.selector()}`;
removeClass([targetElementsSelector], rainbow.text.base);
//removeClass([targetElementsSelector], rainbow.text.base);
rainbow.text.remove(targetElementsSelector);
};

export const InjectLink = () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2015",
"module": "commonjs",
"outDir": "dist",
"strict": true,
Expand Down

0 comments on commit 70b5de0

Please sign in to comment.