timeout&null

This commit is contained in:
Jiiks 2015-08-29 22:02:20 +03:00
parent 2e2938dc02
commit e5dcf7b500
2 changed files with 22 additions and 28 deletions

View File

@ -2,7 +2,7 @@
* Version: 1.2 * Version: 1.2
* Author: Jiiks | http://jiiks.net * Author: Jiiks | http://jiiks.net
* Date: 27/08/2015 - 16:36 * Date: 27/08/2015 - 16:36
* Last Update: 29/08/2015 - 11:48 * Last Update: 29/08/2015 - 22:00
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
*/ */
@ -63,19 +63,15 @@ Core.prototype.init = function() {
this.initSettings(); this.initSettings();
this.initObserver(); this.initObserver();
//Temp timeout, defer //Settings button
setTimeout(function() { $(".guilds li:first-child").after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button", style: 'background-image:url("https://a96edc24045943bce10e086d4fdfb287582825b6.googledrive.com/host/0B4q1DpUVMKCofkgwdTRpWkxYdVhhdEdDYXdFa2V3eWJvbUJ5bHM3dHFDM21taHJJem5JaUU/settings_icon.png")' })))));
//Settings button settingsPanel = new SettingsPanel();
$(".guilds li:first-child").after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button", style: 'background-image:url("https://a96edc24045943bce10e086d4fdfb287582825b6.googledrive.com/host/0B4q1DpUVMKCofkgwdTRpWkxYdVhhdEdDYXdFa2V3eWJvbUJ5bHM3dHFDM21taHJJem5JaUU/settings_icon.png")' }))))); settingsPanel.init();
quickEmoteMenu.init(false);
settingsPanel = new SettingsPanel(); $("#tc-settings-button").on("click", function(e) { settingsPanel.show(); });
settingsPanel.init();
quickEmoteMenu.init(false);
$("#tc-settings-button").on("click", function(e) { settingsPanel.show(); });
}, 3000);
} }
@ -109,10 +105,11 @@ Core.prototype.initObserver = function() {
mainObserver = new MutationObserver(function(mutations) { mainObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if(mutation.target.getAttribute('class').indexOf("titlebar") != -1) { if(mutation.target.getAttribute('class') != null) {
quickEmoteMenu.obsCallback(); if(mutation.target.getAttribute('class').indexOf("titlebar") != -1) {
quickEmoteMenu.obsCallback();
}
} }
emoteModule.obsCallback(mutation); emoteModule.obsCallback(mutation);
}); });

View File

@ -2,7 +2,7 @@
* Version: 1.2 * Version: 1.2
* Author: Jiiks | http://jiiks.net * Author: Jiiks | http://jiiks.net
* Date: 27/08/2015 - 16:36 * Date: 27/08/2015 - 16:36
* Last Update: 29/08/2015 - 11:48 * Last Update: 29/08/2015 - 22:00
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
*/ */
@ -63,19 +63,15 @@ Core.prototype.init = function() {
this.initSettings(); this.initSettings();
this.initObserver(); this.initObserver();
//Temp timeout, defer //Settings button
setTimeout(function() { $(".guilds li:first-child").after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button", style: 'background-image:url("https://a96edc24045943bce10e086d4fdfb287582825b6.googledrive.com/host/0B4q1DpUVMKCofkgwdTRpWkxYdVhhdEdDYXdFa2V3eWJvbUJ5bHM3dHFDM21taHJJem5JaUU/settings_icon.png")' })))));
//Settings button settingsPanel = new SettingsPanel();
$(".guilds li:first-child").after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button", style: 'background-image:url("https://a96edc24045943bce10e086d4fdfb287582825b6.googledrive.com/host/0B4q1DpUVMKCofkgwdTRpWkxYdVhhdEdDYXdFa2V3eWJvbUJ5bHM3dHFDM21taHJJem5JaUU/settings_icon.png")' }))))); settingsPanel.init();
quickEmoteMenu.init(false);
settingsPanel = new SettingsPanel(); $("#tc-settings-button").on("click", function(e) { settingsPanel.show(); });
settingsPanel.init();
quickEmoteMenu.init(false);
$("#tc-settings-button").on("click", function(e) { settingsPanel.show(); });
}, 3000);
} }
@ -109,10 +105,11 @@ Core.prototype.initObserver = function() {
mainObserver = new MutationObserver(function(mutations) { mainObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if(mutation.target.getAttribute('class').indexOf("titlebar") != -1) { if(mutation.target.getAttribute('class') != null) {
quickEmoteMenu.obsCallback(); if(mutation.target.getAttribute('class').indexOf("titlebar") != -1) {
quickEmoteMenu.obsCallback();
}
} }
emoteModule.obsCallback(mutation); emoteModule.obsCallback(mutation);
}); });