MCPcopy Create free account
hub / github.com/JKPotato-Computer/SignMaker / monitorActionMessage

Function monitorActionMessage

js/main.js:1655–1736  ·  view source on GitHub ↗
(i, p)

Source from the content-addressed store, hash-verified

1653 }
1654
1655 function monitorActionMessage(i, p) {
1656 /*
1657 i: Array
1658 p: Parent (element)
1659 */
1660
1661 if (i.actionMessage != "") {
1662 if (post.fontType == true) {
1663 p.style.fontFamily = "Series E";
1664 } else {
1665 p.style.fontFamily = "Clearview 5WR";
1666 }
1667 p.style.visibility = "visible";
1668 p.style.display = "inline-flex";
1669 p.className = `actionMessage action_message`;
1670 const txtArr = i.actionMessage.split(/(\d+\S*)/);
1671 const txtFrac = txtArr[0].split(/([\u00BC-\u00BE]+\S*)/);
1672
1673 p.appendChild(document.createTextNode(txtFrac[0]));
1674
1675
1676
1677 if (((i.actionMessage.includes("½")) || (i.actionMessage.includes("¼")) || (i.actionMessage.includes("¾"))) && (txtArr.length > 2)) {
1678 const spanElmt = document.createElement("span");
1679 spanElmt.className = "numeral special";
1680
1681 if (post.fontType) {
1682 spanElmt.style.fontSize = "1.5rem";
1683 }
1684
1685 spanElmt.appendChild(document.createTextNode(txtArr[1]));
1686 p.appendChild(spanElmt);
1687
1688 const spanFractionElmt = document.createElement("span");
1689 spanFractionElmt.className = "fraction special";
1690
1691 if (post.fontType) {
1692 spanFractionElmt.style.fontSize = "1.15rem";
1693 spanFractionElmt.style.top = "-0.15rem";
1694 spanFractionElmt.style.position = "relative";
1695 }
1696
1697
1698 spanFractionElmt.appendChild(document.createTextNode(txtArr[2].split(/([\u00BC-\u00BE]+\S*)/)[1]));
1699 p.appendChild(spanFractionElmt);
1700 p.appendChild(document.createTextNode(txtArr[2].split(/([\u00BC-\u00BE]+\S*)/).slice(2).join("")));
1701
1702
1703 } else {
1704 if (txtArr.length > 1) {
1705 const spanElmt = document.createElement("span");
1706 spanElmt.className = "numeral";
1707
1708 if (post.fontType) {
1709 spanElmt.style.fontSize = "1.5rem";
1710 }
1711
1712 spanElmt.appendChild(document.createTextNode(txtArr[1]));

Callers 1

redrawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected