commit ea3d50f009494ec319fe789c33bb21b64110f36f
parent 2657d7f0ad54e55582b59c4f9f73d1774b77dcc2
Author: Hunter
Date:   Mon, 26 Jan 2026 13:22:58 -0500

add Safari incompatibility warning

Diffstat:
Mreadme.md | 3+++
Mscript.js | 31+++++++++++++++++++++++++++----
2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/readme.md b/readme.md @@ -25,6 +25,9 @@ Different Techo types use differently-sized grid paper. Use the links below to s | Original<br>Cousin<br>HON A6<br>HON A5<br>Original Avec<br>Cousin Avec<br>5-Year Techo A6<br>5-Year Techo A5<br>Day-Free A6<br>Day-Free A5 | [Use 3.7mm grid ↗](https://hunterirving.github.io/memori?grid-size=3.7mm) | | Weeks<br>Weeks Mega | [Use 3.55mm grid ↗](https://hunterirving.github.io/memori?grid-size=3.55mm) | +> [!IMPORTANT] +> Printing from Safari is not currently supported. Please use Firefox or Chrome instead. + ### controls - After opening memori in your web browser, drag one or more images from your desktop onto the grid.<br> diff --git a/script.js b/script.js @@ -42,6 +42,14 @@ const page = document.querySelector('.page'); let popupElement = null; let popupTimeout = null; +// Detect Safari browser +function isSafari() { + const ua = navigator.userAgent; + return ua.includes('Safari') && !ua.includes('Chrome') && !ua.includes('Chromium'); +} + +const isUsingSafari = isSafari(); + // Parse URL parameters for custom cell size function parseCellSizeFromURL() { const urlParams = new URLSearchParams(window.location.search); @@ -54,18 +62,24 @@ function parseCellSizeFromURL() { // Check if size is valid if (isNaN(size)) { - showPopup('Invalid grid size. Using default 4mm.', 3000); + if (!isUsingSafari) { + showPopup('Invalid grid size. Using default 4mm.', 3000); + } return 4; } // Check if size is within reasonable bounds if (size < MIN_CELL_SIZE_MM || size > MAX_CELL_SIZE_MM) { - showPopup(`Grid size must be between ${MIN_CELL_SIZE_MM}mm and ${MAX_CELL_SIZE_MM}mm. Using default 4mm.`, 3500); + if (!isUsingSafari) { + showPopup(`Grid size must be between ${MIN_CELL_SIZE_MM}mm and ${MAX_CELL_SIZE_MM}mm. Using default 4mm.`, 3500); + } return 4; } - // Valid size - showPopup(`Grid set to ${size}mm`); + // Valid size - only show popup if not Safari + if (!isUsingSafari) { + showPopup(`Grid set to ${size}mm`); + } return size; } @@ -1145,6 +1159,15 @@ document.addEventListener('keyup', (e) => { // Load theme on page load loadThemeFromLocalStorage(); +// Show Safari warning if applicable +if (isUsingSafari) { + const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); + const safariMessage = isMobile + ? 'Printing from Safari is not currently supported.' + : 'Printing from Safari is not currently supported. Please use Firefox or Chrome instead.'; + showPopup(safariMessage, 5000); +} + // Warn before leaving page if images are present window.addEventListener('beforeunload', (e) => { if (images.length > 0) {