diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ee982d..da0f686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## 1.0.1 - - 2021-09-26 +## 1.0.2 - 2021-09-26 +### Fixed +- Added new build files that should have been in `1.0.1`. + +## 1.0.1 - 2021-09-26 ### Changed - Specify Vite port number so that it doesn't conflict with other test projects running on port `3000`. diff --git a/dist/assets/sunset-to-sunset-legacy.min.js b/dist/assets/sunset-to-sunset-legacy.min.js index cc56a27..60ad0eb 100644 --- a/dist/assets/sunset-to-sunset-legacy.min.js +++ b/dist/assets/sunset-to-sunset-legacy.min.js @@ -1,2 +1,2 @@ -!function(){var t=document.createElement("style");t.innerHTML='.sts-banner{--tw-bg-opacity: 1;background-color:rgba(251,191,36,var(--tw-bg-opacity));position:relative;padding:.75rem;text-align:center;font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.sts-banner .sts-closing-time,.sts-banner .sts-opening-time{font-weight:600}html.sts-during-sabbath,html.sts-during-sabbath body{overflow:hidden}html.sts-during-sabbath body{max-height:100vh}.sts-full-message__container{top:0px;right:0px;bottom:0px;left:0px;position:absolute;--tw-bg-opacity: 1;background-color:rgba(255,255,255,var(--tw-bg-opacity));pointer-events:auto;overflow-y:scroll;z-index:500}.sts-full-message__heading{margin-bottom:1rem;font-size:3rem;font-weight:600}.sts-layout{display:flex;flex-wrap:wrap;margin-left:-.5rem;margin-right:-.5rem}.sts-layout .sts-layout__item{padding-left:.5rem;padding-right:.5rem}.sts-modal{width:90%;margin-left:auto;margin-right:auto;margin-top:7%;max-width:640px;justify-content:center}.sts-message-area{font-size:1rem;line-height:1.5rem;width:100%;text-align:center;padding-bottom:1rem}.sts-time-area{width:100%;text-align:center;border-top:1px solid lightgrey;padding-top:1rem}\n',document.head.appendChild(t),System.register([],(function(){"use strict";return{execute:function(){const t=(t,e)=>Object.assign(t,e),e=(t,e)=>{const s="cccc, LLLL d 'at' h:mm a ZZZZ";for(let n=0;n{console.log("Intializing Sunset to Sunset...");const s=luxon.DateTime,n=luxon.Duration,o=s.now();let i={};i["Current Time"]={Date:o.toLocaleString(s.DATE_FULL),Time:o.toLocaleString(s.TIME_WITH_SHORT_OFFSET)};const a=5==o.weekday||6==o.weekday,l=document.getElementsByTagName("html")[0];a&&l.classList.add("hidden");const r=document.querySelector("template#sts-settings");let c=null!=r?JSON.parse(r.dataset.settings):{};c=t(t({},{guardDuration:{minutes:30},messageDuration:{minutes:60},location:{lat:0,long:0},simulateTime:!1,debug:!1}),c),c.simulateTime&&console.warn("%cThe `simulateTime` option is enabled for the Sunset to Sunset plugin. Remember to disable this option once you are done verifying the settings.","font-size: 16px"),c.debug&&(console.group("Sunset to Sunset intialized with the following options:"),console.dir(c),console.groupEnd());const m=()=>c.location,d=async t=>{const e=t.split("T")[0],n=await fetch("https://api.sunrise-sunset.org/json?&lat="+m().lat+"&lng="+m().long+"&date="+e+"&formatted=0"),o=await n.json();return s.fromISO(o.results.sunset)},u=()=>{let t;t=c.simulateTime?0:5-o.weekday;const e=s.fromISO(o.plus({days:t})).toString();return d(e)},g=()=>{let t;t=c.simulateTime?1:6-o.weekday;const e=s.fromISO(o.plus({days:t})).toString();return d(e)},p=()=>c.guardDuration,h=t=>t.minus(n.fromObject(c.messageDuration)),b=(t,e)=>{let s;return"closing"==e&&(s=t.minus(p())),"opening"==e&&(s=t.plus(p())),s};a||c.simulateTime?(async()=>{const t=Promise.all([u(),g()]);return await t})().then((([t,n])=>{const a=b(t,"closing"),r=b(n,"opening");let m=!1,d=!1,u=!1,g=!1;if(c.simulateTime)switch(c.simulateTime){case"preparation-day":m=!0;break;case"banner-up":d=!0;break;case"during-sabbath":u=!0;break;case"after-sabbath":g=!0}else m=oh(a)&&o=a&&o<=r&&o.weekday>=5,g=o>r&&o>=6;if(m){const t=h(a).diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(d){((t,s)=>{const n=document.querySelector("template#sts-banner-template");let o;if(n)o=n;else{let t=document.createElement("template");t.innerHTML='\n\t\t\t
\n\t\t\t\tBecause of religious beliefs our store will be closed over the Sabbath hours.\n\t\t\t\tClosing on and will re-open on .\n\t\t\t
\n\t\t',o=t}const i=o.content.cloneNode(!0),a=i.querySelectorAll(".sts-closing-time");e(a,t);const l=i.querySelectorAll(".sts-opening-time");e(l,s),document.body.insertBefore(i,document.body.firstChild)})(a,r);const t=a.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(u){(t=>{const s=document.querySelector("template#sts-full-message-template"),n=document.querySelector("template#sts-message-template"),o=s||n;let i;if(o)i=o.content.cloneNode(!0),i=i.firstElementChild;else{let t=document.createElement("div");t.innerHTML="\n\t\t\t

