1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-02 20:34:07 +02:00

Fix errors in edit-design plugin when disabling/enabling

This commit is contained in:
chylex 2017-06-05 14:43:14 +02:00
parent a753806d7b
commit ca4d374a81

View File

@ -58,9 +58,13 @@ enabled(){
this.firstTimeLoad = obj === null; this.firstTimeLoad = obj === null;
this.onStageReady(); this.onStageReady();
this.injectDeciderReplyHook(this.tmpConfig.revertReplies); this.injectDeciderReplyHook(obj && obj.revertReplies);
}; };
if (this.wasLoadedBefore){
this.onStageReady();
}
else{
$(document).one("dataSettingsValues", () => { $(document).one("dataSettingsValues", () => {
switch(TD.settings.getColumnWidth()){ switch(TD.settings.getColumnWidth()){
case "wide": this.defaultConfig.columnWidth = "350px"; break; case "wide": this.defaultConfig.columnWidth = "350px"; break;
@ -74,8 +78,10 @@ enabled(){
case "largest": this.defaultConfig.fontSize = "16px"; break; case "largest": this.defaultConfig.fontSize = "16px"; break;
} }
this.wasLoadedBefore = true;
this.onStageReady(); this.onStageReady();
}); });
}
$TDP.checkFileExists(this.$token, configFile).then(exists => { $TDP.checkFileExists(this.$token, configFile).then(exists => {
if (!exists){ if (!exists){
@ -306,13 +312,13 @@ enabled(){
}; };
this.onWindowFocusEvent = () => { this.onWindowFocusEvent = () => {
if (this.config.optimizeAnimations){ if (this.config && this.config.optimizeAnimations){
injectOptimizations(true); injectOptimizations(true);
} }
}; };
this.onWindowBlurEvent = () => { this.onWindowBlurEvent = () => {
if (this.config.optimizeAnimations){ if (this.config && this.config.optimizeAnimations){
disableOptimizations(); disableOptimizations();
clearOptimizationTimer(); clearOptimizationTimer();
} }