Commit 7d57d935 authored by Michał Woźniak's avatar Michał Woźniak
Browse files

handling hashes, initial implementation

parent cf01403f
Pipeline #87 passed with stage
in 2 seconds
......@@ -233,6 +233,23 @@ document.addEventListener('DOMContentLoaded', (e)=>{
cOpt.innerHTML = sites[site];
siteSelect.appendChild(cOpt);
}
return sites
})
// at this point we have all the sites ready,
// so we can process the URL #hash to check if any matches
//
// format of our hashes is:
//
.then(()=>{
if (window.location.hash) {
console.log(`+-- got hash: ${window.location.hash}`)
var hash_sites = sites.filter(site => (site.toLowerCase().replace(/[^a-z]/g, '-') === window.location.hash.substr(1)))
if (hash_sites.length === 1) {
console.log(` +-- got site from hash: ${hash_sites[0]}`)
siteSelect.value = hash_sites[0]
siteSelect.dispatchEvent(new Event('change'));
}
}
})
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment