Added Tooltip delay to ShowImageDetails
This commit is contained in:
parent
ad86a86306
commit
34120848b5
|
@ -86,7 +86,7 @@ class ShowHiddenChannels {
|
|||
|
||||
getDescription () {return "Displays channels that are hidden from you by role restrictions.";}
|
||||
|
||||
getVersion () {return "2.3.4";}
|
||||
getVersion () {return "2.3.5";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -256,7 +256,6 @@ class ShowHiddenChannels {
|
|||
|
||||
|
||||
var settings = BDFDB.getAllData(this, "settings");
|
||||
var hoverDelay = BDFDB.getData("hoverDelay", this, "amounts");
|
||||
var count = 0;
|
||||
for (let type in this.ChannelTypes) {
|
||||
if (!settings.showText && type == "GUILD_TEXT" || !settings.showVoice && type == "GUILD_VOICE" || !settings.showCategory && type == "GUILD_CATEGORY") {
|
||||
|
@ -322,8 +321,7 @@ class ShowHiddenChannels {
|
|||
channelsvg.classList.toggle(BDFDB.disCN.channelcolorhoveredtext);
|
||||
channelname.classList.toggle(BDFDB.disCN.channelnamedefaulttext);
|
||||
channelname.classList.toggle(BDFDB.disCN.channelnamehoveredtext);
|
||||
clearTimeout(this.hoverTimer);
|
||||
this.hoverTimer = setTimeout(() => {this.showAccessRoles(serverObj, hiddenChannel, e, false);}, hoverDelay);
|
||||
this.showAccessRoles(serverObj, hiddenChannel, e, false);
|
||||
})
|
||||
.on("click", () => {
|
||||
BDFDB.showToast(`You can not enter the hidden textchannel ${hiddenChannel.name}.`, {type:"error"});
|
||||
|
@ -351,8 +349,7 @@ class ShowHiddenChannels {
|
|||
channelsvg.classList.toggle(BDFDB.disCN.channelcolorhoveredvoice);
|
||||
channelname.classList.toggle(BDFDB.disCN.channelnamedefaultvoice);
|
||||
channelname.classList.toggle(BDFDB.disCN.channelnamehoveredvoice);
|
||||
clearTimeout(this.hoverTimer);
|
||||
this.hoverTimer = setTimeout(() => {this.showAccessRoles(serverObj, hiddenChannel, e, false);}, hoverDelay);
|
||||
this.showAccessRoles(serverObj, hiddenChannel, e, false);
|
||||
})
|
||||
.on("click", () => {
|
||||
BDFDB.showToast(`You can not enter the hidden voicechannel ${hiddenChannel.name}.`, {type:"error"});
|
||||
|
@ -377,8 +374,7 @@ class ShowHiddenChannels {
|
|||
channelsvg.classList.toggle(BDFDB.disCN.categoryiconhoveredcollapsed);
|
||||
channelname.classList.toggle(BDFDB.disCN.categorynamecollapsed);
|
||||
channelname.classList.toggle(BDFDB.disCN.categorynamehoveredcollapsed);
|
||||
clearTimeout(this.hoverTimer);
|
||||
this.hoverTimer = setTimeout(() => {this.showAccessRoles(serverObj, hiddenChannel, e, false);}, hoverDelay);
|
||||
this.showAccessRoles(serverObj, hiddenChannel, e, false);
|
||||
})
|
||||
.on("click", () => {
|
||||
BDFDB.showToast(`You can not open the hidden category ${hiddenChannel.name}.`, {type:"error"});
|
||||
|
@ -412,10 +408,7 @@ class ShowHiddenChannels {
|
|||
$(channelist)
|
||||
.on("mouseenter." + this.getName(), BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault, (e) => {
|
||||
var channel = BDFDB.getKeyInformation({"node":e.currentTarget,"key":"channel"});
|
||||
if (channel) this.hoverTimer = setTimeout(() => {this.showAccessRoles(serverObj, channel, e, false);}, hoverDelay);
|
||||
})
|
||||
.on("mouseleave." + this.getName(), BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault, () => {
|
||||
clearTimeout(this.hoverTimer);
|
||||
if (channel) this.showAccessRoles(serverObj, channel, e, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +515,7 @@ class ShowHiddenChannels {
|
|||
}
|
||||
if (htmlString) {
|
||||
var width = window.outerWidth/2;
|
||||
var tooltip = BDFDB.createTooltip(htmlString, e.currentTarget, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`});
|
||||
var tooltip = BDFDB.createTooltip(htmlString, e.currentTarget, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.getData("hoverDelay", this, "amounts")});
|
||||
tooltip.style.top = tooltip.style.top.replace("px","") - $(e.currentTarget).css("padding-bottom").replace("px","")/2 + $(e.currentTarget).css("padding-top").replace("px","")/2 + "px";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ class ShowImageDetails {
|
|||
this.defaults = {
|
||||
settings: {
|
||||
showOnHover: {value:false, description:"Show the details as Tooltip instead:"}
|
||||
},
|
||||
amounts: {
|
||||
hoverDelay: {value:0, description:"Tooltip delay in millisec:"}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -27,17 +30,21 @@ class ShowImageDetails {
|
|||
|
||||
getDescription () {return "Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.";}
|
||||
|
||||
getVersion () {return "1.0.8";}
|
||||
getVersion () {return "1.0.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
getSettingsPanel () {
|
||||
if (!this.started || typeof BDFDB !== "object") return;
|
||||
var settings = BDFDB.getAllData(this, "settings");
|
||||
var settings = BDFDB.getAllData(this, "settings");
|
||||
var amounts = BDFDB.getAllData(this, "amounts");
|
||||
var settingshtml = `<div class="${this.getName()}-settings DevilBro-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.getName()}</div><div class="DevilBro-settings-inner">`;
|
||||
for (let key in settings) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner}"${settings[key] ? " checked" : ""}></div></div>`;
|
||||
}
|
||||
for (let key in amounts) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.flex2 + BDFDB.disCNS.horizontal + BDFDB.disCNS.horizontal2 + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.title + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%; line-height: 38px;">${this.defaults.amounts[key].description}</h3><div class="${BDFDB.disCN.inputwrapper} inputNumberWrapper ${BDFDB.disCNS.vertical + BDFDB.disCNS.flex + BDFDB.disCNS.directioncolumn}" style="flex: 1 1 auto;"><span class="numberinput-buttons-zone"><span class="numberinput-button-up"></span><span class="numberinput-button-down"></span></span><input type="number" min="0" option="${key}" value="${amounts[key]}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.size16} amountInput"></div></div>`;
|
||||
}
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
var settingspanel = $(settingshtml)[0];
|
||||
|
@ -45,7 +52,12 @@ class ShowImageDetails {
|
|||
BDFDB.initElements(settingspanel);
|
||||
|
||||
$(settingspanel)
|
||||
.on("click", BDFDB.dotCN.switchinner, () => {this.updateSettings(settingspanel);});
|
||||
.on("click", BDFDB.dotCN.switchinner, () => {this.updateSettings(settingspanel);})
|
||||
.on("input", ".amountInput", (e) => {
|
||||
var input = parseInt(e.currentTarget.value);
|
||||
if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
|
||||
});
|
||||
|
||||
return settingspanel;
|
||||
}
|
||||
|
||||
|
@ -153,7 +165,7 @@ class ShowImageDetails {
|
|||
}
|
||||
else {
|
||||
$(image).on("mouseenter." + this.getName(), () => {
|
||||
BDFDB.createTooltip(`<div class="image-details-tooltip-name">${data.filename}</div><div class="image-details-tooltip-size">${BDFDB.formatBytes(data.size)}</div><div class="image-details-tooltip-dimensions">${data.width}x${data.height}px</div>`, image, {type:"right", html:true, selector:"image-details-tooltip"});
|
||||
BDFDB.createTooltip(`<div class="image-details-tooltip-name">${data.filename}</div><div class="image-details-tooltip-size">${BDFDB.formatBytes(data.size)}</div><div class="image-details-tooltip-dimensions">${data.width}x${data.height}px</div>`, image, {type:"right", html:true, selector:"image-details-tooltip", delay:BDFDB.getData("hoverDelay", this, "amounts")});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue