mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-27 19:17:11 +00:00
feat: browser-aware CTAs, tidier hero demo, comparison guides link
- Hero CTAs: the install buttons are compact (just the browser name) so all three fit one line; JS detects the visitor's browser and expands that one to the full "Add to X" call to action. Unknown browsers stay compact. - Hero demo: caption now sits directly under the two windows (absolutely positioned to the card cascade) instead of far below the tall scene. The scene keeps a fixed height that already fits the open popup, so the vertically centered hero never jumps when the popup toggles. - The background window now also shows a (non-interactive) extension icon, making it clear both browsers have KoalaSync installed. - Escape now also closes the demo popup. - Added a link from the comparison table to the fuller alternatives/guides hub, localized in all 15 languages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,23 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
}
|
||||
|
||||
// Highlight the CTA for the visitor's browser: it expands to the full
|
||||
// "Add to X" label while the others stay compact. Unknown browsers keep
|
||||
// all three compact.
|
||||
try {
|
||||
const ua = navigator.userAgent;
|
||||
let detected = null;
|
||||
if (/Firefox\//.test(ua) && !/Seamonkey\//.test(ua)) {
|
||||
detected = 'firefox';
|
||||
} else if (/Chrome\//.test(ua) || /Chromium\//.test(ua) || /Edg\//.test(ua) || /OPR\//.test(ua)) {
|
||||
detected = 'chrome';
|
||||
}
|
||||
if (detected) {
|
||||
const btn = document.querySelector('.btn-install[data-browser="' + detected + '"]');
|
||||
if (btn) btn.classList.add('is-detected');
|
||||
}
|
||||
} catch (_) { /* leave all buttons compact */ }
|
||||
|
||||
// Open collapsed section blocks when the URL directly targets them
|
||||
const hashCollapseMap = { '#faq': 'faq-collapse', '#self-hosting': 'selfhost-collapse' };
|
||||
const collapseId = hashCollapseMap[window.location.hash];
|
||||
@@ -809,6 +826,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
}
|
||||
|
||||
// Escape closes the popup as well
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key !== 'Escape') return;
|
||||
if (!scene.classList.contains('popup-open')) return;
|
||||
userTookOver = true;
|
||||
finishDemo();
|
||||
setPopupOpen(false);
|
||||
});
|
||||
|
||||
const runDemo = async () => {
|
||||
if (demoStarted || userTookOver || reduceMotion) return;
|
||||
demoStarted = true;
|
||||
|
||||
Reference in New Issue
Block a user