1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-11 12:15:44 +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
this.css = null;
this.icons = null;
this.htmlModal = null;
this.config = null;
this.defaultConfig = {
@ -41,13 +40,6 @@ enabled(){
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
const configFile = "config.json";
@ -112,7 +104,7 @@ enabled(){
// settings click event
this.onSettingsMenuClickedEvent = () => {
return if this.htmlModal === null || this.config === null;
return if this.config === null;
setTimeout(() => {
let menu = $(".js-dropdown-content").children("ul").first();
@ -268,13 +260,17 @@ enabled(){
}, 1);
});
}).methods({
_render: () => $(this.htmlModal),
_render: function(){
return $(me.htmlModal);
},
destroy: function(){
if (this.reloadPage){
window.TDPF_requestReload();
return;
}
delete me.htmlModal;
$("#td-design-plugin-modal").hide();
this.supr();
}
@ -670,7 +666,12 @@ ready(){
}
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(){