\n\t\t\t\tIn a world that seems to be spinning faster every day, we choose to stop \n\t\t\t\tand rest every Sabbath (Saturday). It’s a day for us to relax, refresh, \n\t\t\t\trefocus and worship; worship a God who loved us so much that He built a \n\t\t\t\tday of rest into Creation week and then commanded us to keep it \n\t\t\t\t(knowing we probably wouldn’t do it otherwise—even though it is for \n\t\t\t\tour best good).\n\t\t\t

\n\t\t",i=t}let a=document.createElement("template");a.innerHTML='\n\t\t
\n\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

Sabbath

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\tWe will re-open on .\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t';const l=a.content.cloneNode(!0),r=l.querySelectorAll(".sts-opening-time");if(e(r,t),s){console.log("full user template");let t=l.querySelector(".sts-full-message__container");for(;t.firstElementChild;)t.removeChild(t.firstChild);t.insertBefore(i,null)}else n&&(console.log("simple user template"),l.querySelector(".sts-message-area").insertBefore(i,null));document.getElementsByTagName("html")[0].classList.add("sts-during-sabbath"),document.body.insertBefore(l,document.body.firstChild)})(r);const t=r.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(l.classList.remove("hidden"),c.debug){let e={Enabled:{"Preparation day":m,"Banner up":d,"During the Sabbath":u,"After Sabbath":g}};console.group("Sunset to Sunset time checks"),console.table(e),console.groupEnd(),i["Banner up"]={Date:h(a).toLocaleString(s.DATE_FULL),Time:h(a).toLocaleString(s.TIME_WITH_SHORT_OFFSET)},i["Closing guard"]={Date:a.toLocaleString(s.DATE_FULL),Time:a.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},i["Closing sunset"]={Date:t.toLocaleString(s.DATE_FULL),Time:t.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},i["Opening sunset"]={Date:n.toLocaleString(s.DATE_FULL),Time:n.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},i["Opening guard"]={Date:r.toLocaleString(s.DATE_FULL),Time:r.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},console.group("Sunset to Sunset times"),console.table(i),console.groupEnd()}})):console.log("Sunset to Sunset: Exiting because today is not closing day")})()}}}))}(); +!function(){var t=document.createElement("style");t.innerHTML='.sts-banner{--tw-bg-opacity: 1;background-color:rgba(251,191,36,var(--tw-bg-opacity));position:relative;padding:.75rem;text-align:center;font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.sts-banner .sts-closing-time,.sts-banner .sts-opening-time{font-weight:600}html.sts-during-sabbath,html.sts-during-sabbath body{overflow:hidden}html.sts-during-sabbath body{max-height:100vh}.sts-full-message__container{top:0px;right:0px;bottom:0px;left:0px;position:absolute;--tw-bg-opacity: 1;background-color:rgba(255,255,255,var(--tw-bg-opacity));pointer-events:auto;overflow-y:scroll;z-index:500}.sts-full-message__heading{margin-bottom:1rem;font-size:3rem;font-weight:600}.sts-layout{display:flex;flex-wrap:wrap;margin-left:-.5rem;margin-right:-.5rem}.sts-layout .sts-layout__item{padding-left:.5rem;padding-right:.5rem}.sts-modal{width:90%;margin-left:auto;margin-right:auto;margin-top:7%;max-width:640px;justify-content:center}.sts-message-area{font-size:1rem;line-height:1.5rem;width:100%;text-align:center;padding-bottom:1rem}.sts-time-area{width:100%;text-align:center;border-top:1px solid lightgrey;padding-top:1rem}\n',document.head.appendChild(t),System.register([],(function(){"use strict";return{execute:function(){const t=(t,e)=>Object.assign(t,e),e=(t,e)=>{const n="cccc, LLLL d 'at' h:mm a ZZZZ";for(let s=0;s{console.log("Intializing Sunset to Sunset...");const n=luxon.DateTime,s=luxon.Duration,o=n.now();let i={};i["Current Time"]={Date:o.toLocaleString(n.DATE_FULL),Time:o.toLocaleString(n.TIME_WITH_SHORT_OFFSET)};const a=5==o.weekday||6==o.weekday,l=document.getElementsByTagName("html")[0];a&&l.classList.add("hidden");const r=document.querySelector("template#sts-settings");let c=null!=r?JSON.parse(r.dataset.settings):{};c=t(t({},{guardDuration:{minutes:30},messageDuration:{minutes:60},location:{lat:0,long:0},simulateTime:!1,debug:!1}),c),c.simulateTime&&console.warn("%cThe `simulateTime` option is enabled for the Sunset to Sunset plugin. Remember to disable this option once you are done verifying the settings.","font-size: 16px"),c.debug&&(console.group("Sunset to Sunset intialized with the following options:"),console.dir(c),console.groupEnd());const m=()=>c.location,d=async t=>{const e=t.split("T")[0],s=await fetch("https://api.sunrise-sunset.org/json?&lat="+m().lat+"&lng="+m().long+"&date="+e+"&formatted=0"),o=await s.json();return n.fromISO(o.results.sunset)},u=()=>{let t;t=c.simulateTime?0:5-o.weekday;const e=n.fromISO(o.plus({days:t})).toString();return d(e)},g=()=>{let t;t=c.simulateTime?1:6-o.weekday;const e=n.fromISO(o.plus({days:t})).toString();return d(e)},p=()=>c.guardDuration,h=t=>t.minus(s.fromObject(c.messageDuration)),b=(t,e)=>{let n;return"closing"==e&&(n=t.minus(p())),"opening"==e&&(n=t.plus(p())),n};a||c.simulateTime?(async()=>{const t=Promise.all([u(),g()]);return await t})().then((([t,s])=>{const a=b(t,"closing"),r=b(s,"opening");let m=!1,d=!1,u=!1,g=!1;if(c.simulateTime)switch(c.simulateTime){case"preparation-day":m=!0;break;case"banner-up":d=!0;break;case"during-sabbath":u=!0;break;case"after-sabbath":g=!0}else m=oh(a)&&o=a&&o<=r&&o.weekday>=5,g=o>r&&o>=6;if(m){const t=h(a).diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(d){((t,n)=>{const s=document.querySelector("template#sts-banner-template");let o;if(s)o=s;else{let t=document.createElement("template");t.innerHTML='\n\t\t\t
\n\t\t\t\tBecause of religious beliefs our store will be closed over the Sabbath hours.\n\t\t\t\tClosing on and will re-open on .\n\t\t\t
\n\t\t',o=t}const i=o.content.cloneNode(!0),a=i.querySelectorAll(".sts-closing-time");e(a,t);const l=i.querySelectorAll(".sts-opening-time");e(l,n),document.body.insertBefore(i,document.body.firstChild)})(a,r);const t=a.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(u){(t=>{const n=document.querySelector("template#sts-full-message-template"),s=document.querySelector("template#sts-message-template"),o=n||s;let i;if(o)i=o.content.cloneNode(!0),i=i.firstElementChild;else{let t=document.createElement("div");t.innerHTML="\n\t\t\t

\n\t\t\t\tIn a world that seems to be spinning faster every day, we choose to stop \n\t\t\t\tand rest every Sabbath (Saturday). It’s a day for us to relax, refresh, \n\t\t\t\trefocus and worship; worship a God who loved us so much that He built a \n\t\t\t\tday of rest into Creation week and then commanded us to keep it \n\t\t\t\t(knowing we probably wouldn’t do it otherwise—even though it is for \n\t\t\t\tour best good).\n\t\t\t

\n\t\t",i=t}let a=document.createElement("template");a.innerHTML='\n\t\t
\n\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

Sabbath

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\tWe will re-open on .\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t';const l=a.content.cloneNode(!0);if(n){let t=l.querySelector(".sts-full-message__container");for(;t.firstElementChild;)t.removeChild(t.firstChild);t.insertBefore(i,null)}else s&&l.querySelector(".sts-message-area").insertBefore(i,null);document.getElementsByTagName("html")[0].classList.add("sts-during-sabbath");const r=l.querySelectorAll(".sts-opening-time");e(r,t),document.body.insertBefore(l,document.body.firstChild)})(r);const t=r.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(l.classList.remove("hidden"),c.debug){let e={Enabled:{"Preparation day":m,"Banner up":d,"During the Sabbath":u,"After Sabbath":g}};console.group("Sunset to Sunset time checks"),console.table(e),console.groupEnd(),i["Banner up"]={Date:h(a).toLocaleString(n.DATE_FULL),Time:h(a).toLocaleString(n.TIME_WITH_SHORT_OFFSET)},i["Closing guard"]={Date:a.toLocaleString(n.DATE_FULL),Time:a.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},i["Closing sunset"]={Date:t.toLocaleString(n.DATE_FULL),Time:t.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},i["Opening sunset"]={Date:s.toLocaleString(n.DATE_FULL),Time:s.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},i["Opening guard"]={Date:r.toLocaleString(n.DATE_FULL),Time:r.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},console.group("Sunset to Sunset times"),console.table(i),console.groupEnd()}})):console.log("Sunset to Sunset: Exiting because today is not closing day")})()}}}))}(); //# sourceMappingURL=sunset-to-sunset-legacy.min.js.map diff --git a/dist/assets/sunset-to-sunset.min.js b/dist/assets/sunset-to-sunset.min.js index a02c2ca..fb4dbde 100644 --- a/dist/assets/sunset-to-sunset.min.js +++ b/dist/assets/sunset-to-sunset.min.js @@ -1,2 +1,2 @@ -export function __vite_legacy_guard(){import("data:text/javascript,")}const t=(t,e)=>Object.assign(t,e),e=(t,e)=>{const s="cccc, LLLL d 'at' h:mm a ZZZZ";for(let n=0;n{console.log("Intializing Sunset to Sunset...");const s=luxon.DateTime,n=luxon.Duration,o=s.now();let a={};a["Current Time"]={Date:o.toLocaleString(s.DATE_FULL),Time:o.toLocaleString(s.TIME_WITH_SHORT_OFFSET)};const i=5==o.weekday||6==o.weekday,l=document.getElementsByTagName("html")[0];i&&l.classList.add("hidden");const r=document.querySelector("template#sts-settings");let c=null!=r?JSON.parse(r.dataset.settings):{};c=t(t({},{guardDuration:{minutes:30},messageDuration:{minutes:60},location:{lat:0,long:0},simulateTime:!1,debug:!1}),c),c.simulateTime&&console.warn("%cThe `simulateTime` option is enabled for the Sunset to Sunset plugin. Remember to disable this option once you are done verifying the settings.","font-size: 16px"),c.debug&&(console.group("Sunset to Sunset intialized with the following options:"),console.dir(c),console.groupEnd());const u=()=>c.location,m=async t=>{const e=t.split("T")[0],n=await fetch("https://api.sunrise-sunset.org/json?&lat="+u().lat+"&lng="+u().long+"&date="+e+"&formatted=0"),o=await n.json();return s.fromISO(o.results.sunset)},d=()=>{let t;t=c.simulateTime?0:5-o.weekday;const e=s.fromISO(o.plus({days:t})).toString();return m(e)},g=()=>{let t;t=c.simulateTime?1:6-o.weekday;const e=s.fromISO(o.plus({days:t})).toString();return m(e)},p=()=>c.guardDuration,S=t=>t.minus(n.fromObject(c.messageDuration)),T=(t,e)=>{let s;return"closing"==e&&(s=t.minus(p())),"opening"==e&&(s=t.plus(p())),s};i||c.simulateTime?(async()=>{const t=Promise.all([d(),g()]);return await t})().then((([t,n])=>{const i=T(t,"closing"),r=T(n,"opening");let u=!1,m=!1,d=!1,g=!1;if(c.simulateTime)switch(c.simulateTime){case"preparation-day":u=!0;break;case"banner-up":m=!0;break;case"during-sabbath":d=!0;break;case"after-sabbath":g=!0}else u=oS(i)&&o=i&&o<=r&&o.weekday>=5,g=o>r&&o>=6;if(u){const t=S(i).diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(m){((t,s)=>{const n=document.querySelector("template#sts-banner-template");let o;if(n)o=n;else{let t=document.createElement("template");t.innerHTML='\n\t\t\t
\n\t\t\t\tBecause of religious beliefs our store will be closed over the Sabbath hours.\n\t\t\t\tClosing on and will re-open on .\n\t\t\t
\n\t\t',o=t}const a=o.content.cloneNode(!0),i=a.querySelectorAll(".sts-closing-time");e(i,t);const l=a.querySelectorAll(".sts-opening-time");e(l,s),document.body.insertBefore(a,document.body.firstChild)})(i,r);const t=i.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(d){(t=>{const s=document.querySelector("template#sts-full-message-template"),n=document.querySelector("template#sts-message-template"),o=s||n;let a;if(o)a=o.content.cloneNode(!0),a=a.firstElementChild;else{let t=document.createElement("div");t.innerHTML="\n\t\t\t

\n\t\t\t\tIn a world that seems to be spinning faster every day, we choose to stop \n\t\t\t\tand rest every Sabbath (Saturday). It’s a day for us to relax, refresh, \n\t\t\t\trefocus and worship; worship a God who loved us so much that He built a \n\t\t\t\tday of rest into Creation week and then commanded us to keep it \n\t\t\t\t(knowing we probably wouldn’t do it otherwise—even though it is for \n\t\t\t\tour best good).\n\t\t\t

\n\t\t",a=t}let i=document.createElement("template");i.innerHTML='\n\t\t
\n\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

Sabbath

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\tWe will re-open on .\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t';const l=i.content.cloneNode(!0),r=l.querySelectorAll(".sts-opening-time");if(e(r,t),s){console.log("full user template");let t=l.querySelector(".sts-full-message__container");for(;t.firstElementChild;)t.removeChild(t.firstChild);t.insertBefore(a,null)}else n&&(console.log("simple user template"),l.querySelector(".sts-message-area").insertBefore(a,null));document.getElementsByTagName("html")[0].classList.add("sts-during-sabbath"),document.body.insertBefore(l,document.body.firstChild)})(r);const t=r.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(l.classList.remove("hidden"),c.debug){let e={Enabled:{"Preparation day":u,"Banner up":m,"During the Sabbath":d,"After Sabbath":g}};console.group("Sunset to Sunset time checks"),console.table(e),console.groupEnd(),a["Banner up"]={Date:S(i).toLocaleString(s.DATE_FULL),Time:S(i).toLocaleString(s.TIME_WITH_SHORT_OFFSET)},a["Closing guard"]={Date:i.toLocaleString(s.DATE_FULL),Time:i.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},a["Closing sunset"]={Date:t.toLocaleString(s.DATE_FULL),Time:t.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},a["Opening sunset"]={Date:n.toLocaleString(s.DATE_FULL),Time:n.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},a["Opening guard"]={Date:r.toLocaleString(s.DATE_FULL),Time:r.toLocaleString(s.TIME_WITH_SHORT_OFFSET)},console.group("Sunset to Sunset times"),console.table(a),console.groupEnd()}})):console.log("Sunset to Sunset: Exiting because today is not closing day")})(); +export function __vite_legacy_guard(){import("data:text/javascript,")}const t=(t,e)=>Object.assign(t,e),e=(t,e)=>{const n="cccc, LLLL d 'at' h:mm a ZZZZ";for(let s=0;s{console.log("Intializing Sunset to Sunset...");const n=luxon.DateTime,s=luxon.Duration,o=n.now();let a={};a["Current Time"]={Date:o.toLocaleString(n.DATE_FULL),Time:o.toLocaleString(n.TIME_WITH_SHORT_OFFSET)};const i=5==o.weekday||6==o.weekday,l=document.getElementsByTagName("html")[0];i&&l.classList.add("hidden");const r=document.querySelector("template#sts-settings");let c=null!=r?JSON.parse(r.dataset.settings):{};c=t(t({},{guardDuration:{minutes:30},messageDuration:{minutes:60},location:{lat:0,long:0},simulateTime:!1,debug:!1}),c),c.simulateTime&&console.warn("%cThe `simulateTime` option is enabled for the Sunset to Sunset plugin. Remember to disable this option once you are done verifying the settings.","font-size: 16px"),c.debug&&(console.group("Sunset to Sunset intialized with the following options:"),console.dir(c),console.groupEnd());const u=()=>c.location,d=async t=>{const e=t.split("T")[0],s=await fetch("https://api.sunrise-sunset.org/json?&lat="+u().lat+"&lng="+u().long+"&date="+e+"&formatted=0"),o=await s.json();return n.fromISO(o.results.sunset)},m=()=>{let t;t=c.simulateTime?0:5-o.weekday;const e=n.fromISO(o.plus({days:t})).toString();return d(e)},g=()=>{let t;t=c.simulateTime?1:6-o.weekday;const e=n.fromISO(o.plus({days:t})).toString();return d(e)},p=()=>c.guardDuration,S=t=>t.minus(s.fromObject(c.messageDuration)),T=(t,e)=>{let n;return"closing"==e&&(n=t.minus(p())),"opening"==e&&(n=t.plus(p())),n};i||c.simulateTime?(async()=>{const t=Promise.all([m(),g()]);return await t})().then((([t,s])=>{const i=T(t,"closing"),r=T(s,"opening");let u=!1,d=!1,m=!1,g=!1;if(c.simulateTime)switch(c.simulateTime){case"preparation-day":u=!0;break;case"banner-up":d=!0;break;case"during-sabbath":m=!0;break;case"after-sabbath":g=!0}else u=oS(i)&&o=i&&o<=r&&o.weekday>=5,g=o>r&&o>=6;if(u){const t=S(i).diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(d){((t,n)=>{const s=document.querySelector("template#sts-banner-template");let o;if(s)o=s;else{let t=document.createElement("template");t.innerHTML='\n\t\t\t
\n\t\t\t\tBecause of religious beliefs our store will be closed over the Sabbath hours.\n\t\t\t\tClosing on and will re-open on .\n\t\t\t
\n\t\t',o=t}const a=o.content.cloneNode(!0),i=a.querySelectorAll(".sts-closing-time");e(i,t);const l=a.querySelectorAll(".sts-opening-time");e(l,n),document.body.insertBefore(a,document.body.firstChild)})(i,r);const t=i.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(m){(t=>{const n=document.querySelector("template#sts-full-message-template"),s=document.querySelector("template#sts-message-template"),o=n||s;let a;if(o)a=o.content.cloneNode(!0),a=a.firstElementChild;else{let t=document.createElement("div");t.innerHTML="\n\t\t\t

\n\t\t\t\tIn a world that seems to be spinning faster every day, we choose to stop \n\t\t\t\tand rest every Sabbath (Saturday). It’s a day for us to relax, refresh, \n\t\t\t\trefocus and worship; worship a God who loved us so much that He built a \n\t\t\t\tday of rest into Creation week and then commanded us to keep it \n\t\t\t\t(knowing we probably wouldn’t do it otherwise—even though it is for \n\t\t\t\tour best good).\n\t\t\t

\n\t\t",a=t}let i=document.createElement("template");i.innerHTML='\n\t\t
\n\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

Sabbath

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\tWe will re-open on .\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t';const l=i.content.cloneNode(!0);if(n){let t=l.querySelector(".sts-full-message__container");for(;t.firstElementChild;)t.removeChild(t.firstChild);t.insertBefore(a,null)}else s&&l.querySelector(".sts-message-area").insertBefore(a,null);document.getElementsByTagName("html")[0].classList.add("sts-during-sabbath");const r=l.querySelectorAll(".sts-opening-time");e(r,t),document.body.insertBefore(l,document.body.firstChild)})(r);const t=r.diff(o,"milliseconds").toObject();t.milliseconds>=0&&setTimeout((()=>{location.reload()}),t.milliseconds)}if(l.classList.remove("hidden"),c.debug){let e={Enabled:{"Preparation day":u,"Banner up":d,"During the Sabbath":m,"After Sabbath":g}};console.group("Sunset to Sunset time checks"),console.table(e),console.groupEnd(),a["Banner up"]={Date:S(i).toLocaleString(n.DATE_FULL),Time:S(i).toLocaleString(n.TIME_WITH_SHORT_OFFSET)},a["Closing guard"]={Date:i.toLocaleString(n.DATE_FULL),Time:i.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},a["Closing sunset"]={Date:t.toLocaleString(n.DATE_FULL),Time:t.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},a["Opening sunset"]={Date:s.toLocaleString(n.DATE_FULL),Time:s.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},a["Opening guard"]={Date:r.toLocaleString(n.DATE_FULL),Time:r.toLocaleString(n.TIME_WITH_SHORT_OFFSET)},console.group("Sunset to Sunset times"),console.table(a),console.groupEnd()}})):console.log("Sunset to Sunset: Exiting because today is not closing day")})(); //# sourceMappingURL=sunset-to-sunset.min.js.map diff --git a/package.json b/package.json index e377ee1..f5c0a3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sunset-to-sunset", - "version": "1.0.1", + "version": "1.0.2", "description": "", "main": "src/js/main.js", "author": "Cavell Blood",