1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-28 18:15:47 +02:00

Add checkbox support to edit-design plugin and delay theme change

This commit is contained in:
chylex 2017-03-25 14:40:28 +01:00
parent a315ed90af
commit 9fed8c022b
2 changed files with 25 additions and 3 deletions
Resources/Plugins/edit-design

View File

@ -111,15 +111,30 @@ enabled(){
modal.find("[data-td-key]").each(function(){
let item = $(this);
let tag = item.prop("tagName");
let key = item.attr("data-td-key");
if (item.prop("tagName") === "SELECT"){
// INPUTS
if (tag === "INPUT"){
let type = item.attr("type");
if (type === "checkbox"){
item.prop("checked", me.config[key]);
item.change(function(){
updateKey(key, item.prop("checked"));
});
}
}
// SELECTS
else if (tag === "SELECT"){
item.val(me.config[key]);
item.change(function(){
updateKey(key, item.val());
});
}
// CUSTOM ELEMENTS
else{
let value = item.attr("data-td-value");
@ -138,8 +153,10 @@ enabled(){
modal.find("[data-td-theme='"+TD.settings.getTheme()+"']").prop("checked", true);
modal.find("[data-td-theme]").change(function(){
TD.settings.setTheme($(this).attr("data-td-theme"));
$(document).trigger("uiToggleTheme");
setTimeout(function(){
TD.settings.setTheme($(this).attr("data-td-theme"));
$(document).trigger("uiToggleTheme");
}, 1);
});
}).methods({
_render: () => $(this.htmlModal),

View File

@ -142,6 +142,11 @@
cursor: pointer;
}
.td-modal-content label.checkbox {
margin: 6px 16px 5px 4px;
cursor: pointer;
}
/* Avatar shape */
.td-avatar-shape-container {