mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
fix chrome compatibility issue for description text reveal, #327
This commit is contained in:
parent
0bba36cbc3
commit
40eff8e30e
@ -1102,12 +1102,12 @@ function textReveal() {
|
|||||||
function textExpand() {
|
function textExpand() {
|
||||||
var textBox = document.getElementById("text-expand");
|
var textBox = document.getElementById("text-expand");
|
||||||
var button = document.getElementById("text-expand-button");
|
var button = document.getElementById("text-expand-button");
|
||||||
var textBoxLineClamp = textBox.style["-webkit-line-clamp"];
|
var style = window.getComputedStyle(textBox)
|
||||||
if (textBoxLineClamp === "none") {
|
if (style.webkitLineClamp === "none") {
|
||||||
textBox.style["-webkit-line-clamp"] = "4";
|
textBox.style["-webkit-line-clamp"] = "4";
|
||||||
button.innerText = "Show more";
|
button.innerText = "Show more";
|
||||||
} else {
|
} else {
|
||||||
textBox.style["-webkit-line-clamp"] = "none";
|
textBox.style["-webkit-line-clamp"] = "unset";
|
||||||
button.innerText = "Show less";
|
button.innerText = "Show less";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1119,8 +1119,9 @@ function textExpandButtonVisibilityUpdate() {
|
|||||||
if (!textBox || !button)
|
if (!textBox || !button)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var textBoxLineClamp = textBox.style["-webkit-line-clamp"];
|
var styles = window.getComputedStyle(textBox);
|
||||||
if (textBoxLineClamp === "none")
|
var textBoxLineClamp = styles.webkitLineClamp;
|
||||||
|
if (textBoxLineClamp === "unset")
|
||||||
return; // text box is in revealed state
|
return; // text box is in revealed state
|
||||||
|
|
||||||
if (textBox.offsetHeight < textBox.scrollHeight
|
if (textBox.offsetHeight < textBox.scrollHeight
|
||||||
|
Loading…
Reference in New Issue
Block a user