stuff
This commit is contained in:
parent
646f4240fc
commit
3b2ba4c85c
|
@ -58,11 +58,11 @@
|
|||
|
||||
InternalBDFDB.clearStartTimeout(plugin);
|
||||
|
||||
var loadmessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", "v" + plugin.version);
|
||||
let loadmessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", "v" + plugin.version);
|
||||
BDFDB.LogUtils.log(loadmessage, plugin.name);
|
||||
if (!BDFDB.BDUtils.getSettings("fork-ps-2")) BDFDB.NotificationUtils.toast(plugin.name + " " + loadmessage, {nopointer: true, selector: "plugin-started-toast"});
|
||||
|
||||
var url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
|
||||
let url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
|
||||
BDFDB.PluginUtils.checkUpdate(plugin.name, url);
|
||||
|
||||
if (BDFDB.ObjectUtils.is(plugin.classes)) InternalBDFDB.addPluginClasses(plugin);
|
||||
|
@ -92,11 +92,11 @@
|
|||
|
||||
delete BDFDB.myPlugins[plugin.name];
|
||||
|
||||
var unloadmessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_stopped", "v" + plugin.version);
|
||||
let unloadmessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_stopped", "v" + plugin.version);
|
||||
BDFDB.LogUtils.log(unloadmessage, plugin.name);
|
||||
if (!BDFDB.BDUtils.getSettings("fork-ps-2")) BDFDB.NotificationUtils.toast(plugin.name + " " + unloadmessage, {nopointer: true, selector: "plugin-stopped-toast"});
|
||||
|
||||
var url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
|
||||
let url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
|
||||
|
||||
if (BDFDB.ObjectUtils.is(plugin.classes)) InternalBDFDB.removePluginClasses(plugin);
|
||||
if (typeof plugin.css === "string") BDFDB.DOMUtils.removeLocalStyle(plugin.name);
|
||||
|
@ -112,7 +112,8 @@
|
|||
let closebutton = modal.querySelector(BDFDB.dotCN.modalclose);
|
||||
if (closebutton) closebutton.click();
|
||||
}
|
||||
|
||||
|
||||
delete BDFDB.DataUtils.cached[plugin.name]
|
||||
delete window.PluginUpdates.plugins[url];
|
||||
|
||||
delete plugin.started;
|
||||
|
@ -1702,7 +1703,7 @@
|
|||
if (!nodeOrInstance || !types) return config.all ? (config.group ? {} : []) : null;
|
||||
var instance = Node.prototype.isPrototypeOf(nodeOrInstance) ? BDFDB.ReactUtils.getInstance(nodeOrInstance) : nodeOrInstance;
|
||||
if (!BDFDB.ObjectUtils.is(instance)) return config.all ? (config.group ? {} : []) : null;
|
||||
types = types && [types].flat().filter(n => n);
|
||||
types = types && [types].flat(10).filter(n => typeof n == "string");
|
||||
if (!types.length) return config.all ? (config.group ? {} : []) : null;;
|
||||
var depth = -1;
|
||||
var start = performance.now();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
class NotificationSounds {
|
||||
getName () {return "NotificationSounds";}
|
||||
|
||||
getVersion () {return "3.3.7";}
|
||||
getVersion () {return "3.3.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -12,12 +12,13 @@ class NotificationSounds {
|
|||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["@here & @everyone","You can now set a unique sound for those two special mention cases"]],
|
||||
"fixed":[["Incoming","Incoming call now works again"]],
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
};
|
||||
|
||||
this.patchedModules = {
|
||||
after: {
|
||||
IncomingCalls: "render",
|
||||
Shakeable: "render"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -343,7 +344,7 @@ class NotificationSounds {
|
|||
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
if (this.started) return;
|
||||
BDFDB.PluginUtils.init(this);
|
||||
|
||||
|
||||
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {before: e => {
|
||||
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.MESSAGE_CREATE && e.methodArguments[0].message) {
|
||||
let message = e.methodArguments[0].message;
|
||||
|
@ -409,6 +410,7 @@ class NotificationSounds {
|
|||
this.loadAudios();
|
||||
this.loadChoices();
|
||||
|
||||
this.repatchIncoming = true;
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
}
|
||||
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
|
||||
|
@ -430,24 +432,24 @@ class NotificationSounds {
|
|||
onSettingsClosed () {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.repatchIncoming = true;
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
this.settingsaudio.pause();
|
||||
}
|
||||
}
|
||||
|
||||
processIncomingCalls (e) {
|
||||
let audio = new Audio();
|
||||
let play = _ => {
|
||||
if (!audio.paused || this.dontPlayAudio("call_ringing")) return;
|
||||
audio.loop = true;
|
||||
audio.src = this.choices["call_ringing"].src;
|
||||
audio.volume = this.choices["call_ringing"].volume/100;
|
||||
audio.play();
|
||||
};
|
||||
let stop = _ => {audio.pause();}
|
||||
BDFDB.ModuleUtils.patch(this, e.instance, "startRinging", {instead: play});
|
||||
BDFDB.ModuleUtils.patch(this, e.instance, "stopRinging", {instead: stop});
|
||||
BDFDB.ModuleUtils.patch(this, e.instance._reactInternalFiber.type.prototype, "startRinging", {instead: play});
|
||||
BDFDB.ModuleUtils.patch(this, e.instance._reactInternalFiber.type.prototype, "stopRinging", {instead: stop});
|
||||
|
||||
processShakeable (e) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "IncomingCalls"});
|
||||
if (index > -1) {
|
||||
if (this.repatchIncoming) {
|
||||
children[index] = null;
|
||||
BDFDB.TimeUtils.timeout(_ => {
|
||||
delete this.repatchIncoming;
|
||||
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"App", up:true}))
|
||||
});
|
||||
}
|
||||
else children[index] = BDFDB.ReactUtils.createElement(children[index].type, {});
|
||||
}
|
||||
}
|
||||
|
||||
successSavedAudio (settingspanel, collapseStates, data) {
|
||||
|
@ -471,8 +473,14 @@ class NotificationSounds {
|
|||
songFound = true;
|
||||
break;
|
||||
}
|
||||
if (!songFound) choice = {category:"---",song:"---",volume:100,src:this.types[type].src,mute:this.types[type].mute,focus:this.types[type].focus};
|
||||
if (typeof choice.focus == "undefined") choice.focus = this.types[type].focus;
|
||||
if (!songFound) choice = {
|
||||
category: "---",
|
||||
song: "---",
|
||||
volume: 100,
|
||||
src: this.types[type].src,
|
||||
mute: this.types[type].mute,
|
||||
focus: this.types[type].focus
|
||||
};
|
||||
this.choices[type] = choice;
|
||||
this.saveChoice(type, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue