diff --git a/Extensions/discord.html b/Extensions/discord.html index b715e5a..0fda784 100644 --- a/Extensions/discord.html +++ b/Extensions/discord.html @@ -1,17 +1,17 @@ + (function() { + // On initial load, check if the screen is in portrait mode (height > width). + if (window.innerHeight > window.innerWidth) { + // Get the current URL's query string (e.g., "?sbn=...") + const queryString = window.location.search; + + // Construct the new URL for the mobile site, appending the query string. + const mobileUrl = './mobile/index.html' + queryString; + + // Redirect to the mobile site, preserving the URL parameters. + window.location.replace(mobileUrl); + } + })(); + diff --git a/Main/mobile/PWA/install-prompting.js b/Main/mobile/PWA/install-prompting.js new file mode 100644 index 0000000..3d13c86 --- /dev/null +++ b/Main/mobile/PWA/install-prompting.js @@ -0,0 +1,209 @@ +/** + * ********************************************************************************** + * Title: Safari Progressive Web App Installation System + * ********************************************************************************** + * @author Isaiah Tadrous + * @version 2.2.1 + * *------------------------------------------------------------------------------- + * Cross-platform PWA installation system specifically designed for Safari browsers. + * Automatically detects Safari environments and presents user-friendly installation + * prompts with step-by-step instructions for adding the web application to the + * device home screen. Features responsive design, modal overlays, and proper + * event handling for optimal user experience across iOS and macOS Safari. + * ********************************************************************************** + */ + +// Detect Safari browser environment and check installation status +const isSafariCheck = /^((?!chrome|android|crios|fxios|opios).)*safari/i.test(navigator.userAgent) && + navigator.vendor && navigator.vendor.indexOf('Apple') > -1; +const isInstalled = 'standalone' in window.navigator && window.navigator.standalone; + +if (isSafariCheck && !isInstalled) { + console.log('Safari detected - initializing install prompting'); + + let promptShown = false; + + function showPrompt() { + if (promptShown) return; + promptShown = true; + + // Remove any existing prompts + document.getElementById('safari-install-prompt')?.remove(); + + const prompt = document.createElement('div'); + prompt.id = 'safari-install-prompt'; + prompt.style.cssText = ` + position: fixed; + bottom: 20px; + left: 50%; + transform: translateX(-50%); + background: linear-gradient(135deg, #0976ea 0%, #0d47a1 100%); + color: white; + padding: 20px; + border-radius: 12px; + box-shadow: 0 8px 32px rgba(0,0,0,0.3); + z-index: 10000; + animation: slideUp 0.4s ease-out; + width: 90%; + max-width: 850px; + `; + + prompt.innerHTML = ` +
A new version is available!
+ +A new version is available!
- + + +A new version is available!
+ +A Logic Puzzle Playground
+Interactive Playground!