repo plugins

This commit is contained in:
Mirco Wittrien 2019-01-15 09:18:33 +01:00
parent 45945508e6
commit 60c5d9f0e5
2 changed files with 16 additions and 22 deletions

View File

@ -3,7 +3,7 @@
class PluginRepo { class PluginRepo {
getName () {return "PluginRepo";} getName () {return "PluginRepo";}
getVersion () {return "1.6.7";} getVersion () {return "1.6.9";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -383,9 +383,9 @@ class PluginRepo {
} }
var pluginRepoModal = BDFDB.htmlToElement(this.pluginRepoModalMarkup); var pluginRepoModal = BDFDB.htmlToElement(this.pluginRepoModalMarkup);
var hiddenSettings = Object.assign({},BDFDB.loadAllData(this, "hidden")); var hiddenSettings = BDFDB.loadAllData(this, "hidden");
pluginRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || showOnlyOutdated; pluginRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || showOnlyOutdated;
pluginRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated || showOnlyOutdated; pluginRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !showOnlyOutdated;
pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || showOnlyOutdated; pluginRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || showOnlyOutdated;
if (!BDFDB.isRestartNoMoreEnabled()) pluginRepoModal.querySelector("#RNMoption").remove(); if (!BDFDB.isRestartNoMoreEnabled()) pluginRepoModal.querySelector("#RNMoption").remove();
else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "settings"); else pluginRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "settings");
@ -399,6 +399,7 @@ class PluginRepo {
pluginRepoModal.searchTimeout = setTimeout(() => {this.sortEntries(pluginRepoModal);},1000); pluginRepoModal.searchTimeout = setTimeout(() => {this.sortEntries(pluginRepoModal);},1000);
}); });
BDFDB.addChildEventListener(pluginRepoModal, "change", ".hide-checkbox", e => { BDFDB.addChildEventListener(pluginRepoModal, "change", ".hide-checkbox", e => {
pluginRepoModal.updateHidden = true;
BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden"); BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden");
}); });
BDFDB.addChildEventListener(pluginRepoModal, "change", "#input-rnmstart", e => { BDFDB.addChildEventListener(pluginRepoModal, "change", "#input-rnmstart", e => {
@ -411,13 +412,10 @@ class PluginRepo {
BDFDB.createSortPopout(e.currentTarget, this.orderPopoutMarkup, () => {this.sortEntries(pluginRepoModal);}); BDFDB.createSortPopout(e.currentTarget, this.orderPopoutMarkup, () => {this.sortEntries(pluginRepoModal);});
}); });
BDFDB.addChildEventListener(pluginRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=plugins]", e => { BDFDB.addChildEventListener(pluginRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=plugins]", e => {
if (!e.currentTarget.classList.contains(BDFDB.disCN.settingsitemselected)) { if (!e.currentTarget.classList.contains(BDFDB.disCN.settingsitemselected) && pluginRepoModal.updateHidden) {
var newHiddenSettings = BDFDB.loadAllData(this, "hidden"); delete pluginRepoModal.updateHidden;
if (!BDFDB.equals(newHiddenSettings, hiddenSettings)) {
hiddenSettings = Object.assign({},newHiddenSettings);
this.sortEntries(pluginRepoModal); this.sortEntries(pluginRepoModal);
} }
}
}); });
let favorites = BDFDB.loadAllData(this, "favorites"); let favorites = BDFDB.loadAllData(this, "favorites");
@ -811,12 +809,8 @@ class PluginRepo {
filename = filename[filename.length - 1]; filename = filename[filename.length - 1];
var file = path.join(BDFDB.getPluginsFolder(), filename); var file = path.join(BDFDB.getPluginsFolder(), filename);
fileSystem.unlink(file, (error) => { fileSystem.unlink(file, (error) => {
if (error) { if (error) BDFDB.showToast(`Unable to delete Plugin "${filename}".`, {type:"danger"});
BDFDB.showToast(`Unable to delete Plugin "${filename}".`, {type:"danger"}); else BDFDB.showToast(`Successfully deleted Plugin "${filename}".`, {type:"success"});
}
else {
BDFDB.showToast(`Successfully deleted Plugin "${filename}".`, {type:"success"});
}
}); });
} }

View File

