Skip to content

Commit e464108

Browse files
committed
Merge branch 'release/1.0.7'
2 parents 3b1c568 + e2541ae commit e464108

26 files changed

+647
-2660
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## Unreleased
8+
### Changed
9+
- User-defined templates for the message that appears on Sabbath and the banner message no longer use the HTML `<template>` tag. They need to use any other element now, preferably a `<div>` but any element with the right `id` will work. This change was needed because of a conflict with using `<template>` in React apps as React expects it to be a JSX template and not the HTML `<template>` tag.
10+
11+
## 1.0.6 - 2022-09-12
12+
### Changed
13+
- Luxon is now included in the build.
14+
- Updated dependencies.
15+
716
## 1.0.5 - 2021-10-15
817
### Changed
918
- Updated the test file settings to show a more syntax-safe JSON object.

README.md

Lines changed: 72 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@ This script was developed to help with closing down of a website from sunset on
55
- Automatically show a banner on the top of your site notifying visitors when your site will close.
66
- Show a message during the Sabbath hours letting visitors know why you are closed and when your site will be back online.
77

8-
## Dependencies
9-
The Sunset to Sunset script is dependent on a date time library called [Luxon](https://moment.github.io/luxon/#/) to calculate closing and opening times based off of the sunset times at the location that is entered. A goal is to eventually include this in the Sunset to Sunset script to avoid the need to load two separate scripts.
10-
118
## Installation
129
Whichever method you choose, either **Download** or **CDN**, it’s best to include all these files in the head so that they load right away. It’s not ideal to have render-blocking scripts in the head but the reason we recommend putting them in the head is to avoid the flash of the rendered page before the Sabbath message gets rendered. Feel free to submit a PR for improved installation methods.
1310

1411
### Download
1512
- **CSS**
16-
- [sunset-to-sunset.css](https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset.css), minified
13+
- [style.css](https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/style.css), minified
1714
- **Javascript**
18-
- [luxon.min.js](https://cdn.jsdelivr.net/npm/luxon@3.0.3/build/global/luxon.min.js), minified library for working with dates and times in JavaScript.
19-
- [polyfills-legacy.53eda98a.js](https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/polyfills-legacy.53eda98a.js), legacy bundle for outdated browser support.
20-
- [sunset-to-sunset.min.js](https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset.min.js), minified
21-
- [sunset-to-sunset-legacy.min.js](https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset-legacy.min.js), minified for legacy browsers
15+
- [polyfills-legacy.min.js](https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/polyfills-legacy.min.js), legacy bundle for outdated browser support.
16+
- [sunset-to-sunset.min.js](https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/sunset-to-sunset.min.js), minified
17+
- [sunset-to-sunset-legacy.min.js](https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/sunset-to-sunset-legacy.min.js), minified for legacy browsers
2218

2319
``` html
2420
<!DOCTYPE html>
@@ -27,27 +23,19 @@ Whichever method you choose, either **Download** or **CDN**, it’s best to incl
2723
<head>
2824
<!-- ... -->
2925

30-
<!-- Luxon library -->
31-
<script src="YOUR/PATH/HERE/luxon.min.js"></script>
32-
33-
<!-- Safari 10.1 `nomodule` fix script (https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc) -->
34-
<!-- This can be omitted if you don't have many users of Safari 10.1 in your target audience. -->
35-
<script>
36-
!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
37-
</script>
38-
39-
<!-- Legacy bundle for outdated browser support. -->
40-
<script type="nomodule" src="YOUR/PATH/HERE/polyfills-legacy.53eda98a.js"></script>
41-
4226
<!-- Sunset to Sunset javascript -->
4327
<script type="module" src="YOUR/PATH/HERE/sunset-to-sunset.min.js" crossorigin></script>
4428

4529
<!-- Sunset to Sunset stylesheet -->
46-
<link href="YOUR/PATH/HERE/sunset-to-sunset.css" rel="stylesheet" media="print" onload="this.media='all'">
30+
<link href="YOUR/PATH/HERE/style.css" rel="stylesheet" media="print" onload="this.media='all'">
31+
32+
<!-- Legacy bundle for outdated browser support. -->
33+
<script type="nomodule" src="YOUR/PATH/HERE/polyfills-legacy.min.js"></script>
4734

4835
<!-- Sunset to Sunset javascript for legacy browsers -->
4936
<script type="nomodule" src="YOUR/PATH/HERE/sunset-to-sunset-legacy.min.js"></script>
50-
</head>
37+
38+
</head>
5139

5240
<body>
5341
```
@@ -61,37 +49,61 @@ Link directly to the Sunset to Sunset files on [unpkg](https://unpkg.com/).
6149
<head>
6250
<!-- ... -->
6351

64-
<!-- Luxon library -->
65-
<script src="https://cdn.jsdelivr.net/npm/luxon@3.0.3/build/global/luxon.min.js"></script>
66-
67-
<!-- Safari 10.1 `nomodule` fix script (https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc) -->
68-
<!-- This can be omitted if you don't have many users of Safari 10.1 in your target audience. -->
69-
<script>
70-
!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
71-
</script>
72-
73-
<!-- Legacy bundle for outdated browser support. -->
74-
<script type="nomodule" src="https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/polyfills-legacy.53eda98a.js"></script>
75-
7652
<!-- Sunset to Sunset javascript -->
77-
<script type="module" src="https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset.min.js" crossorigin></script>
53+
<script
54+
type="module"
55+
src="https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/sunset-to-sunset.min.js"
56+
crossOrigin="true"
57+
></script>
7858

7959
<!-- Sunset to Sunset stylesheet -->
80-
<link href="https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset.css" rel="stylesheet" media="print" onload="this.media='all'">
81-
60+
<link
61+
href="https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/style.css"
62+
rel="stylesheet"
63+
/>
64+
65+
<!-- Legacy bundle for outdated browser support. -->
66+
<script
67+
noModule
68+
crossOrigin="true"
69+
id="vite-legacy-polyfill"
70+
src="https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/polyfills-legacy.min.js"
71+
></script>
72+
8273
<!-- Sunset to Sunset javascript for legacy browsers -->
83-
<script type="nomodule" src="https://unpkg.com/sunset-to-sunset@1.0.6/dist/assets/sunset-to-sunset-legacy.min.js"></script>
84-
</head>
74+
<script
75+
noModule
76+
crossOrigin="true"
77+
id="vite-legacy-entry"
78+
data-src="https://unpkg.com/sunset-to-sunset@1.0.7/dist/assets/sunset-to-sunset-legacy.min.js"
79+
>
80+
System.import(
81+
document.getElementById('vite-legacy-entry').getAttribute('data-src'),
82+
);
83+
</script>
84+
85+
</head>
8586

8687
<body>
8788
```
8889

90+
### Support for Safari 10.1
91+
Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will load `<script nomodule>` anyway. If you need to support Safari 10.1 on your website you may use this snippet below:
92+
93+
```html
94+
<!-- Safari 10.1 `nomodule` fix script (https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc) -->
95+
<!-- This can be omitted if you don't have many users of Safari 10.1 in your target audience. -->
96+
<script>
97+
!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
98+
</script>
99+
```
100+
89101

90102
## Usage
91103
Sunset to sunset needs some initial configuration needed for it to work correctly for your location. It will work out of the box without configuration but it won't be for your location.
92104

93105
## Custom Templates
94-
Sunset to sunset has some built-in banner and message templates that will be shown at the appropriate times but sometimes you need to define your own wording. You can do that with the html `template` elements.
106+
Sunset to sunset has some built-in banner and message templates that will be shown at the appropriate times but sometimes you need to define your own wording. You can do that with `<div>`s with the appropriate `id`s added to to them.
95107

96108
### Special Template Tags
97109
You can add the following two tags to your custom templates to render the closing time and the opening times.
@@ -148,35 +160,48 @@ Include the [special closing and opening time tags](#special-template-tags) with
148160
### Banner Template
149161
To define your custom banner template add the following snippet to your page, preferrably in the `<head>` tag.
150162

163+
151164
``` html
152-
<template id="sts-banner-template">
165+
<div id="sts-banner-template">
153166
<div class="sts-banner YOUR-CUSTOM-CLASSES-HERE">
154167
Our store will be closing at
155168
<span class="sts-closing-time"></span>
156169
<span>and will re-open on</span>
157170
<span class="sts-opening-time"></span>
158171
</div>
159-
</template>
172+
</div>
160173
```
174+
The `sts-banner` class provides some default styling for the banner that you could use as a starting point. Or you can remove it altogether and use your own custom styles. If you keep the `sts-banner` class it will output something like what you see below:
175+
176+
![banner screenshot](src/screenshots/banner.png)
161177

162178
### Simple Message Template
163179
If you want to just set a paragraph or two of text to appear during Sabbath then this is the template you'll want to use.
164180

165181
To define your custom message template add the following snippet to your page, preferrably in the `<head>` tag:
166182
``` html
167-
<template id="sts-message-template">
183+
<div id="sts-message-template">
168184
<p>
169185
Your message here
170186
</p>
171-
</template>
187+
</div>
172188
```
173189

190+
It will output something like what you see below:
191+
192+
![simple custom message template screenshot](src/screenshots/simple-custom-message.png)
193+
194+
If you supply no custom template then a default message will be set which looks like this:
195+
196+
![simple message template screenshot](src/screenshots/simple-default-message.png)
197+
198+
174199
### Full Message Template
175-
If you want to have full control over the appearance and layout of the message then you'll want to use the full message template. Everything inside of this template will be output into the `<div class="sts-full-message__container">`. You will need to supply your own custom styling to add padding and centering of your message.
200+
If you want to have full control over the appearance and layout of the message then you'll want to use the full message template. You will need to supply your own custom styling to add padding and centering of your message.
176201

177202
To define your custom message template add the following snippet to your page, preferrably in the `<head>` tag:
178203
``` html
179-
<template id="sts-full-message-template">
204+
<div id="sts-full-message-template">
180205
<div class="your-custom-layout-class">
181206
<div class="your-message-area">
182207
<h1 class="your-message__heading">Sabbath</h1>
@@ -188,7 +213,7 @@ To define your custom message template add the following snippet to your page, p
188213
</p>
189214
</div>
190215
</div>
191-
</template>
216+
</div>
192217
```
193218

194219
## Defining the Settings

dist/assets/index.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/assets/polyfills-legacy.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/style-legacy.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/style-legacy.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/style.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/sunset-to-sunset-legacy.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/sunset-to-sunset-legacy.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/sunset-to-sunset.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/assets/sunset-to-sunset.min.js

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/test-legacy.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/assets/test-legacy.min.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/assets/test.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/assets/test.min.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)