aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js2
-rw-r--r--css/style.css2
-rw-r--r--index.html1
-rw-r--r--lib.js60
-rw-r--r--lib/misc.js42
-rw-r--r--render.js20
-rw-r--r--welcome.js4
7 files changed, 65 insertions, 66 deletions
diff --git a/app.js b/app.js
index 3b93d9a..0e5d054 100644
--- a/app.js
+++ b/app.js
@@ -15,7 +15,7 @@ function keyPage (keys) {
message.appendChild(h('button', {
onclick: function () {
localforage.removeItem('id', function () {
-
+ location.hash = ''
location.reload()
})
}
diff --git a/css/style.css b/css/style.css
index 1850551..a59af50 100644
--- a/css/style.css
+++ b/css/style.css
@@ -41,7 +41,7 @@ hr {
}
#scroller {
- max-width: 780px;
+ max-width: 50em;
margin-right: auto;
margin-left: auto;
}
diff --git a/index.html b/index.html
index f713fab..3eb5b1b 100644
--- a/index.html
+++ b/index.html
@@ -10,6 +10,7 @@
<script src="./lib/nacl-util.min.js"></script>
<script src="./lib/localforage.min.js"></script>
<script src="./lib/marked.min.js"></script>
+ <script src="./lib/misc.js"></script>
<script src="lib.js"></script>
<script src="welcome.js"></script>
<script src="render.js"></script>
diff --git a/lib.js b/lib.js
index 308c081..5351f95 100644
--- a/lib.js
+++ b/lib.js
@@ -1,6 +1,4 @@
-
-
-function requestFeed (src, server, requester) {
+/*function requestFeed (src, server, requester) {
console.log(src)
console.log(server)
@@ -57,7 +55,7 @@ function requestFeed (src, server, requester) {
}
}
})
-}
+}*/
// publish new messages to your log
function publish (toPublish, keys) {
@@ -210,45 +208,23 @@ function getName (id) {
return name
}
-// human-time by Dave Eddy https://github.com/bahamas10/human
-
-function human(seconds) {
- if (seconds instanceof Date)
- seconds = Math.round((Date.now() - seconds) / 1000);
- var suffix = seconds < 0 ? 'from now' : 'ago';
- seconds = Math.abs(seconds);
-
- var times = [
- seconds / 60 / 60 / 24 / 365, // years
- seconds / 60 / 60 / 24 / 30, // months
- seconds / 60 / 60 / 24 / 7, // weeks
- seconds / 60 / 60 / 24, // days
- seconds / 60 / 60, // hours
- seconds / 60, // minutes
- seconds // seconds
- ];
- var names = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second'];
-
- for (var i = 0; i < names.length; i++) {
- var time = Math.floor(times[i]);
- var name = names[i];
- if (time > 1)
- name += 's';
-
- if (time >= 1)
- return time + ' ' + name + ' ' + suffix;
+function getHeader (post, mini) {
+ var inner
+ if (mini) {
+ var inner = mini
}
- return '0 seconds ' + suffix;
-}
-// hscrpt by Dominic Tarr https://github.com/dominictarr/hscrpt/blob/master/LICENSE
-function h (tag, attrs, content) {
- if(Array.isArray(attrs)) content = attrs, attrs = {}
- var el = document.createElement(tag)
- for(var k in attrs) el[k] = attrs[k]
- if(content) content.forEach(function (e) {
- if(e) el.appendChild('string' == typeof e ? document.createTextNode(e) : e)
- })
- return el
+ var head = h('span', [
+ h('a', {href: '#' + post.key}, [
+ h('p', {classList: 'right'}, [human(new Date(post.content.timestamp))]),
+ ]),
+ h('p', [
+ h('a', {href: '#' + post.content.author}, [
+ getName(post.content.author)
+ ]),
+ inner
+ ])
+ ])
+ return head
}
diff --git a/lib/misc.js b/lib/misc.js
new file mode 100644
index 0000000..afc3a33
--- /dev/null
+++ b/lib/misc.js
@@ -0,0 +1,42 @@
+// human-time by Dave Eddy https://github.com/bahamas10/human
+
+function human(seconds) {
+ if (seconds instanceof Date)
+ seconds = Math.round((Date.now() - seconds) / 1000);
+ var suffix = seconds < 0 ? 'from now' : 'ago';
+ seconds = Math.abs(seconds);
+
+ var times = [
+ seconds / 60 / 60 / 24 / 365, // years
+ seconds / 60 / 60 / 24 / 30, // months
+ seconds / 60 / 60 / 24 / 7, // weeks
+ seconds / 60 / 60 / 24, // days
+ seconds / 60 / 60, // hours
+ seconds / 60, // minutes
+ seconds // seconds
+ ];
+ var names = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second'];
+
+ for (var i = 0; i < names.length; i++) {
+ var time = Math.floor(times[i]);
+ var name = names[i];
+ if (time > 1)
+ name += 's';
+
+ if (time >= 1)
+ return time + ' ' + name + ' ' + suffix;
+ }
+ return '0 seconds ' + suffix;
+}
+
+// hscrpt by Dominic Tarr https://github.com/dominictarr/hscrpt/blob/master/LICENSE
+function h (tag, attrs, content) {
+ if(Array.isArray(attrs)) content = attrs, attrs = {}
+ var el = document.createElement(tag)
+ for(var k in attrs) el[k] = attrs[k]
+ if(content) content.forEach(function (e) {
+ if(e) el.appendChild('string' == typeof e ? document.createTextNode(e) : e)
+ })
+ return el
+}
+
diff --git a/render.js b/render.js
index 43a90bb..c7b3f04 100644
--- a/render.js
+++ b/render.js
@@ -116,23 +116,3 @@ function renderMessage (post) {
return messageDiv
}
-function getHeader (post, mini) {
- var inner
- if (mini) {
- var inner = mini
- }
-
- var head = h('span', [
- h('a', {href: '#' + post.key}, [
- h('p', {classList: 'right'}, [human(new Date(post.content.timestamp))]),
- ]),
- h('p', [
- h('a', {href: '#' + post.content.author}, [
- getName(post.content.author)
- ]),
- inner
- ])
- ])
- return head
-}
-
diff --git a/welcome.js b/welcome.js
index 0e520e5..342756a 100644
--- a/welcome.js
+++ b/welcome.js
@@ -9,7 +9,7 @@ function welcomeScreen (keys) {
scroller.appendChild(message)
message.appendChild(h('h1', ['Welcome to Bogbook']))
- message.appendChild(h('p', ['Bogbook is a distributed blogging network of signed append-only feeds. To avoid confusion, we call them "bogs".']))
+ message.appendChild(h('p', ['Bogbook is a distributed blogging network of signed append-only feeds. We call them "bogs".']))
message.appendChild(h('p', ['Please note: Bogbook is experimental software, not for use in producton environments. Expect bugs and breaking changes. Pull-requests are needed.']))
message.appendChild(h('p', {innerHTML: marked('View the code: [http://github.com/bogbook/bog](http://github.com/bogbook/bog). Questions? [ev@evbogue.com](mailto:ev@evbogue.com).')}))
message.appendChild(h('hr'))
@@ -17,7 +17,7 @@ function welcomeScreen (keys) {
message.appendChild(h('p', {innerHTML: marked('This is an ed25519 public/private signing keypair. It was generated using [TweetNaCl.js](https://tweetnacl.js.org/#/)')}))
message.appendChild(h('pre', [JSON.stringify(keys)]))
message.appendChild(h('p', ['Right now, this keypair exists only in memory. When you leave this page, the keypair will vanish forever. If you refresh this page you\'ll receive a new keypair.']))
- message.appendChild(h('p', {innerHTML: marked('To save this keypair, identify with handle below. Once you identify, your public/private keypair will be stored in your browser using [localForage.js](https://localforage.github.io/localForage). Save your keypair somewhere safe to preserve your identity.')}))
+ message.appendChild(h('p', {innerHTML: marked('To save this keypair, identify with a handle below. Once you identify, your public/private keypair will be stored in your browser using [localForage.js](https://localforage.github.io/localForage). Save your keypair somewhere safe to preserve your identity.')}))
message.appendChild(h('hr'))
message.appendChild(h('h3', ['Identify']))