introduce search interface

This commit is contained in:
www
2020-12-07 09:57:30 +00:00
parent 894a99cdef
commit ad36db964e
21 changed files with 32004 additions and 52 deletions

38
static/init.js Normal file
View File

@@ -0,0 +1,38 @@
$(
function(){
console.log("init loaded")
})
$(function (){
document.getElementById('links').onclick = function(event) {
event = event || window.event
var target = event.target || event.srcElement,
link = target.src ? target.parentNode : target,
options = { index: link, event: event },
links = this.getElementsByTagName('a')
options['onslide']=function(index,slide) {
console.log(index)
console.log($(`#links a:nth-child(${index})`).attr('id'))
history.replaceState(null,null,'#'+$(`#links a:nth-child(${index+1})`).attr('id'))
}
options['onclose']=function(){
history.pushState(null,null,'#')
}
blueimp.gallery=blueimp.Gallery(links, options)
}
window.onpopstate = function(){
console.log(`popped state ${$(location).attr('hash')}`)
if($(location).attr('hash')=="") {
blueimp.gallery.close()
}else {
$($(location).attr('hash')).trigger('click');
}
}
console.log($(location).attr('hash').substr(1))
$($(location).attr('hash')).trigger('click');
})