aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js72
1 files changed, 0 insertions, 72 deletions
diff --git a/app.js b/app.js
index b1c3d91..bab24e7 100644
--- a/app.js
+++ b/app.js
@@ -1,78 +1,6 @@
var screen = h('div', {id: 'screen'})
document.body.appendChild(screen)
-function composer (keys, reply, gotName) {
- var messageDiv = h('div')
- var message = h('div', {classList: 'message'})
-
- if (gotName) {
- console.log(gotName.textContent)
- var textarea = h('textarea', ['[' + gotName.textContent + '](' + reply.author + ')'])
- } else {
-
- var textarea = h('textarea', {placeholder: 'Write a new bog post...'})
- }
-
-
-
- var publisher = h('div', [
- textarea,
- h('button', {
- onclick: function () {
- if (textarea.value) {
- var content = {
- type: 'post',
- text: textarea.value
- }
- if (reply) {
- content.reply = reply.key
- }
-
- publish(content, keys, {preview: true}).then(post => {
- open(post).then(msg => {
- var preview = render(msg, keys, {preview: true})
- var cache = messageDiv.firstChild
- messageDiv.appendChild(preview)
- messageDiv.removeChild(messageDiv.firstChild)
- preview.firstChild.appendChild(h('button', {
- onclick: function () {
- messageDiv.removeChild(messageDiv.firstChild)
- messageDiv.appendChild(cache)
- }
- }, ['Cancel']))
- preview.firstChild.appendChild(h('button', {
- onclick: function () {
- publish(content, keys).then(post => {
- open(post).then(msg => {
- textarea.value = ''
- if (reply) {
- messageDiv.removeChild(messageDiv.firstChild)
- }
- if (messageDiv.firstChild) {
- messageDiv.removeChild(messageDiv.firstChild)
- messageDiv = h('div')
- messageDiv.appendChild(cache)
- scroller.insertBefore(messageDiv, scroller.childNodes[2])
- scroller.insertBefore(render(msg, keys), scroller.childNodes[3])
- } else {
- messageDiv.appendChild(render(msg, keys))
- }
- })
- })
- }
- }, ['Publish']))
- })
- })
- }
- }
- }, ['Preview'])
- ])
-
- message.appendChild(publisher)
- messageDiv.appendChild(message)
- return messageDiv
-}
-
function route (keys) {
src = window.location.hash.substring(1)