Skip to content

Instantly share code, notes, and snippets.

View joshua-koehler's full-sized avatar

Joshua Koehler joshua-koehler

View GitHub Profile
@joshua-koehler
joshua-koehler / website-closed-on-sabbath.js
Created July 25, 2023 02:37
Close website on Christian Sabbath on the client side
<script>
function replacelinks() {
document.querySelectorAll('a').forEach(el => el.href = "/resources-links/website-closed-for-the-sabbath");
}
function close() {
const closedOnSabbathUrl = "https://gisbornefpchurch.org.nz/resources-links/website-closed-for-the-sabbath";
const d = new Date();
// is Sabbath in local time or in NZ
const isSabbath = d.getDay() === 0 || (d.getUTCDay() === 6 && d.getUTCHours() >= 12) || (d.getUTCDay() === 0 && d.getUTCHours() < 12)
if(window.location.href != closedOnSabbathUrl && isSabbath){