function threadPage (src, keys) { get(src).then(msg => { scroller.appendChild(render(msg, keys)) }) } function profilePage (src, keys) { var profile = h('div', {classList: 'profile'}) scroller.appendChild(profile) if (src != keys.publicKey) { reply = { author: src } scroller.appendChild(composer(keys, reply)) } else { scroller.appendChild(composer(keys)) } var subs = [src] sync(subs, keys) var input = h('input', {placeholder: 'Nova nomo'}) profile.appendChild(h('a', {href: '#' + src}, [getName(src, keys)])) profile.appendChild(h('br')) var identify = h('div', [ input, h('button', { onclick: function () { if (input.value) { content = { type: 'name', named: src, name: input.value } localforage.removeItem('name:' + src) publish(content, keys).then(post => { open(post).then(msg => { input.value = '' scroller.insertBefore(render(msg, keys), scroller.childNodes[1]) }) }) } } }, ['Identigi']) ]) var identifyButton = h('button', { onclick: function () { profile.appendChild(identify) identifyButton.parentNode.removeChild(identifyButton) } }, ['Identigi ' + src.substring(0, 10) + '...']) var mentionsButton = h('button', { onclick: function () { location.href = '#?' + src } }, ['Mencioj']) profile.appendChild(identifyButton) profile.appendChild(mentionsButton) localforage.getItem('subscriptions').then(function (subs) { if (subs.includes(src)) { profile.appendChild(h('button', { onclick: function () { subs = subs.filter(a => a !== src) localforage.setItem('subscriptions', subs).then(function () { location.reload() }) } }, ['Ne plu sekvi'])) } else { profile.appendChild(h('button', { onclick: function () { subs.push(src) localforage.setItem('subscriptions', subs).then(function () { location.reload() }) } }, ['Sekvi'])) } }) profile.appendChild(h('button', { onclick: function () { localforage.removeItem(src).then(function () { var home = true regenerate(home) }) } }, ['Forigi fluon'])) bog().then(log => { if (log) { log.forEach(function (msg) { if (msg.author === src) { scroller.appendChild(render(msg, keys)) } }) } }) /*bog(src).then(log => { if (log) { log.forEach(function (msg) { open(msg).then(post => { scroller.appendChild(render(post, keys)) }) }) } })*/ } function searchPage (src, keys) { var search = src.substring(1).replace("%20"," ").toUpperCase() //scroller.appendChild(composer(keys)) bog().then(log => { if (log) { log.forEach(function (msg) { if (msg.text) { if (msg.text.toUpperCase().includes(search)) { scroller.appendChild(render(msg, keys)) } } }) } }) } function publicPage (keys) { localforage.getItem('subscriptions').then(function (subs) { if (subs) { sync(subs, keys) } else { var subs = [keys.publicKey] localforage.setItem('subscriptions', subs) sync(subs, keys) } }) var div = h('div') div.appendChild(h('button', { onclick: function () { localforage.clear().then(function () {location.reload()}) } }, ['Forviŝi ĉion'])) div.appendChild(h('button', { onclick: function () { regenerate() } }, ['Regeneri'])) scroller.appendChild(div) scroller.appendChild(composer(keys)) bog().then(log => { if (log) { log.forEach(function (msg) { scroller.appendChild(render(msg, keys)) }) } }) } function keyPage (keys) { var message = h('div', {classList: 'message'}) message.appendChild(h('p', {innerHTML: marked('Jen via ŝlosilparo de ed25519-norma publika kaj privata ŝlosilo. Ĝi estas kreita per [TweetNaCl.js](https://tweetnacl.js.org/#/). Via publika ŝlosilo estas via identeco dum vi uzas [Interskri.be](https://interskri.be) (aŭ [Bogbook](http://bogbook.com/), la ĉefa projekto, se vi elektas tion), konservu vian ŝlosilon en sekura loko por ke vi povu uzadi la saman identecon.')})) message.appendChild(h('pre', {style: 'width: 80%'}, [h('code', [JSON.stringify(keys)])])) message.appendChild(h('button', { onclick: function () { localforage.removeItem('id', function () { location.hash = '' location.reload() }) } }, ['Forigi ŝlosilon'])) var textarea = h('textarea', {placeholder: 'Ĉi tie vi povas importi vian ekzistantan ed25519-ŝlosilparon'}) message.appendChild(textarea) message.appendChild(h('button', { onclick: function () { if (textarea.value) { localforage.setItem('id', JSON.parse(textarea.value)).then(function () { location.reload() }) } } }, ['Importi ŝlosilon'])) scroller.appendChild(message) } function pubs () { var message = h('div', {classList: 'message'}) message.appendChild(h('p', {innerHTML: marked('Jen la Bogbook-konigejoj al kiuj via foliumilo konektiĝas por kontroli pri novaj mesaĝoj de viaj sekvataj personoj, kiam vi afiŝas novajn aferojn kaj kiam vi surklakas fluojn.\n\nAldonu aŭ forigu ĉi tie konigejojn por decidi kien afiŝas la retejo. Se vi loke instalis kaj ruligas Bogbook, ĝi ankaŭ uzas tion kiel publikigo-celo. Atentu ke la kreinto de Bogbook ne ŝatas https, do ĉi tie malkiel en [Bogbook](http://bogbook.com) nur funkcias wss-konigejoj krom se via retumilo permesas konektiĝi de https al nesekuraj ws-konektoj. Vi povas loke instali kaj ruligi Bogbook [klonante la deponejon](https://git.kiefte.eu/lapingvino/bogbook-esperanto).')})) var add = h('input', {placeholder: 'Aldoni konigejon'}) localforage.getItem('securepubs').then(function (servers) { message.appendChild(h('div', [ add, h('button', { onclick: function () { if (add.value) { servers.push(add.value) localforage.setItem('securepubs', servers).then(function () { location.reload() }) } } }, ['Aldoni konigejon']) ])) servers.forEach(function (pub) { message.appendChild(h('p', [ pub, h('button', { onclick: function () { var newServers = servers.filter(item => item !== pub) localforage.setItem('securepubs', newServers).then(function () { location.reload() }) } }, ['Forigi']) ])) }) }) message.appendChild(h('button', { onclick: function () { localforage.removeItem('securepubs').then(function () { location.hash = '' location.reload() }) } }, ['Restarigi konigejojn'])) scroller.appendChild(message) }