Files: 49b26bd61308636377cd0415065fedba69c8b4d7 / index.js
1424 bytesRaw
1 | var h = require('hyperscript') |
2 | var route = require('./views') |
3 | var avatar = require('./avatar') |
4 | |
5 | var compose = require('./compose') |
6 | |
7 | var id = require('./keys').id |
8 | |
9 | document.head.appendChild(h('style', require('./style.css.json'))) |
10 | |
11 | var screen = h('div#screen') |
12 | |
13 | var nav = h('div.navbar', |
14 | h('div.internal', |
15 | h('li', h('a', {href: '#' + id}, h('span.avatar--small', avatar.image(id)))), |
16 | h('li', h('a', {href: '#' + id}, avatar.name(id))), |
17 | h('li', h('a', 'Compose', { |
18 | onclick: function () { |
19 | if (document.getElementById('composer')) { return } |
20 | else { |
21 | var currentScreen = document.getElementById('screen') |
22 | var opts = {} |
23 | opts.type = 'post' |
24 | var composer = h('div.content#composer', h('div.message', compose(opts))) |
25 | currentScreen.firstChild.insertBefore(composer, currentScreen.firstChild.firstChild) |
26 | } |
27 | } |
28 | })), |
29 | h('li', h('a', {href: '#'}, 'Public')), |
30 | h('li', h('a', {href: '#private' }, 'Private')), |
31 | h('li', h('a', {href: '#mentions' }, 'Mentions')), |
32 | h('li', h('a', {href: '#key' }, 'Key')), |
33 | h('li.right', h('a', {href: '#about'}, '?')) |
34 | ) |
35 | ) |
36 | |
37 | document.body.appendChild(nav) |
38 | document.body.appendChild(screen) |
39 | route() |
40 | |
41 | window.onhashchange = function () { |
42 | var oldscreen = document.getElementById('screen') |
43 | var newscreen = h('div#screen') |
44 | oldscreen.parentNode.replaceChild(newscreen, oldscreen) |
45 | route() |
46 | } |
47 | |
48 |
Built with git-ssb-web