var screen = h('div', {id: 'screen'}) document.body.appendChild(screen) function route (keys) { src = window.location.hash.substring(1) var scroller = h('div', {id: 'scroller'}) var screen = document.getElementById('screen') screen.appendChild(scroller) function nameCheck (id) { localforage.getItem('name:' + id).then(name => { if (!name) { var identify = h('div', {id: 'identify', classList: 'message'}) scroller.appendChild(identify) identify.appendChild(h('span', {innerHTML: marked("Saluton [" + keys.publicKey.substring(0, 10) + "...](/#"+ keys.publicKey +")! Bonvenon al Interskri.be. Se vi havas ajnan demandon, sentu vin libera demandi ĉe [@LaPingvino](/#@gl6HzjWL8SndhDGpN1mtLkf6OXdBQi67vaAyCoCnsCU=).")})) identify.appendChild(h('span', {innerHTML: marked("Via nuna publika ŝlosilo ankoraŭ ne havas nomon. Vi povas ĉu importi vian ekzistantant identecon en la [ŝlosilo](/#key)-paĝo, aŭ identigi vin per la suba kesto. Ne estas ajna devigo identigi vin, sed vi vidos ĉi tiun bonvenigon dum vi ne donis nomon al vi.")})) var input = h('input', {placeholder: 'Donu nomon por vi'}) identify.appendChild(h('div', [ input, h('button', { onclick: function () { if (input.value) { content = { type: 'name', named: id, name: input.value } publish(content, keys) setTimeout(function () { getName(id, keys) setTimeout(function () { location.reload() }, 1000) }, 1000) } } }, ['Identigi']) ])) identify.appendChild(h('span', {innerHTML: marked("Sekve, certigu ke via paro de publika kaj privata ŝlosilo de la [ŝlosilo](/#key)-paĝo estu konservita en sekura loko por ke vi povu uzadi la saman identecon. Nur vi povas aliri vian privatan ŝlosilon, do nur vi povas restarigi la eblon afiŝi al ĉi tiu identeco. Se vi perdas vian ŝlosilon, vi perdas vian kapablon afiŝi al ĉi tiu identeco por ĉiam.")})) identify.appendChild(h('span', {innerHTML: marked("Fine, la fontkodo de ĉi tiu paĝo troveblas en [mia persona kod-deponejo](https://git.kiefte.eu/lapingvino/bogbook-esperanto)")})) } }) } nameCheck(keys.publicKey) if (src === 'key') { keyPage(keys) } else if (src === 'pubs') { pubs() } else if (src[0] === '@') { profilePage(src, keys) } else if (src[0] === '?') { searchPage(src, keys) } else if (src[0] === '%') { threadPage(src, keys) } else { publicPage(keys) } } keys().then(key => { var search = h('input', {placeholder: 'Serĉilo', classList: 'search'}) var navbar = h('div', {classList: 'navbar'}, [ h('div', {classList: 'internal'}, [ h('li', [h('a', {href: '#'}, ['Hejmo'])]), h('li', [h('a', {href: '#' + key.publicKey}, [getName(key.publicKey, keys)])]), h('li', [h('a', {href: '#key'}, ['Ŝlosilo'])]), h('li', [h('a', {href: '#pubs'}, ['Konigejoj'])]), h('li', {classList: 'right'}, [h('a', {href: 'https://git.kiefte.eu/lapingvino/bogbook-esperanto'}, ['Fontkodo'])]), h('form', { classList: 'search', onsubmit: function (e) { window.location.hash = '?' + search.value e.preventDefault() }}, [search] ) ]) ]) document.body.appendChild(navbar) route(key) }) window.onhashchange = function () { keys().then(key => { var oldscreen = document.getElementById('screen') var newscreen = h('div', {id: 'screen'}) oldscreen.parentNode.replaceChild(newscreen, oldscreen) route(key) }) }