18 lines
397 B
JavaScript
18 lines
397 B
JavaScript
function checkHex(str) {
|
|
regexp = /^[0-9a-fA-F]+$/
|
|
if (regexp.test(str)){
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
document.getElementById('openSite').onclick = function(){
|
|
var hash = document.getElementById('siteViewer').value
|
|
|
|
if (checkHex(hash) && hash.length == 64){
|
|
window.location.href = '/site/' + hash
|
|
}
|
|
else{
|
|
alert('Invalid site hash')
|
|
}
|
|
} |