@ -3,7 +3,7 @@
class ThemeRepo { class ThemeRepo {
getName () {return "ThemeRepo";} getName () {return "ThemeRepo";}
getVersion () {return "1.6.8";} getVersion () {return "1.6.9";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -472,7 +472,7 @@ class ThemeRepo {
var frame = BDFDB.htmlToElement(this.frameMarkup); var frame = BDFDB.htmlToElement(this.frameMarkup);
var lightTheme = BDFDB.getDiscordTheme() == BDFDB.disCN.themelight; var lightTheme = BDFDB.getDiscordTheme() == BDFDB.disCN.themelight;
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup); var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
var hiddenSettings = Object.assign({},BDFDB.loadAllData(this, "hidden")); var hiddenSettings = BDFDB.loadAllData(this, "hidden");
var darklightinput = themeRepoModal.querySelector("#input-darklight"); var darklightinput = themeRepoModal.querySelector("#input-darklight");
var customcssinput = themeRepoModal.querySelector("#input-customcss"); var customcssinput = themeRepoModal.querySelector("#input-customcss");
var themefixerinput = themeRepoModal.querySelector("#input-themefixer"); var themefixerinput = themeRepoModal.querySelector("#input-themefixer");
@ -480,7 +480,7 @@ class ThemeRepo {
customcssinput.checked = false; customcssinput.checked = false;
themefixerinput.checked = false; themefixerinput.checked = false;
themeRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || showOnlyOutdated; themeRepoModal.querySelector("#input-hideupdated").checked = hiddenSettings.updated || showOnlyOutdated;
themeRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated || showOnlyOutdated; themeRepoModal.querySelector("#input-hideoutdated").checked = hiddenSettings.outdated && !showOnlyOutdated;
themeRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || showOnlyOutdated; themeRepoModal.querySelector("#input-hidedownloadable").checked = hiddenSettings.downloadable || showOnlyOutdated;
if (!BDFDB.isRestartNoMoreEnabled()) themeRepoModal.querySelector("#RNMoption").remove(); if (!BDFDB.isRestartNoMoreEnabled()) themeRepoModal.querySelector("#RNMoption").remove();
else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "settings"); else themeRepoModal.querySelector("#input-rnmstart").checked = BDFDB.loadData("RNMstart", this, "settings");
@ -512,6 +512,7 @@ class ThemeRepo {
themeRepoModal.searchTimeout = setTimeout(() => {this.sortEntries(themeRepoModal);},1000); themeRepoModal.searchTimeout = setTimeout(() => {this.sortEntries(themeRepoModal);},1000);
}); });
BDFDB.addChildEventListener(themeRepoModal, "change", ".hide-checkbox", e => { BDFDB.addChildEventListener(themeRepoModal, "change", ".hide-checkbox", e => {
themeRepoModal.updateHidden = true;
BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden"); BDFDB.saveData(e.currentTarget.value, e.currentTarget.checked, this, "hidden");
}); });
BDFDB.addChildEventListener(themeRepoModal, "change", "#input-rnmstart", e => { BDFDB.addChildEventListener(themeRepoModal, "change", "#input-rnmstart", e => {
@ -525,9 +526,8 @@ class ThemeRepo {
}); });
BDFDB.addChildEventListener(themeRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=themes]", e => { BDFDB.addChildEventListener(themeRepoModal, "click", BDFDB.dotCN.tabbaritem + "[tab=themes]", e => {
if (!e.currentTarget.classList.contains(BDFDB.disCN.settingsitemselected)) { if (!e.currentTarget.classList.contains(BDFDB.disCN.settingsitemselected)) {
var newHiddenSettings = BDFDB.loadAllData(this, "hidden"); if (themeRepoModal.updateHidden) {
if (!BDFDB.equals(newHiddenSettings, hiddenSettings)) { delete themeRepoModal.updateHidden;
hiddenSettings = Object.assign({},newHiddenSettings);
this.sortEntries(themeRepoModal); this.sortEntries(themeRepoModal);
} }
} }
@ -606,7 +606,7 @@ class ThemeRepo {
trashbutton.addEventListener("click", e => { trashbutton.addEventListener("click", e => {
if (entry.classList.contains("outdated") || entry.classList.contains("updated")) { if (entry.classList.contains("outdated") || entry.classList.contains("updated")) {
setEntryState(2); setEntryState(2);
this.deletePluginFile(data); this.deleteThemeFile(data);
if (!BDFDB.isRestartNoMoreEnabled()) this.removeTheme(data); if (!BDFDB.isRestartNoMoreEnabled()) this.removeTheme(data);
} }
}); });