Skip to content

Commit e5740d5

Browse files
authored
Removed useless parameter, added new function "resetConfig"
1 parent dd5f4cc commit e5740d5

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

usergui.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,25 @@ class UserGui {
202202
}
203203

204204
// Make tabs function without bootstrap.js (CSP might block bootstrap and make the GUI nonfunctional)
205-
#initializeTabs(_this) {
205+
#initializeTabs() {
206206
const handleTabClick = e => {
207207
const target = e.target;
208208
const contentID = target.getAttribute("data-bs-target");
209209

210210
target.classList.add("active");
211-
_this.document.querySelector(contentID).classList.add("active");
211+
this.document.querySelector(contentID).classList.add("active");
212212

213-
[..._this.document.querySelectorAll(".nav-link")].forEach(tab => {
213+
[...this.document.querySelectorAll(".nav-link")].forEach(tab => {
214214
if(tab != target) {
215215
const contentID = tab.getAttribute("data-bs-target");
216216

217217
tab.classList.remove("active");
218-
_this.document.querySelector(contentID).classList.remove("active");
218+
this.document.querySelector(contentID).classList.remove("active");
219219
}
220220
});
221221
}
222222

223-
[..._this.document.querySelectorAll(".nav-link")].forEach(tab => {
223+
[...this.document.querySelectorAll(".nav-link")].forEach(tab => {
224224
tab.addEventListener("click", handleTabClick);
225225
});
226226
}
@@ -609,7 +609,7 @@ class UserGui {
609609

610610
this.document = this.window.document;
611611

612-
this.#initializeTabs(this);
612+
this.#initializeTabs();
613613

614614
// Call user's function
615615
if(typeof readyFunction == "function") {
@@ -677,7 +677,7 @@ class UserGui {
677677
this.iFrame = iframe;
678678

679679
this.#initializeInternalGuiEvents(iframe);
680-
this.#initializeTabs(this);
680+
this.#initializeTabs();
681681

682682
readyFunction();
683683
}
@@ -708,7 +708,7 @@ class UserGui {
708708
}
709709
}
710710

711-
save() {
711+
saveConfig() {
712712
let config = [];
713713

714714
if(this.document) {
@@ -727,7 +727,7 @@ class UserGui {
727727
GM_setValue("config", config);
728728
}
729729

730-
load() {
730+
loadConfig() {
731731
const config = this.getConfig();
732732

733733
if(this.document && config) {
@@ -741,6 +741,14 @@ class UserGui {
741741
return GM_getValue("config");
742742
}
743743

744+
resetConfig() {
745+
const config = this.getConfig();
746+
747+
if(config) {
748+
GM_setValue("config", []);
749+
}
750+
}
751+
744752
dispatchFormEvent(name) {
745753
const type = name.split("-")[0].toLowerCase();
746754
const properties = this.#typeProperties.find(x => type == x.type);

0 commit comments

Comments
 (0)