MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / splitHidden

Function splitHidden

scripts/web_timer_main.js:447–456  ·  view source on GitHub ↗
(timeString)

Source from the content-addressed store, hash-verified

445}
446
447function splitHidden(timeString) {
448 if (!(typeof timeString === "string")) return timeString;
449 let firstNumberIndex = timeString.split("").findIndex((c) => c > 0 && c <= 9);
450 if (firstNumberIndex === -1)
451 return `<span class="hidden">${timeString}</span>`;
452
453 let hiddenPart = timeString.slice(0, firstNumberIndex);
454 let hightlightPart = timeString.slice(firstNumberIndex);
455 return `<span class="hidden">${hiddenPart}</span>${hightlightPart}`;
456}
457
458function formatSeconds(sec, keepAll = false) {
459 if (FormatCache.has(sec)) return FormatCache.get(sec);

Callers 1

showDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected