This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function onPathChange(callback) { | |
let path; | |
// Only reliable way seems polling across browsers :-( | |
setInterval(() => { | |
if (window.location.pathname !== path) { | |
path = window.location.pathname; | |
callback(path); | |
} | |
}, 1000); | |
} | |
function download(url) { | |
console.log("download", url); | |
setTimeout(() => { | |
document.location.href = url; | |
}, 1500); | |
} | |
onPathChange((path) => { | |
if (path === "/download-macos") { | |
download("https://api.detail.co/v1/macOS/latest"); | |
} | |
if (path === "/download-ios") { | |
download( | |
"https://apps.apple.com/nl/app/detail-camera-webcam-for-mac/id1563218359?l=en" | |
); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment