diff --git a/dists/css/sunorhc.timeline.css.gz b/dists/css/sunorhc.timeline.css.gz new file mode 100644 index 0000000..e247cfb Binary files /dev/null and b/dists/css/sunorhc.timeline.css.gz differ diff --git a/dists/js/Tester.js b/dists/js/Tester.js index d1a8243..bffe195 100644 --- a/dists/js/Tester.js +++ b/dists/js/Tester.js @@ -1,12 +1,12 @@ -(function(g,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(g=typeof globalThis<"u"?globalThis:g||self,p(g.Sunorhc={}))})(this,function(g){"use strict";function p(i){var h;const x={toggleRtl:`
- +(function(g,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(g=typeof globalThis<"u"?globalThis:g||self,p(g.Sunorhc={}))})(this,function(g){"use strict";function p(i){var h;const v={toggleRtl:`
+
`,selectTimeZone:`
- +
`,selectOutlined:`
- +
`,selectElevation:`
- +
`,selectPlacement:`
- +
`,selectCanvasLayout:`
- +
`,selectStartWeekday:`
- +
`,selectAlignment:`
- +
`,rowHeight:`
- +
`,toggleScaleTracker:`
- +
`,verticalDivider:'
',togglePresentMarker:`
- +
`,toggleDayColored:`
- +
`,toggleTooltip:`
- +
`,selectEventOpener:`
- +
@@ -181,8 +181,8 @@
-
`},v=["selectTimeZone","selectStartWeekday","togglePresentMarker","verticalDivider","toggleRtl","selectOutlined","selectElevation","selectPlacement","selectCanvasLayout","toggleDayColored","grainWidth","rowHeight","verticalDivider","selectAlignment","toggleTooltip","selectEventOpener","runReload","verticalDivider","toggleScaleTracker","scaleSwitcher","optionViewer"];let f=`
+
`},x=["selectTimeZone","selectStartWeekday","togglePresentMarker","verticalDivider","toggleRtl","selectOutlined","selectElevation","selectPlacement","selectCanvasLayout","toggleDayColored","grainWidth","rowHeight","verticalDivider","selectAlignment","toggleTooltip","selectEventOpener","runReload","verticalDivider","toggleScaleTracker","scaleSwitcher","optionViewer"];let f=`

-

Timeline Instance Controller

+

Timeline Instance Controller

-
`;v.forEach(a=>{f+=x[a]}),f+="
",i.innerHTML=f;const T=(a,o)=>{const n=document.getElementById("tester-modal"),r=document.getElementById("tester-modal-headline"),l=document.getElementById("tester-modal-body");r.innerHTML=a,l.innerHTML=o,n.classList.contains("opacity-0")&&(n.classList.add("opacity-1"),n.classList.remove("opacity-0"))},m=document.querySelectorAll(".sunorhc-timeline-container");window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("Dark mode now"),m.forEach(a=>a.classList.add("dark-theme"))):(console.log("Light mode now"),m.forEach(a=>a.classList.remove("dark-theme"))),(h=window==null?void 0:window.matchMedia("(prefers-color-scheme: dark)"))==null||h.addEventListener("change",a=>{const o=a.matches;console.log("Changed mode:",o?"dark":"light",a),m.forEach(n=>o?n.classList.add("dark-theme"):n.classList.remove("dark-theme"))});const S=document.querySelector(".darkmode-toggle");Object.assign(S.style,{zIndex:9999,boxShadow:"0px 5px 20px 1px rgba(0, 0, 0, 0.4)"}),new MutationObserver(a=>{for(const o of a)o.type==="attributes"&&o.attributeName==="class"&&(o.target.classList.contains("darkmode--activated")?m.forEach(r=>r.classList.add("dark-theme")):m.forEach(r=>r.classList.remove("dark-theme")))}).observe(document.body,{attributes:!0,childList:!1,subtree:!1}),i.querySelector("#toggle-rtl").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().layout;l.rtl=o.checked,r.reload({layouts:l})}}),i.querySelector("#select-timezone").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances)window.SunorhcTimelineInstances[n].reload({timezone:o.value})}),i.querySelector("#select-outlined").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().layout;l.outlined=o.value,r.reload({layouts:l})}}),i.querySelector("#select-elevation").addEventListener("change",a=>{document.querySelectorAll(".sunorhc-timeline-container").forEach(n=>{const r=a.currentTarget;n.dataset.timelineElevation=r.value!==""?r.value:""})}),i.querySelector("#select-placement").addEventListener("change",a=>{const o=a.currentTarget,[n,r]=o.value.split(":");if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const l in window.SunorhcTimelineInstances){const e=window.SunorhcTimelineInstances[l],s=e.getOptions();let t=null;n==="sidebar"?(t={sidebar:s.sidebar},t.sidebar.placement=r):(t={ruler:s.ruler},t.ruler.placement=r),e.reload(t)}}),i.querySelector("#select-canvas-layout").addEventListener("change",a=>{document.querySelectorAll(".sunorhc-timeline-nodes").forEach(n=>{const r=a.currentTarget;n.dataset.background=r.value!==""?r.value:""})}),i.querySelector("#select-start-weekday").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().ruler;l.firstDayOfWeek=Number(o.value),r.reload({ruler:l})}}),i.querySelector("#select-alignment").addEventListener("change",a=>{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const o in window.SunorhcTimelineInstances){const n=a.currentTarget;window.SunorhcTimelineInstances[o].align(n.value,r=>{console.log("Do Alignment:",n.value,r)})}}),i.querySelector("#run-reload").addEventListener("click",()=>{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances)document.getElementById(a).classList.add("preparing"),setTimeout(()=>{const n=window.SunorhcTimelineInstances[a].getOptions();let r={effects:{defaultAlignment:"end"}};if(n.hasOwnProperty("extends")&&n.extends.hasOwnProperty("originOptions")){const l=n.extends.originOptions,e={start:l.start,end:l.end,scale:l.scale,sidebar:l.sidebar,ruler:l.ruler},s=parseInt(i.querySelector("#grain-width").value||"48",10),t=parseInt(i.querySelector("#row-height").value||"80",10);isNaN(s)||(e.ruler.minGrainWidth=`${s}px`),isNaN(t)||(e.sidebar.itemHeight=`${t}px`),r={...r,...e},console.log("originOptions:",e,r)}window.SunorhcTimelineInstances[a].reload(r,l=>{console.log("Reloaded:",l),window.scrollTo({left:0,top:l.targetElement.offsetTop,behavior:"smooth"})})},300)}),i.querySelector("#toggle-scale-tracker").addEventListener("change",a=>{const o=a.currentTarget;try{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n].getOptions().extends??{};if(r.hasOwnProperty("zoomScaleTracker")&&r.zoomScaleTracker){const l=document.getElementById(n);let e;if(o.checked)e=document.createElement("div"),e.classList.add("zoom-scale-coordinates-tracker"),e.setAttribute("style","position: absolute; bottom: 6px; left: 4px; display: none; flex-wrap: wrap; justify-content: start; text-align: left; font-size: 12px; color: #555; background-color: #fff; border: solid 1px #999; border-radius: 4px; width: max-content; max-width: 50%; height: max-content; padding: 3px 6px; box-shadow: 4px 4px 4px rgba(21,21,21,.25); z-index: 9999;"),l.querySelector(".sunorhc-timeline-footer").append(e);else if(e=l.querySelector(".zoom-scale-coordinates-tracker"),e)l.querySelector(".sunorhc-timeline-footer").removeChild(e);else throw new Error("Scale Tracker does not exists.")}else throw new Error("No extends for Scale Tracker in options.")}else throw new Error("No valid timeline instance.")}catch(n){console.error("Could not activate Scale Tracker:",n),o.checked=!1}}),i.querySelector("#toggle-present-marker").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().effects;l.presentTime=o.checked,r.reload({effects:l})}}),i.querySelector("#toggle-day-colored").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().ruler;l.hasOwnProperty("filters")?l.filters.dayBackgroundColor=o.checked:l.filters={dayBackgroundColor:o.checked},r.reload({ruler:l})}}),i.querySelector("#toggle-tooltip").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.getOptions().effects;l.hoverEvent=o.checked,r.reload({effects:l})}}),i.querySelector("#select-event-opener").addEventListener("change",a=>{var r,l,e;const o=a.currentTarget,n=document.getElementById("sunorhc-timeline-modal");if(n&&((r=n.parentNode)==null||r.removeChild(n)),o.value==="normal"?(l=document.getElementById("sunorhc-timeline-event-details"))==null||l.classList.remove("hidden"):(e=document.getElementById("sunorhc-timeline-event-details"))==null||e.classList.add("hidden"),window.hasOwnProperty("SunorhcTimelineInstances"))for(const s in window.SunorhcTimelineInstances){const t=window.SunorhcTimelineInstances[s],c=t.getOptions().effects;if(/^modal/.test(o.value)){const[u,d]=o.value.split(":");c.onClickEvent=u,c.template.modal.size=d==="960"?Number(d):d}else c.onClickEvent=o.value;t.reload({effects:c})}}),i.querySelector("#select-scale").addEventListener("change",a=>{const o=a.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[n],l=r.measurements;let e=r.getOptions();e.scale=o.value,e.start="currently",e.end="auto",e.ruler.hasOwnProperty("filters")&&e.ruler.filters.hasOwnProperty("decorations")?e.ruler.filters.decorations={year:void 0,day:void 0,minute:void 0}:e.ruler.filters={decorations:{}};const s=e.ruler.filters;let t=new Date,c=s.monthNames&&Array.isArray(s.monthNames)?s.monthNames[e.timezone==="UTC"?t.getUTCMonth():t.getMonth()]:e.timezone==="UTC"?t.getUTCMonth()+1:t.getMonth()+1,u=s.dayNames&&Array.isArray(s.dayNames)?s.dayNames[e.timezone==="UTC"?t.getUTCDay():t.getDay()]:e.timezone==="UTC"?t.getUTCDay():t.getDay(),d,y,w;switch(o.value){case"year":e.ruler.minGrainWidth=Math.max(160,Math.ceil(l.rulerVisibleWidth/10)),e.ruler.top.rows=["year"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"month":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),e.start=`${t.getFullYear()}-01-01T00:00:00.000`,e.end=`${t.getFullYear()}-12-31T23:59:59.999`,e.ruler.minGrainWidth=Math.max(120,Math.ceil(l.rulerVisibleWidth/12)),e.ruler.top.rows=["year","month"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"week":e.ruler.minGrainWidth=Math.max(80,Math.ceil(l.rulerVisibleWidth/53)),e.ruler.top.rows=["year","month","week"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"day":e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/31)),e.ruler.top.rows=["year","month","week","day","weekday"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"hour":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),e.start=t,e.end=new Date(t.getTime()+24*60*60*1e3),e.ruler.minGrainWidth=Math.max(80,Math.ceil(l.rulerVisibleWidth/24)),e.ruler.top.rows=["day","hour"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),d=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),e.ruler.filters.decorations.day={replacer:`${u}, %s ${c} ${d}`};break;case"minute":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0,0),e.start=t,e.end=new Date(t.getTime()+60*60*1e3),e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/60)),e.ruler.top.rows=["day","hour","minute"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),d=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),e.ruler.filters.decorations.day={replacer:`${u}, %s ${c} ${d}`};break;case"second":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),0,0),e.start=t,e.end=new Date(t.getTime()+60*1e3),e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/60)),e.ruler.top.rows=["day","minute","second"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),d=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),y=String(e.timezone==="UTC"?t.getUTCHours():t.getHours()).padStart(2,"0"),w=String(e.timezone==="UTC"?t.getUTCMinutes():t.getMinutes()).padStart(2,"0"),e.ruler.filters.decorations.day={replacer:`${u}, %s ${c} ${d}`},e.ruler.filters.decorations.minute={replacer:`${y}:${w}`};break;default:return}const k=document.getElementById("toggle-scale-tracker");k.checked&&(k.checked=!1),r.reload(e)}});let b=0;i.querySelector("#view-options").addEventListener("click",()=>{b=window.scrollY;const a=window.innerWidth-document.documentElement.clientWidth;if(document.body.style.position="fixed",document.body.style.top=`-${b}px`,document.body.style.width=`calc(100% - ${a}px)`,window.hasOwnProperty("SunorhcTimelineInstances"))for(const o in window.SunorhcTimelineInstances){const n=window.SunorhcTimelineInstances[o].getOptions();if(n){const r=``;T("Current Timeline Options",r);break}}}),document.querySelectorAll('button[data-modal-hide="tester-modal"]').forEach(a=>{a.addEventListener("click",()=>{document.body.style.position="",document.body.style.top="",document.body.style.width="",window.scrollTo({top:b,left:0,behavior:"instant"});const o=document.getElementById("tester-modal");o.classList.contains("opacity-1")&&(o.classList.add("opacity-0"),o.classList.remove("opacity-1"))})}),document.getElementById("download-json").addEventListener("click",a=>{const o=a.currentTarget,n=o.getAttribute("class")||"",r=o.textContent;if(o.setAttribute("disabled",""),o.setAttribute("class","text-white bg-blue-400 dark:bg-blue-500 cursor-not-allowed font-medium rounded-lg text-sm px-5 py-2.5 text-center"),o.textContent="Downloading...",window.hasOwnProperty("SunorhcTimelineInstances"))for(const l in window.SunorhcTimelineInstances){const e=window.SunorhcTimelineInstances[l].getOptions();if(e){const s="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),t=document.createElement("a");t.setAttribute("href",s),(async()=>btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${performance.now()*1e6}`))))))().then(u=>{t.setAttribute("download",`TimelineOptions-${u}.json`),document.body.appendChild(t),t.click(),t.remove()}).catch(u=>{console.error("Failed to download:",u)}).finally(()=>{setTimeout(()=>{o.removeAttribute("disabled"),o.setAttribute("class",n),o.textContent=r},300)});break}}}),i.querySelector(".alnum-only").addEventListener("input",a=>{const o=a.currentTarget,n=o.value;o.value=n.replace(/[^a-zA-Z0-9\.]/g,"")})}g.setupTester=p,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}); +
`;x.forEach(n=>{f+=v[n]}),f+="
",i.innerHTML=f;const T=(n,o)=>{const a=document.getElementById("tester-modal"),r=document.getElementById("tester-modal-headline"),l=document.getElementById("tester-modal-body");r.innerHTML=n,l.innerHTML=o,a.classList.contains("opacity-0")&&(a.classList.add("opacity-1"),a.classList.remove("opacity-0"))},m=document.querySelectorAll(".sunorhc-timeline-container");window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("Dark mode now"),m.forEach(n=>n.classList.add("dark-theme"))):(console.log("Light mode now"),m.forEach(n=>n.classList.remove("dark-theme"))),(h=window==null?void 0:window.matchMedia("(prefers-color-scheme: dark)"))==null||h.addEventListener("change",n=>{const o=n.matches;console.log("Changed mode:",o?"dark":"light",n),m.forEach(a=>o?a.classList.add("dark-theme"):a.classList.remove("dark-theme"))});const S=document.querySelector(".darkmode-toggle");Object.assign(S.style,{zIndex:9999,boxShadow:"0px 5px 20px 1px rgba(0, 0, 0, 0.4)"}),new MutationObserver(n=>{for(const o of n)o.type==="attributes"&&o.attributeName==="class"&&(o.target.classList.contains("darkmode--activated")?m.forEach(r=>r.classList.add("dark-theme")):m.forEach(r=>r.classList.remove("dark-theme")))}).observe(document.body,{attributes:!0,childList:!1,subtree:!1}),i.querySelector("#toggle-rtl").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().layout;l.rtl=o.checked,r.reload({layouts:l})}}),i.querySelector("#select-timezone").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances)window.SunorhcTimelineInstances[a].reload({timezone:o.value})}),i.querySelector("#select-outlined").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().layout;l.outlined=o.value,r.reload({layouts:l})}}),i.querySelector("#select-elevation").addEventListener("change",n=>{document.querySelectorAll(".sunorhc-timeline-container").forEach(a=>{const r=n.currentTarget;a.dataset.timelineElevation=r.value!==""?r.value:""})}),i.querySelector("#select-placement").addEventListener("change",n=>{const o=n.currentTarget,[a,r]=o.value.split(":");if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const l in window.SunorhcTimelineInstances){const e=window.SunorhcTimelineInstances[l],s=e.getOptions();let t=null;a==="sidebar"?(t={sidebar:s.sidebar},t.sidebar.placement=r):(t={ruler:s.ruler},t.ruler.placement=r),e.reload(t)}}),i.querySelector("#select-canvas-layout").addEventListener("change",n=>{document.querySelectorAll(".sunorhc-timeline-nodes").forEach(a=>{const r=n.currentTarget;a.dataset.background=r.value!==""?r.value:""})}),i.querySelector("#select-start-weekday").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().ruler;l.firstDayOfWeek=Number(o.value),r.reload({ruler:l})}}),i.querySelector("#select-alignment").addEventListener("change",n=>{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const o in window.SunorhcTimelineInstances){const a=n.currentTarget;window.SunorhcTimelineInstances[o].align(a.value,r=>{console.log("Do Alignment:",a.value,r)})}}),i.querySelector("#run-reload").addEventListener("click",()=>{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const n in window.SunorhcTimelineInstances)document.getElementById(n).classList.add("preparing"),setTimeout(()=>{const a=window.SunorhcTimelineInstances[n].getOptions();let r={effects:{defaultAlignment:"end"}};if(a.hasOwnProperty("extends")&&a.extends.hasOwnProperty("originOptions")){const l=a.extends.originOptions,e={start:l.start,end:l.end,scale:l.scale,sidebar:l.sidebar,ruler:l.ruler},s=parseInt(i.querySelector("#grain-width").value||"48",10),t=parseInt(i.querySelector("#row-height").value||"80",10);isNaN(s)||(e.ruler.minGrainWidth=`${s}px`),isNaN(t)||(e.sidebar.itemHeight=`${t}px`),r={...r,...e},console.log("originOptions:",e,r)}window.SunorhcTimelineInstances[n].reload(r,l=>{console.log("Reloaded:",l),window.scrollTo({left:0,top:l.targetElement.offsetTop,behavior:"smooth"})})},300)}),i.querySelector("#toggle-scale-tracker").addEventListener("change",n=>{const o=n.currentTarget;try{if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a].getOptions().extends??{};if(r.hasOwnProperty("zoomScaleTracker")&&r.zoomScaleTracker){const l=document.getElementById(a);let e;if(o.checked)e=document.createElement("div"),e.classList.add("zoom-scale-coordinates-tracker"),e.setAttribute("style","position: absolute; bottom: 6px; left: 4px; display: none; flex-wrap: wrap; justify-content: start; text-align: left; font-size: 12px; color: #555; background-color: #fff; border: solid 1px #999; border-radius: 4px; width: max-content; max-width: 50%; height: max-content; padding: 3px 6px; box-shadow: 4px 4px 4px rgba(21,21,21,.25); z-index: 9999;"),l.querySelector(".sunorhc-timeline-footer").append(e);else if(e=l.querySelector(".zoom-scale-coordinates-tracker"),e)l.querySelector(".sunorhc-timeline-footer").removeChild(e);else throw new Error("Scale Tracker does not exists.")}else throw new Error("No extends for Scale Tracker in options.")}else throw new Error("No valid timeline instance.")}catch(a){console.error("Could not activate Scale Tracker:",a),o.checked=!1}}),i.querySelector("#toggle-present-marker").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().effects;l.presentTime=o.checked,r.reload({effects:l})}}),i.querySelector("#toggle-day-colored").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().ruler;l.hasOwnProperty("filters")?l.filters.dayBackgroundColor=o.checked:l.filters={dayBackgroundColor:o.checked},r.reload({ruler:l})}}),i.querySelector("#toggle-tooltip").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.getOptions().effects;l.hoverEvent=o.checked,r.reload({effects:l})}}),i.querySelector("#select-event-opener").addEventListener("change",n=>{var r,l,e;const o=n.currentTarget,a=document.getElementById("sunorhc-timeline-modal");if(a&&((r=a.parentNode)==null||r.removeChild(a)),o.value==="normal"?(l=document.getElementById("sunorhc-timeline-event-details"))==null||l.classList.remove("hidden"):(e=document.getElementById("sunorhc-timeline-event-details"))==null||e.classList.add("hidden"),window.hasOwnProperty("SunorhcTimelineInstances"))for(const s in window.SunorhcTimelineInstances){const t=window.SunorhcTimelineInstances[s],d=t.getOptions().effects;if(/^modal/.test(o.value)){const[u,c]=o.value.split(":");d.onClickEvent=u,d.template.modal.size=c==="960"?Number(c):c}else d.onClickEvent=o.value;t.reload({effects:d})}}),i.querySelector("#select-scale").addEventListener("change",n=>{const o=n.currentTarget;if(window.hasOwnProperty("SunorhcTimelineInstances"))for(const a in window.SunorhcTimelineInstances){const r=window.SunorhcTimelineInstances[a],l=r.measurements;let e=r.getOptions();e.scale=o.value,e.start="currently",e.end="auto",e.ruler.hasOwnProperty("filters")&&e.ruler.filters.hasOwnProperty("decorations")?e.ruler.filters.decorations={year:void 0,day:void 0,minute:void 0}:e.ruler.filters={decorations:{}};const s=e.ruler.filters;let t=new Date,d=s.monthNames&&Array.isArray(s.monthNames)?s.monthNames[e.timezone==="UTC"?t.getUTCMonth():t.getMonth()]:e.timezone==="UTC"?t.getUTCMonth()+1:t.getMonth()+1,u=s.dayNames&&Array.isArray(s.dayNames)?s.dayNames[e.timezone==="UTC"?t.getUTCDay():t.getDay()]:e.timezone==="UTC"?t.getUTCDay():t.getDay(),c,y,w;switch(o.value){case"year":e.ruler.minGrainWidth=Math.max(160,Math.ceil(l.rulerVisibleWidth/10)),e.ruler.top.rows=["year"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"month":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),e.start=`${t.getFullYear()}-01-01T00:00:00.000`,e.end=`${t.getFullYear()}-12-31T23:59:59.999`,e.ruler.minGrainWidth=Math.max(120,Math.ceil(l.rulerVisibleWidth/12)),e.ruler.top.rows=["year","month"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"week":e.ruler.minGrainWidth=Math.max(80,Math.ceil(l.rulerVisibleWidth/53)),e.ruler.top.rows=["year","month","week"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"day":e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/31)),e.ruler.top.rows=["year","month","week","day","weekday"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed();break;case"hour":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0),e.start=t,e.end=new Date(t.getTime()+24*60*60*1e3),e.ruler.minGrainWidth=Math.max(80,Math.ceil(l.rulerVisibleWidth/24)),e.ruler.top.rows=["day","hour"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),c=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),e.ruler.filters.decorations.day={replacer:`${u}, %s ${d} ${c}`};break;case"minute":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),0,0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0,0),e.start=t,e.end=new Date(t.getTime()+60*60*1e3),e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/60)),e.ruler.top.rows=["day","hour","minute"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),c=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),e.ruler.filters.decorations.day={replacer:`${u}, %s ${d} ${c}`};break;case"second":t=e.timezone==="UTC"?new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),0,0)):new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),0,0),e.start=t,e.end=new Date(t.getTime()+60*1e3),e.ruler.minGrainWidth=Math.max(60,Math.ceil(l.rulerVisibleWidth/60)),e.ruler.top.rows=["day","minute","second"],e.ruler.bottom.rows=e.ruler.top.rows.toReversed(),c=e.timezone==="UTC"?t.getUTCFullYear():t.getFullYear(),y=String(e.timezone==="UTC"?t.getUTCHours():t.getHours()).padStart(2,"0"),w=String(e.timezone==="UTC"?t.getUTCMinutes():t.getMinutes()).padStart(2,"0"),e.ruler.filters.decorations.day={replacer:`${u}, %s ${d} ${c}`},e.ruler.filters.decorations.minute={replacer:`${y}:${w}`};break;default:return}const k=document.getElementById("toggle-scale-tracker");k.checked&&(k.checked=!1),r.reload(e)}});let b=0;i.querySelector("#view-options").addEventListener("click",()=>{b=window.scrollY;const n=window.innerWidth-document.documentElement.clientWidth;if(document.body.style.position="fixed",document.body.style.top=`-${b}px`,document.body.style.width=`calc(100% - ${n}px)`,window.hasOwnProperty("SunorhcTimelineInstances"))for(const o in window.SunorhcTimelineInstances){const a=window.SunorhcTimelineInstances[o].getOptions();if(a){const r=``;T("Current Timeline Options",r);break}}}),document.querySelectorAll('button[data-modal-hide="tester-modal"]').forEach(n=>{n.addEventListener("click",()=>{document.body.style.position="",document.body.style.top="",document.body.style.width="",window.scrollTo({top:b,left:0,behavior:"instant"});const o=document.getElementById("tester-modal");o.classList.contains("opacity-1")&&(o.classList.add("opacity-0"),o.classList.remove("opacity-1"))})}),document.getElementById("download-json").addEventListener("click",n=>{const o=n.currentTarget,a=o.getAttribute("class")||"",r=o.textContent;if(o.setAttribute("disabled",""),o.setAttribute("class","text-white bg-blue-400 dark:bg-blue-500 cursor-not-allowed font-medium rounded-lg text-sm px-5 py-2.5 text-center"),o.textContent="Downloading...",window.hasOwnProperty("SunorhcTimelineInstances"))for(const l in window.SunorhcTimelineInstances){const e=window.SunorhcTimelineInstances[l].getOptions();if(e){const s="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),t=document.createElement("a");t.setAttribute("href",s),(async()=>btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${performance.now()*1e6}`))))))().then(u=>{t.setAttribute("download",`TimelineOptions-${u}.json`),document.body.appendChild(t),t.click(),t.remove()}).catch(u=>{console.error("Failed to download:",u)}).finally(()=>{setTimeout(()=>{o.removeAttribute("disabled"),o.setAttribute("class",a),o.textContent=r},300)});break}}}),i.querySelector(".alnum-only").addEventListener("input",n=>{const o=n.currentTarget,a=o.value;o.value=a.replace(/[^a-zA-Z0-9\.]/g,"")})}g.setupTester=p,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}); diff --git a/dists/js/Tester.js.gz b/dists/js/Tester.js.gz new file mode 100644 index 0000000..6ff64ba Binary files /dev/null and b/dists/js/Tester.js.gz differ diff --git a/dists/js/sunorhc.timeline.js.gz b/dists/js/sunorhc.timeline.js.gz new file mode 100644 index 0000000..49f60a7 Binary files /dev/null and b/dists/js/sunorhc.timeline.js.gz differ