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

Function getTodayTimer

scripts/web_timer.js:457–470  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

455 }
456
457 async function getTodayTimer() {
458 let host =
459 location.hostname ||
460 location.pathname?.split("/")?.at(-1) ||
461 location.href;
462 let today = getToday();
463 let web_timer = (await chrome.storage.local.get(["web_timer"]))?.web_timer;
464 if (typeof web_timer !== "object") web_timer = {};
465 if (typeof web_timer[today] !== "object") web_timer[today] = {};
466 if (!web_timer[today][host]) web_timer[today][host] = 0;
467 let value = Math.floor(web_timer[today][host]);
468
469 return { web_timer, host, today, value };
470 }
471
472 function getToday() {
473 return formatDate(new Date());

Callers 2

runFunction · 0.85
saveTimerFunction · 0.85

Calls 2

getTodayFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected