Instead of "setTextSizeOnInfoBlock," we now use the new "setTextSizeOnInfoBlocks" function, which sets the text size for all blocks. (skin.js)
"setTextSizeOnInfoBlock" sets the text size for a specific block and is now used in MonitorStream.js.pull/4709/head
parent
dcd3ef06ad
commit
040f461b86
|
|
@ -1863,18 +1863,22 @@ function calcTextSizeOnInfoBlock(el) {
|
|||
return parseInt((w/textLength) * 0.6 / d); // ~40% of the block width
|
||||
}
|
||||
|
||||
function setTextSizeOnInfoBlock() {
|
||||
function setTextSizeOnInfoBlocks() {
|
||||
const block = document.querySelectorAll('[id ^= "stream-info-block"]');
|
||||
Array.prototype.forEach.call(block, (el) => {
|
||||
if (el.innerText.length == 0) return;
|
||||
const fontSize = calcTextSizeOnInfoBlock(el);
|
||||
el.style.fontSize = fontSize + "px";
|
||||
el.classList.remove("text-3d-mini", "text-3d");
|
||||
const blockClass = (fontSize !== fontSize || fontSize < 50) ? 'text-3d-mini' : 'text-3d';
|
||||
el.classList.add(blockClass);
|
||||
setTextSizeOnInfoBlock(el);
|
||||
});
|
||||
}
|
||||
|
||||
function setTextSizeOnInfoBlock(el) {
|
||||
if (el.innerText.length == 0) return;
|
||||
const fontSize = calcTextSizeOnInfoBlock(el);
|
||||
el.style.fontSize = fontSize + "px";
|
||||
el.classList.remove("text-3d-mini", "text-3d");
|
||||
const blockClass = (fontSize !== fontSize || fontSize < 50) ? 'text-3d-mini' : 'text-3d';
|
||||
el.classList.add(blockClass);
|
||||
}
|
||||
|
||||
/*
|
||||
* date - object type Date()
|
||||
* shift.offset - number (can be negative)
|
||||
|
|
@ -2789,7 +2793,7 @@ function monitorsSetScale(id=null) {
|
|||
}
|
||||
} // End function _setScale
|
||||
setButtonSizeOnStream();
|
||||
setTextSizeOnInfoBlock();
|
||||
setTextSizeOnInfoBlocks();
|
||||
} // End function monitorsSetScale
|
||||
|
||||
/*IMPORTANT DO NOT CALL WITHOUT CONSCIOUS NEED!!!*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue