1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-20 12:15:51 +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,24 +58,30 @@ enabled(){
this.firstTimeLoad = obj === null; this.firstTimeLoad = obj === null;
this.onStageReady(); this.onStageReady();
this.injectDeciderReplyHook(this.tmpConfig.revertReplies); this.injectDeciderReplyHook(obj && obj.revertReplies);
}; };
$(document).one("dataSettingsValues", () => { if (this.wasLoadedBefore){
switch(TD.settings.getColumnWidth()){
case "wide": this.defaultConfig.columnWidth = "350px"; break;
case "narrow": this.defaultConfig.columnWidth = "270px"; break;
}
switch(TD.settings.getFontSize()){
case "small": this.defaultConfig.fontSize = "13px"; break;
case "medium": this.defaultConfig.fontSize = "14px"; break;
case "large": this.defaultConfig.fontSize = "15px"; break;
case "largest": this.defaultConfig.fontSize = "16px"; break;
}
this.onStageReady(); this.onStageReady();
}); }
else{
$(document).one("dataSettingsValues", () => {
switch(TD.settings.getColumnWidth()){
case "wide": this.defaultConfig.columnWidth = "350px"; break;
case "narrow": this.defaultConfig.columnWidth = "270px"; break;
}
switch(TD.settings.getFontSize()){
case "small": this.defaultConfig.fontSize = "13px"; break;
case "medium": this.defaultConfig.fontSize = "14px"; break;
case "large": this.defaultConfig.fontSize = "15px"; break;
case "largest": this.defaultConfig.fontSize = "16px"; break;
}
this.wasLoadedBefore = true;
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();
} }