1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-30 14:34:09 +02:00

Load edit-design plugin configuration dialog lazily

This commit is contained in:
chylex 2018-08-17 07:53:43 +02:00
parent b865074c32
commit ab3d8b0ae2

View File

@ -2,7 +2,6 @@ enabled(){
// elements & data // elements & data
this.css = null; this.css = null;
this.icons = null; this.icons = null;
this.htmlModal = null;
this.config = null; this.config = null;
this.defaultConfig = { this.defaultConfig = {
@ -41,13 +40,6 @@ enabled(){
const me = this; const me = this;
// modal dialog loading
$TDP.readFileRoot(this.$token, "modal.html").then(contents => {
this.htmlModal = contents;
}).catch(err => {
$TD.alert("error", "Problem loading data for the design edit plugin: "+err.message);
});
// configuration // configuration
const configFile = "config.json"; const configFile = "config.json";
@ -112,7 +104,7 @@ enabled(){
// settings click event // settings click event
this.onSettingsMenuClickedEvent = () => { this.onSettingsMenuClickedEvent = () => {
return if this.htmlModal === null || this.config === null; return if this.config === null;
setTimeout(() => { setTimeout(() => {
let menu = $(".js-dropdown-content").children("ul").first(); let menu = $(".js-dropdown-content").children("ul").first();
@ -268,13 +260,17 @@ enabled(){
}, 1); }, 1);
}); });
}).methods({ }).methods({
_render: () => $(this.htmlModal), _render: function(){
return $(me.htmlModal);
},
destroy: function(){ destroy: function(){
if (this.reloadPage){ if (this.reloadPage){
window.TDPF_requestReload(); window.TDPF_requestReload();
return; return;
} }
delete me.htmlModal;
$("#td-design-plugin-modal").hide(); $("#td-design-plugin-modal").hide();
this.supr(); this.supr();
} }
@ -670,7 +666,12 @@ ready(){
} }
configure(){ configure(){
new this.customDesignModal(); $TDP.readFileRoot(this.$token, "modal.html").then(contents => {
this.htmlModal = contents;
new this.customDesignModal();
}).catch(err => {
$TD.alert("error", "Error loading the configuration dialog: "+err.message);
});
} }
disabled(){ disabled(){