Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
M0chaCat authored Aug 4, 2024
1 parent aba6279 commit cf104fb
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions Plugins/essentials.nkplugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

class Essentials {
info = {
name: "Essentials",
id: "arcane:Essentials",
authors: [{
name: "Arcane",
id: "808802000224518264"
}],
description: "Minor tweaks that make discord better!",
version: "1.0.0",
patches: [],
preferences: [
{
name: "ArcaneTweaks",
description: "CSS Tweaks called ArcaneTweaks",
id: "ArcaneTweaks",
type: "boolean",
default: true
},
]
};

constructor(userPreferences) {
this.userPreferences = userPreferences;
}
onPreferencesChange(userPreferences) {
this.userPreferences = userPreferences;
this.tryToEnableTweaks();
this.enableSitelenPona();
}

tryToEnableTweaks() {
if (this.userPreferences.ArcaneTweaks === true) {
const Css = `@import url('https://arcane.kitties.cat/Themes/ArcaneTweaks.nktheme.css');`;
// Ensure the DOM is fully loaded before applying CSS
if (document.readyState === 'complete') {
this.applyCss(Css);
} else {
window.addEventListener('load', () => this.applyCss(Css));
}
}
}
enableSitelenPona() {
const Css = `@import url('https://arcane.kitties.cat/Themes/sitelenpona.nktheme.css');`;
// Ensure the DOM is fully loaded before applying CSS
if (document.readyState === 'complete') {
this.applyCss(Css);
} else {
window.addEventListener('load', () => this.applyCss(Css));
}
}
// Function to apply css
applyCss(css) {
const styleElement = document.createElement('style');
styleElement.textContent = css;

if (document.head) {
document.head.appendChild(styleElement);
console.log(`Essentials: ArcaneTweaks applied successfully`);
} else {
console.error("Essentials: document.head is null or undefined");
}
}
}
exports.default = Essentials;

0 comments on commit cf104fb

Please sign in to comment.