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
IgorA100 2026-03-13 11:48:12 +03:00 committed by GitHub
parent dcd3ef06ad
commit 040f461b86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 8 deletions

View File

@ -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!!!*/