initial commit
commit
8856e4b188
@ -0,0 +1 @@
|
||||
node_modules
|
@ -0,0 +1,193 @@
|
||||
var screen = h('div', {id: 'screen'})
|
||||
|
||||
document.body.appendChild(screen)
|
||||
|
||||
var header = h('div', {classList: 'message'})
|
||||
|
||||
var keys = getKeys()
|
||||
|
||||
function compose (keys, opts) {
|
||||
var header = h('div', {classList: 'message'})
|
||||
var scroller = document.getElementById('scroller')
|
||||
|
||||
scroller.insertBefore(header, scroller.firstChild)
|
||||
|
||||
var textarea = h('textarea', {placeholder: 'Write a new bog post'})
|
||||
|
||||
header.appendChild(textarea)
|
||||
|
||||
var composer = h('div', [
|
||||
h('button', {
|
||||
onclick: function () {
|
||||
if (textarea.value) {
|
||||
var content = {
|
||||
author: keys.publicKey,
|
||||
type: 'post',
|
||||
text: textarea.value,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
textarea.value = ''
|
||||
publish(content, keys)
|
||||
}
|
||||
}
|
||||
}, ['Publish'])
|
||||
])
|
||||
|
||||
header.appendChild(composer)
|
||||
}
|
||||
|
||||
function route () {
|
||||
src = window.location.hash.substring(1)
|
||||
var scroller = h('div', {id: 'scroller'})
|
||||
var screen = document.getElementById('screen')
|
||||
|
||||
|
||||
screen.appendChild(scroller)
|
||||
|
||||
if (src === 'key') {
|
||||
var keyMessage = h('div', {classList: 'message'})
|
||||
|
||||
// delete key button
|
||||
keyMessage.appendChild(h('button', {classList: 'right',
|
||||
onclick: function () {
|
||||
localStorage['id'] = ''
|
||||
location.reload()
|
||||
}
|
||||
}, ['Delete Key']))
|
||||
|
||||
// print stringified keypair
|
||||
keyMessage.appendChild(h('pre', {style: 'width: 80%'}, [h('code', [JSON.stringify(keys)])]))
|
||||
|
||||
scroller.appendChild(keyMessage)
|
||||
}
|
||||
|
||||
else if (src[0] === '@') {
|
||||
var profile = h('div', {classList: 'message'})
|
||||
scroller.appendChild(profile)
|
||||
|
||||
var nameInput = h('input', {placeholder: 'Publish a new name'})
|
||||
|
||||
var namePublisher = h('div',[
|
||||
nameInput,
|
||||
h('button', {
|
||||
onclick: function () {
|
||||
if (nameInput.value) {
|
||||
|
||||
var content = {
|
||||
author: keys.publicKey,
|
||||
type: 'name',
|
||||
text: nameInput.value,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
|
||||
publish(content, keys)
|
||||
}
|
||||
}
|
||||
}, ['Publish'])
|
||||
])
|
||||
|
||||
profile.appendChild(namePublisher)
|
||||
|
||||
readFile()
|
||||
|
||||
var imageInput = h('span', [
|
||||
h('input', {id: 'inp', type:'file'}),
|
||||
h('span', {id: 'b64'}),
|
||||
h('img', {id: 'img'})
|
||||
])
|
||||
|
||||
var imagePublisher = h('div', [
|
||||
imageInput,
|
||||
h('button', {
|
||||
onclick: function () {
|
||||
var content = {
|
||||
author: keys.publicKey,
|
||||
type: 'image',
|
||||
image: document.getElementById("img").src,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
|
||||
publish(content, keys)
|
||||
}
|
||||
}, ['Publish'])
|
||||
])
|
||||
|
||||
profile.appendChild(imagePublisher)
|
||||
|
||||
document.getElementById("inp").addEventListener("change", readFile);
|
||||
|
||||
|
||||
var ws = new WebSocket('ws://localhost:8080/' + src)
|
||||
|
||||
var clientLog = {
|
||||
publicKey: src
|
||||
}
|
||||
|
||||
if (localStorage[src]) {
|
||||
clientLog.log = JSON.parse(localStorage[src])
|
||||
} else {
|
||||
clientLog.log = []
|
||||
}
|
||||
|
||||
/*if (localSTorage['log']) {
|
||||
var publicLog = localStorage['log']
|
||||
} else {
|
||||
var publicLog = []
|
||||
}*/
|
||||
|
||||
ws.onopen = function () {
|
||||
ws.send(JSON.stringify(clientLog))
|
||||
}
|
||||
|
||||
ws.onmessage = function (ev) {
|
||||
var serverData = JSON.parse(ev.data)
|
||||
if (serverData.log.length > clientLog.log.length) {
|
||||
localStorage[src] = JSON.stringify(serverData.log)
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage[src]) {
|
||||
var log = JSON.parse(localStorage[src])
|
||||
for (var i=0; i < log.length; i++) {
|
||||
var post = log[i]
|
||||
scroller.appendChild(renderMessage(post))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (src[0] === '%') {
|
||||
if (localStorage['log']) {
|
||||
var log = JSON.parse(localStorage['log'])
|
||||
for (var i=0; i < log.length; i++) {
|
||||
if (log[i].key === src) {
|
||||
var post = log[i]
|
||||
scroller.appendChild(renderMessage(post))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
compose(keys)
|
||||
if (localStorage['log']) {
|
||||
var log = JSON.parse(localStorage['log'])
|
||||
for (var i=0; i < log.length; i++) {
|
||||
var post = log[i]
|
||||
scroller.appendChild(renderMessage(post))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
route()
|
||||
|
||||
window.onhashchange = function () {
|
||||
var oldscreen = document.getElementById('screen')
|
||||
var newscreen = h('div', {id: 'screen'})
|
||||
oldscreen.parentNode.replaceChild(newscreen, oldscreen)
|
||||
route()
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,110 @@
|
||||
body {
|
||||
font-family: 'Source Sans Pro';
|
||||
background: #222;
|
||||
color: #f5f5f5;
|
||||
max-width: 780px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
#screen {
|
||||
top: 0; right: 0; left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.right { float: right;}
|
||||
|
||||
.message {
|
||||
background: #333;
|
||||
margin-top: .5em;
|
||||
padding: .5em;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
img.small {
|
||||
vertical-align: top;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
margin-right: .2em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: cyan;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
pre {
|
||||
color: violet;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
code {
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
overflow: auto;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
white-space: pre;
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: pre-wrap;
|
||||
white-space: pre\9;
|
||||
}
|
||||
|
||||
textarea, input {
|
||||
background: #222;
|
||||
padding: .5em;
|
||||
color: #f5f5f5;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
padding: 2px 6px;
|
||||
margin: .2em .2em .2em 0em;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: #d5d5d5;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-color: #222;
|
||||
border: 1px solid #222;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
button:focus,
|
||||
button:active {
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
button.active {
|
||||
background-color: #111;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,93 @@
|
||||
Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,20 @@
|
||||
# Source Sans Pro
|
||||
|
||||
Source Sans Pro is a set of OpenType fonts that have been designed to work well
|
||||
in user interface (UI) environments. In addition to a functional OpenType font, this open
|
||||
source project provides all of the source files that were used to build this OpenType font
|
||||
by using the AFDKO makeotf tool.
|
||||
|
||||
## Installation instructions
|
||||
|
||||
* [Mac OS X](http://support.apple.com/kb/HT2509)
|
||||
* [Windows](http://windows.microsoft.com/en-us/windows-vista/install-or-uninstall-fonts)
|
||||
* [Linux/Unix-based systems](https://github.com/adobe-fonts/source-code-pro/issues/17#issuecomment-8967116)
|
||||
|
||||
## Getting Involved
|
||||
|
||||
Send suggestions for changes to the Source Sans OpenType font project maintainer, [Paul D. Hunt](mailto:opensourcefonts@adobe.com?subject=[GitHub] Source Sans Pro), for consideration.
|
||||
|
||||
## Further information
|
||||
|
||||
For information about the design and background of Source Sans, please refer to the [official font readme file](http://htmlpreview.github.io/?https://github.com/adobe-fonts/source-sans-pro/blob/master/SourceSansProReadMe.html).
|
@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Read Me File for Adobe® OpenType® Fonts</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body bgcolor="white" link="#ce0000" alink="#ce0000" vlink="#9c6363">
|
||||
<h2><font color="#333333"
|
||||
face="verdana,geneva,arial">Adobe® OpenType® Fonts</font></h2>
|
||||
<p><font size="2" face="verdana,geneva,arial">Thank
|
||||
you for licensing Adobe OpenType fonts. In order to ensure that you
|
||||
have the most up-to-date product information, Adobe has posted <a
|
||||
href="http://www.adobe.com/type/browser/OTReadMe.html">an OpenType
|
||||
Read Me file</a> on the Adobe web site that contains information such
|
||||
as minimum system requirements, technical support contact information
|
||||
and software installation notes. We have also posted <a
|
||||
href="http://www.adobe.com/type/browser/pdfs/OTGuide.pdf">an OpenType
|
||||
User's Guide</a> in PDF format on the Adobe web site that can be
|
||||
viewed online and downloaded to your computer. <P>If you have
|
||||
licensed an Adobe OpenType Pro font, there may be additional PDF
|
||||
documents, such as a specimen book, a glyph complement showing, and a
|
||||
typeface-specific Read Me file, available on the typeface’s
|
||||
product pages on the Adobe web site. These additional files may be
|
||||
viewed online or downloaded to your computer.<P>To get you started
|
||||
quickly, below are links to localized installation instructions for
|
||||
your fonts.
|
||||
|
||||
<h4>Installation Instructions</h4><hr>
|
||||
<p lang=en><b>English</b><br>
|
||||
Instructions for installing this font can be found online at <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=fr><b>French / Français</b><br>
|
||||
Le mode d'installation de cette police de caractère se trouve en
|
||||
ligne à <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=de><b>German / Deutsch</b><br>
|
||||
Die Anweisungen zur Installation dieser Schriftart finden Sie online
|
||||
unter <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=it><b>Italian / Italiano</b><br>
|
||||
Le istruzioni per l'installazione di questo font sono disponibili
|
||||
online all'indirizzo <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=es><b>Spanish / Español</b><br>
|
||||
Las instrucciones para instalar esta fuente se pueden encontrar
|
||||
online en <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=nl><b>Dutch / Hollands</b><br>
|
||||
De instructies voor de installatie van dit lettertype vindt u op <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p><b>Swedish / Svenska</b><br>
|
||||
Anvisningar för hur det här teckensnittet installeras finns
|
||||
online på <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p><b>Norwegian / Norsk</b><br>
|
||||
Instruksjoner for installering av skrifttypen finnes online på
|
||||
<a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p><b>Finnish / Suomi</b><br>
|
||||
Ohjeet tämän fontin asentamiseen löytyvät
|
||||
osoitteesta <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p><b>Danish / Dansk</b><br>
|
||||
Du finder en vejledning i installation af denne skrifttype online
|
||||
på adressen <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
|
||||
<p lang=ja><b>Japanese / 日本語</b><br>
|
||||
このフォントをインストールする手順は、オンラインで <a
|
||||
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>
|
||||
を参照してください。</p>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "source-sans-pro",
|
||||
"version": "2.010R-ro/1.065R-it",
|
||||
"main": "source-sans-pro.css",
|
||||
"homepage": "https://github.com/adobe-fonts/source-sans-pro",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/adobe-fonts/source-sans-pro.git"
|
||||
},
|
||||
"authors": [
|
||||
{ "name": "Paul D. Hunt" }
|
||||
],
|
||||
"description": "Source Sans Pro font family by Adobe",
|
||||
"license": "SIL OFL 1.1",
|
||||
"keywords": ["font", "sourcesans", "sourcesanspro", "source sans", "source sans pro"],
|
||||
"ignore": ["**/.*"]
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-ExtraLight.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-ExtraLight.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-ExtraLight.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-ExtraLight.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 200;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-ExtraLightIt.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-ExtraLightIt.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-ExtraLightIt.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-ExtraLightIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-Light.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-Light.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-Light.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-Light.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-LightIt.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-LightIt.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-LightIt.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-LightIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-Regular.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-Regular.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-Regular.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-Regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-It.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-It.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-It.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-It.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-Semibold.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-Semibold.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-Semibold.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-Semibold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-SemiboldIt.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-SemiboldIt.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-SemiboldIt.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-SemiboldIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-Bold.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-Bold.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-Bold.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-Bold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-BoldIt.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-BoldIt.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-BoldIt.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-BoldIt.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-Black.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-Black.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-Black.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-Black.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Source Sans Pro';
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
font-stretch: normal;
|
||||
src: url('EOT/SourceSansPro-BlackIt.eot') format('embedded-opentype'),
|
||||
url('WOFF/OTF/SourceSansPro-BlackIt.otf.woff') format('woff'),
|
||||
url('OTF/SourceSansPro-BlackIt.otf') format('opentype'),
|
||||
url('TTF/SourceSansPro-BlackIt.ttf') format('truetype');
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Basic example bog</title>
|
||||
<link rel='stylesheet' href='./css/source-sans-pro.min.css' />
|
||||
<link rel='stylesheet' href='./css/style.css' />
|
||||
</head>
|
||||
<body>
|
||||
<script src="nacl.min.js"></script>
|
||||
<script src="nacl-util.min.js"></script>
|
||||
<script src="lib.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,264 @@
|
||||
// generate a public.private keypair with TweetNaCl.js
|
||||
|
||||
function getKeys () {
|
||||
if (localStorage['id']) {
|
||||
var keys = JSON.parse(localStorage['id'])
|
||||
return keys
|
||||
} else {
|
||||
|
||||
var genkey = nacl.sign.keyPair()
|
||||
if (genkey) {
|
||||
var keys = {
|
||||
publicKey: '@' + nacl.util.encodeBase64(genkey.publicKey),
|
||||
privateKey: nacl.util.encodeBase64(genkey.secretKey),
|
||||
}
|
||||
|
||||
console.log(genkey)
|
||||
if ((keys.publicKey.includes('+')) || (keys.publicKey.includes('/'))) {
|
||||
console.log('TRYING AGAIN')
|
||||
setTimeout(function () {
|
||||
window.location.reload()
|
||||
}, 100)
|
||||
} else {
|
||||
localStorage['id'] = JSON.stringify(keys)
|
||||
return keys
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// publish new messages to your log
|
||||
function publish (content, keys) {
|
||||
|
||||
if (localStorage[keys.publicKey]) {
|
||||
var log = JSON.parse(localStorage[keys.publicKey])
|
||||
var lastPost = log[0]
|
||||
var seq = lastPost.content.sequence
|
||||
content.sequence = ++seq
|
||||
content.previous = nacl.util.encodeBase64(nacl.hash(nacl.util.decodeUTF8(JSON.stringify(log[0]))))
|
||||
console.log(content.previous)
|
||||
} else {
|
||||
console.log('SEQUENCE 0')
|
||||
content.sequence = 0
|
||||
}
|
||||
|
||||
var post = {
|
||||
content: content,
|
||||
signature: nacl.util.encodeBase64(nacl.sign(nacl.util.decodeUTF8(JSON.stringify(content)), nacl.util.decodeBase64(keys.privateKey)))
|
||||
}
|
||||
|
||||
// add key (which is a hash of the stringified object post)
|
||||
post.key = '%' + nacl.util.encodeBase64(nacl.hash(nacl.util.decodeUTF8(JSON.stringify(post))))
|
||||
|
||||
// update the log
|
||||
updateLog(keys.publicKey, post)
|
||||
|
||||
var scroller = document.getElementById('scroller')
|
||||
if (scroller.firstChild) {
|
||||
scroller.insertBefore(renderMessage(post), scroller.childNodes[1])
|
||||
} else {
|
||||
scroller.appendChild(renderMessage(post))
|
||||
}
|
||||
}
|
||||
|
||||
// update your log in the browser
|
||||
|
||||
function updateLog (feed, post) {
|
||||
if (localStorage[feed]) {
|
||||
var log = JSON.parse(localStorage[feed])
|
||||
log.unshift(post)
|
||||
localStorage[feed] = JSON.stringify(log)
|
||||
} else {
|
||||
var log = [post]
|
||||
localStorage[feed] = JSON.stringify(log)
|
||||
}
|
||||
|
||||
if (localStorage['log']) {
|
||||
var log = JSON.parse(localStorage['log'])
|
||||
log.unshift(post)
|
||||
localStorage['log'] = JSON.stringify(log)
|
||||
} else {
|
||||
var log = [post]
|
||||
localStorage['log'] = JSON.stringify(log)
|
||||
}
|
||||
}
|
||||
|
||||
// file uploaders for user images
|
||||
|
||||
function readFile () {
|
||||
if (this.files && this.files[0]) {
|
||||
|
||||
var fr = new FileReader();
|
||||
|
||||
fr.addEventListener("load", function(e) {
|
||||
var image = e.target.result
|
||||
document.getElementById("img").src = e.target.result;
|
||||
document.getElementById("img").style = 'width: 75px; height: 75px';
|
||||
document.getElementById("b64").innerHTML = e.target.result;
|
||||
});
|
||||
|
||||
fr.readAsDataURL( this.files[0] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// render messages
|
||||
|
||||
function renderMessage (post) {
|
||||
var message = h('div', {classList: 'message'})
|
||||
|
||||
if (post.content.type == 'name') {
|
||||
var mini = h('span', [
|
||||
' identified as ',
|
||||
post.content.text
|
||||
])
|
||||
|
||||
message.appendChild(getHeader(post, mini))
|
||||
//message.appendChild(h('pre', [JSON.stringify(post)]))
|
||||
}
|
||||
|
||||
if (post.content.type == 'image') {
|
||||
|
||||
var mini = h('span', [
|
||||
' identified as ',
|
||||
h('img', {classList: 'small', src:post.content.image})
|
||||
])
|
||||
|
||||
message.appendChild(getHeader(post, mini))
|
||||
//message.appendChild(h('pre', [JSON.stringify(post)]))
|
||||
}
|
||||
|
||||
if (post.content.type == 'post') {
|
||||
|
||||
|
||||
message.appendChild(getHeader(post))
|
||||
message.appendChild(h('div', [post.content.text]))
|
||||
message.appendChild(h('pre', [JSON.stringify(post)]))
|
||||
|
||||
var textarea = h('textarea', {placeholder: 'Reply to this bog post'})
|
||||
|
||||
message.appendChild(h('button', {
|
||||
onclick: function () {
|
||||
message.appendChild(textarea)
|
||||
message.appendChild(h('button', {
|
||||
onclick: function () {
|
||||
if (textarea.value) {
|
||||
var content = {
|
||||
author: keys.publicKey,
|
||||
type: 'post',
|
||||
text: textarea.value,
|
||||
reply: post.key,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
console.log(content)
|
||||
publish(content, keys)
|
||||
}
|
||||
}
|
||||
}, ['Publish']))
|
||||
|
||||
}
|
||||
}, ['Reply']))
|
||||
|
||||
|
||||
}
|
||||
|
||||
return message
|
||||
}
|
||||
|
||||
|
||||
function getImage (id) {
|
||||
var image = h('img', {classList: 'small'})
|
||||
|
||||
if (localStorage[id]) {
|
||||
var log = JSON.parse(localStorage[id])
|
||||
for (var i=0; i < log.length; i++) {
|
||||
var imagePost = log[i]
|
||||
if (imagePost.content.type == 'image') {
|
||||
image = h('img', {classList: 'small', src: imagePost.content.image})
|
||||
return image
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image
|
||||
}
|
||||
|
||||
function getName (id) {
|
||||
var name = h('span', [id])
|
||||
if (localStorage[id]) {
|
||||
var log = JSON.parse(localStorage[id])
|
||||
for (var i=0; i < log.length; i++) {
|
||||
var namePost = log[i]
|
||||
if (namePost.content.type == 'name') {
|
||||
name = h('span', ['@' + namePost.content.text])
|
||||
return name
|
||||
}
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
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}, [
|
||||
getImage(post.content.author),
|
||||
getName(post.content.author)
|
||||
]),
|
||||
inner
|
||||
])
|
||||
])
|
||||
return head
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
!function(e,n){"use strict";"undefined"!=typeof module&&module.exports?module.exports=n():e.nacl?e.nacl.util=n():(e.nacl={},e.nacl.util=n())}(this,function(){"use strict";function e(e){if(!/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}var n={};return n.decodeUTF8=function(e){if("string"!=typeof e)throw new TypeError("expected string");var n,r=unescape(encodeURIComponent(e)),t=new Uint8Array(r.length);for(n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t},n.encodeUTF8=function(e){var n,r=[];for(n=0;n<e.length;n++)r.push(String.fromCharCode(e[n]));return decodeURIComponent(escape(r.join("")))},"undefined"==typeof atob?"undefined"!=typeof Buffer.from?(n.encodeBase64=function(e){return Buffer.from(e).toString("base64")},n.decodeBase64=function(n){return e(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(n.encodeBase64=function(e){return new Buffer(e).toString("base64")},n.decodeBase64=function(n){return e(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(n.encodeBase64=function(e){var n,r=[],t=e.length;for(n=0;n<t;n++)r.push(String.fromCharCode(e[n]));return btoa(r.join(""))},n.decodeBase64=function(n){e(n);var r,t=atob(n),o=new Uint8Array(t.length);for(r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o}),n});
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "bogbook",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"async-limiter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
|
||||
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
|
||||
},
|
||||
"ecstatic": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.1.tgz",
|
||||
"integrity": "sha512-/rrctvxZ78HMI/tPIsqdvFKHHscxR3IJuKrZI2ZoUgkt2SiufyLFBmcco+aqQBIu6P1qBsUNG3drAAGLx80vTQ==",
|
||||
"requires": {
|
||||
"he": "^1.1.1",
|
||||
"mime": "^1.6.0",
|
||||
"minimist": "^1.1.0",
|
||||
"url-join": "^2.0.5"
|
||||
}
|
||||
},
|
||||
"he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
|
||||
},
|
||||
"is-wsl": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
|
||||
"integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"opn": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/opn/-/opn-6.0.0.tgz",
|
||||
"integrity": "sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ==",
|
||||
"requires": {
|
||||
"is-wsl": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"url-join": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz",
|
||||
"integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg="
|
||||