stuff
This commit is contained in:
parent
e4b18f6abc
commit
e94a842feb
File diff suppressed because one or more lines are too long
|
@ -3,19 +3,25 @@
|
|||
class FriendNotifications {
|
||||
getName () {return "FriendNotifications";}
|
||||
|
||||
getVersion () {return "1.1.8";}
|
||||
getVersion () {return "1.1.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.";}
|
||||
|
||||
initConstructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Missing Friend Counter","Falls back to a check interval if the Online Counter isn't rendered. Timelog can now also be viewed in the settings"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"FriendsOnline":["componentDidMount","componentDidUpdate"]
|
||||
};
|
||||
|
||||
this.friendsOnlineList = {};
|
||||
|
||||
this.checkInterval = null;
|
||||
|
||||
this.timeLog = [];
|
||||
|
||||
this.timeLogModalMarkup =
|
||||
|
@ -151,6 +157,7 @@ class FriendNotifications {
|
|||
}
|
||||
settingshtml += `</div>`;
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Batch set Users:</h3><button type="button" do-disable=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttoncolorprimary + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} disable-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Disable</div></button><button type="button" do-toast=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} toast-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Toast</div></button>${"Notification" in window ? `<button type="button" do-desktop=true class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorgreen + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} desktop-all" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Desktop</div></button>` : ``}</div>`;
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom20}" style="flex: 0 0 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">Timelog of LogIns/-Outs:</h3><button type="button" class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.button + BDFDB.disCNS.buttonlookfilled + BDFDB.disCNS.buttoncolorbrand + BDFDB.disCNS.buttonsizemedium + BDFDB.disCN.buttongrow} btn-timelog" style="flex: 0 0 auto;"><div class="${BDFDB.disCN.buttoncontents}">Timelog</div></button></div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.htmlToElement(settingshtml);
|
||||
|
@ -201,6 +208,7 @@ class FriendNotifications {
|
|||
BDFDB.saveAllData(disabledata, this, "disabled");
|
||||
BDFDB.saveAllData(desktopdata, this, "desktop");
|
||||
});
|
||||
BDFDB.addEventListener(this, settingspanel, "click", ".btn-timelog", () => {this.showTimeLog();});
|
||||
|
||||
return settingspanel;
|
||||
}
|
||||
|
@ -241,6 +249,8 @@ class FriendNotifications {
|
|||
this.friendsOnlineList[id] = this.UserMetaStore.getStatus(id) != "offline";
|
||||
}
|
||||
|
||||
this.startInterval();
|
||||
|
||||
BDFDB.WebModules.forceAllUpdates(this);
|
||||
}
|
||||
else {
|
||||
|
@ -250,6 +260,7 @@ class FriendNotifications {
|
|||
|
||||
stop () {
|
||||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
clearInterval(this.checkInterval);
|
||||
BDFDB.unloadMessage(this);
|
||||
}
|
||||
}
|
||||
|
@ -295,6 +306,12 @@ class FriendNotifications {
|
|||
BDFDB.addEventListener(this, wrapper, "mouseenter", () => {BDFDB.createTooltip("Timelog", wrapper, {type:"right"});});
|
||||
BDFDB.addEventListener(this, wrapper, "click", () => {this.showTimeLog();});
|
||||
|
||||
clearInterval(this.checkInterval);
|
||||
|
||||
this.checkFriends();
|
||||
}
|
||||
|
||||
checkFriends () {
|
||||
let settings = BDFDB.getAllData(this, "settings");
|
||||
for (let id of this.FriendUtils.getFriendIDs()) {
|
||||
let online = this.UserMetaStore.getStatus(id) != "offline";
|
||||
|
@ -333,6 +350,18 @@ class FriendNotifications {
|
|||
}
|
||||
}
|
||||
|
||||
startInterval () {
|
||||
clearInterval(this.checkInterval);
|
||||
let oldcount = this.UserMetaStore.getOnlineFriendCount(), newcount = 0;
|
||||
this.checkInterval = setInterval(() => {
|
||||
newcount = this.UserMetaStore.getOnlineFriendCount();
|
||||
if (oldcount != newcount) {
|
||||
oldcount = newcount;
|
||||
this.checkFriends();
|
||||
}
|
||||
},10000);
|
||||
}
|
||||
|
||||
showTimeLog () {
|
||||
let timeLogModal = BDFDB.htmlToElement(this.timeLogModalMarkup);
|
||||
let container = timeLogModal.querySelector(".entries");
|
||||
|
|
|
@ -3,12 +3,18 @@
|
|||
class MoveablePopups {
|
||||
getName () {return "MoveablePopups";}
|
||||
|
||||
getVersion () {return "1.1.2";}
|
||||
getVersion () {return "1.1.3";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getDescription () {return "Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.";}
|
||||
|
||||
initConstructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Moved Modal Container","Fixed selector for new modal container"]]
|
||||
};
|
||||
}
|
||||
|
||||
//legacy
|
||||
load () {}
|
||||
|
||||
|
@ -67,7 +73,7 @@ class MoveablePopups {
|
|||
}
|
||||
);
|
||||
});
|
||||
BDFDB.addObserver(this, BDFDB.dotCN.app + " ~ [class^='theme-']:not([class*='popouts'])", {name:"modalObserver",instance:observer}, {childList: true});
|
||||
BDFDB.addObserver(this, `${BDFDB.dotCN.popouts} ~ .${BDFDB.getDiscordTheme()}`, {name:"modalObserver",instance:observer}, {childList: true});
|
||||
}
|
||||
else {
|
||||
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
|
||||
|
@ -87,12 +93,7 @@ class MoveablePopups {
|
|||
makeMoveable (div) {
|
||||
div.removeEventListener("click", div.clickMovablePopups);
|
||||
div.removeEventListener("mousedown", div.mousedownMovablePopups);
|
||||
div.clickMovablePopups = e => {
|
||||
if (this.dragging) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
div.clickMovablePopups = e => {if (this.dragging) BDFDB.stopEvent(e);};
|
||||
div.mousedownMovablePopups = e => {
|
||||
if (!e.ctrlKey) return;
|
||||
div.style.setProperty("position", "fixed", "important");
|
||||
|
|
|
@ -844,60 +844,42 @@ class PluginRepo {
|
|||
|
||||
downloadPlugin (data) {
|
||||
require("request")(data.url, (error, response, body) => {
|
||||
if (error) {
|
||||
BDFDB.showToast(`Unable to download Plugin "${plugin.getName}".`, {type:"danger"});
|
||||
}
|
||||
else {
|
||||
let filename = data.url.split("/");
|
||||
this.createPluginFile(filename[filename.length - 1], body);
|
||||
}
|
||||
if (error) BDFDB.showToast(`Unable to download Plugin "${plugin.getName}".`, {type:"danger"});
|
||||
else this.createPluginFile(data.url.split("/").pop(), body);
|
||||
});
|
||||
}
|
||||
|
||||
createPluginFile (filename, content) {
|
||||
let fileSystem = require("fs");
|
||||
let path = require("path");
|
||||
var file = path.join(BDFDB.getPluginsFolder(), filename);
|
||||
fileSystem.writeFile(file, content, (error) => {
|
||||
if (error) {
|
||||
BDFDB.showToast(`Unable to save Plugin "${filename}".`, {type:"danger"});
|
||||
}
|
||||
else {
|
||||
BDFDB.showToast(`Successfully saved Plugin "${filename}".`, {type:"success"});
|
||||
}
|
||||
require("fs").writeFile(require("path").join(BDFDB.getPluginsFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to save Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully saved Plugin "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
startPlugin (data) {
|
||||
var name = data.name;
|
||||
if (BDFDB.isPluginEnabled(name) == false) {
|
||||
bdplugins[name].plugin.start();
|
||||
pluginCookie[name] = true;
|
||||
if (BDFDB.isPluginEnabled(data.name) == false) {
|
||||
bdplugins[data.name].plugin.start();
|
||||
pluginCookie[data.name] = true;
|
||||
pluginModule.savePluginData();
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Started Plugin " + name + ".");
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Started Plugin " + data.name + ".");
|
||||
}
|
||||
}
|
||||
|
||||
deletePluginFile (data) {
|
||||
let fileSystem = require("fs");
|
||||
let path = require("path");
|
||||
let filename = data.url.split("/");
|
||||
filename = filename[filename.length - 1];
|
||||
var file = path.join(BDFDB.getPluginsFolder(), filename);
|
||||
fileSystem.unlink(file, (error) => {
|
||||
let filename = data.url.split("/").pop();
|
||||
require("fs").unlink(require("path").join(BDFDB.getPluginsFolder(), filename), (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to delete Plugin "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully deleted Plugin "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
stopPlugin (data) {
|
||||
var name = data.name;
|
||||
if (BDFDB.isPluginEnabled(name) == true) {
|
||||
bdplugins[name].plugin.stop();
|
||||
pluginCookie[name] = false;
|
||||
delete bdplugins[name];
|
||||
if (BDFDB.isPluginEnabled(data.name) == true) {
|
||||
bdplugins[data.name].plugin.stop();
|
||||
pluginCookie[data.name] = false;
|
||||
delete bdplugins[data.name];
|
||||
pluginModule.savePluginData();
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Stopped Plugin " + name + ".");
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Stopped Plugin " + data.name + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -847,61 +847,43 @@ class ThemeRepo {
|
|||
|
||||
downloadTheme (data) {
|
||||
require("request")(data.url, (error, response, body) => {
|
||||
if (error) {
|
||||
BDFDB.showToast(`Unable to download Theme "${data.name}".`, {type:"danger"});
|
||||
}
|
||||
else {
|
||||
let filename = data.url.split("/");
|
||||
this.createThemeFile(filename[filename.length - 1], body);
|
||||
}
|
||||
if (error) BDFDB.showToast(`Unable to download Theme "${data.name}".`, {type:"danger"});
|
||||
else this.createThemeFile(data.url.split("/").pop(), body);
|
||||
});
|
||||
}
|
||||
|
||||
createThemeFile (filename, content) {
|
||||
let fileSystem = require("fs");
|
||||
let path = require("path");
|
||||
var file = path.join(BDFDB.getThemesFolder(), filename);
|
||||
fileSystem.writeFile(file, content, (error) => {
|
||||
if (error) {
|
||||
BDFDB.showToast(`Unable to save Theme "${filename}".`, {type:"danger"});
|
||||
}
|
||||
else {
|
||||
BDFDB.showToast(`Successfully saved Theme "${filename}".`, {type:"success"});
|
||||
}
|
||||
fileSystem.writeFile(require("path").join(BDFDB.getThemesFolder(), filename), content, (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to save Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully saved Theme "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
applyTheme (data) {
|
||||
var name = data.name;
|
||||
if (BDFDB.isThemeEnabled(name) == false) {
|
||||
BDFDB.removeEles(`style#${name}`);
|
||||
document.head.appendChild(BDFDB.htmlToElement(`<style id=${name}>${data.css}</style>`));
|
||||
themeCookie[name] = true;
|
||||
if (BDFDB.isThemeEnabled(data.name) == false) {
|
||||
BDFDB.removeEles(`style#${data.name}`);
|
||||
document.head.appendChild(BDFDB.htmlToElement(`<style id=${data.name}>${data.css}</style>`));
|
||||
themeCookie[data.name] = true;
|
||||
themeModule.saveThemeData();
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Applied Theme " + name + ".");
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Applied Theme " + data.name + ".");
|
||||
}
|
||||
}
|
||||
|
||||
deleteThemeFile (data) {
|
||||
let fileSystem = require("fs");
|
||||
let path = require("path");
|
||||
let filename = data.url.split("/");
|
||||
filename = filename[filename.length - 1];
|
||||
var file = path.join(BDFDB.getThemesFolder(), filename);
|
||||
fileSystem.unlink(file, (error) => {
|
||||
let filename = data.url.split("/").pop();
|
||||
require("fs").unlink(require("path").join(BDFDB.getThemesFolder(), filename), (error) => {
|
||||
if (error) BDFDB.showToast(`Unable to delete Theme "${filename}".`, {type:"danger"});
|
||||
else BDFDB.showToast(`Successfully deleted Theme "${filename}".`, {type:"success"});
|
||||
});
|
||||
}
|
||||
|
||||
removeTheme (data) {
|
||||
var name = data.name;
|
||||
if (BDFDB.isThemeEnabled(name) == true) {
|
||||
BDFDB.removeEles(`style#${name}`);
|
||||
themeCookie[name] = false;
|
||||
delete bdthemes[name];
|
||||
if (BDFDB.isThemeEnabled(data.name) == true) {
|
||||
BDFDB.removeEles(`style#${data.name}`);
|
||||
themeCookie[data.name] = false;
|
||||
delete bdthemes[data.name];
|
||||
themeModule.saveThemeData();
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Removed Theme " + name + ".");
|
||||
console.log(`%c[${this.name}]%c`, "color: #3a71c1; font-weight: 700;", "", "Removed Theme " + data.name + ".");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,10 +11,7 @@ https://raw.githubusercontent.com/CapnKitten/Material-Discord/master/Material-Di
|
|||
https://raw.githubusercontent.com/CAtOSe/Neon-Space-BetterDiscord-Theme/master/neon-space.theme.css
|
||||
https://raw.githubusercontent.com/Chloesviel/Discord-Stuff/master/minifiedMemberlist/minifiedMemberlist.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/chemical/chemical.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/colorize/colorize_reborn.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/discorddark/discorddark.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/discordelectro/discordelectro.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/dunes/dunes.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/neutron/neutronX.theme.css
|
||||
https://raw.githubusercontent.com/codedotspectra/themes/master/nocturnal/nocturnal.theme.css
|
||||
https://raw.githubusercontent.com/CurimuChizu/CC-Themes/master/CC-Themes/Red.n.Black.theme.css
|
||||
|
|
Loading…
Reference in New Issue