adventure-time
Advanced tools
Comparing version 1.0.1 to 1.0.2
25
index.js
@@ -11,2 +11,5 @@ var xhr = require('xhr') | ||
if (!opts || !opts.guide || !opts.id || !opts.server) throw new Error('Must specify guide, server and id options') | ||
var proto = 'http://' | ||
if (opts.secure) proto = 'https://' | ||
@@ -20,4 +23,10 @@ var editorDiv = document.querySelector('.editor') | ||
var consoleFrame = iframe({src: opts.console || defaultConsole, container: consoleDiv}) | ||
var actions = { | ||
"toggle-bottom": function() { | ||
elementClass(editorDiv).toggle('hidden') | ||
elementClass(treeDiv).toggle('hidden') | ||
elementClass(consoleDiv).toggle('tall') | ||
elementClass(guideDiv).toggle('tall') | ||
}, | ||
"show-bottom": function() { | ||
@@ -41,10 +50,10 @@ elementClass(editorDiv).remove('hidden') | ||
}) | ||
var tree = treeView() | ||
tree.appendTo(treeDiv) | ||
var readdir = function(path, cb) { | ||
xhr({ | ||
method: 'GET', | ||
url: 'http://'+opts.server+'/files/'+opts.id+path, | ||
url: proto+opts.server+'/files/'+opts.id+path, | ||
json: true | ||
@@ -82,3 +91,3 @@ }, function(err, response) { | ||
method: 'PUT', | ||
url: 'http://'+opts.server+'/files/'+opts.id+encodeURI(filename), | ||
url: proto+opts.server+'/files/'+opts.id+encodeURI(filename), | ||
body: cm.getValue() | ||
@@ -101,3 +110,3 @@ }, cb) | ||
method: 'GET', | ||
url: 'http://'+opts.server+'/files/'+opts.id+path | ||
url: proto+opts.server+'/files/'+opts.id+path | ||
}, function(err, response) { | ||
@@ -110,3 +119,3 @@ if (err) return onerror(err) | ||
}) | ||
on(document.body, '.buttons a', 'click', function(e) { | ||
@@ -120,4 +129,4 @@ e.preventDefault() | ||
}) | ||
window.addEventListener('message', onmessage, false) | ||
@@ -124,0 +133,0 @@ } |
{ | ||
"name": "adventure-time", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "a web UI for doing nodeschool adventures in the browser", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
"edit": "^1.0.0", | ||
"element-class": "^0.1.1", | ||
"element-class": "^0.2.2", | ||
"flatui": "^1.0.0", | ||
@@ -21,0 +21,0 @@ "gh-pages-deploy": "^0.1.1", |
@@ -5,8 +5,15 @@ # adventure-time | ||
more instructions soon! | ||
## examples | ||
here are some projects based on this | ||
- https://github.com/maxogden/get-dat | ||
- https://github.com/cdaringe/try-npm-guide | ||
![screenshot](screenshot.png) | ||
### run the demo | ||
- install docker (docker for linux, boot2docker for mac/windows) | ||
- install and run https://github.com/mafintosh/try-dat | ||
- install and run https://github.com/mafintosh/docker-browser-server | ||
- install and run https://github.com/maxogden/adventure-time (the demo uses get-dat content but you can swap in your own) | ||
@@ -13,0 +20,0 @@ |
@@ -7,3 +7,3 @@ var url = require('url') | ||
module.exports = function(parentDiv) { | ||
module.exports = function (parentDiv) { | ||
var consoleDiv = parentDiv || document.querySelector('.console') | ||
@@ -14,3 +14,5 @@ | ||
var qs = url.parse(window.location.href, true).query | ||
var socket = websocket('ws://'+qs.server+'/'+(qs.id || '')) | ||
var proto = 'ws://' | ||
if (qs.secure) proto = 'wss://' | ||
var socket = websocket(proto + qs.server + '/' + (qs.id || '')) | ||
@@ -21,3 +23,3 @@ termjs.Terminal.colors[256] = '#ffffff' | ||
var container = docker({ | ||
style:false, renderer: termjs | ||
style: false, renderer: termjs | ||
}) | ||
@@ -24,0 +26,0 @@ |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
83201
12
270
34
1
+ Addedelement-class@0.2.2(transitive)
- Removedelement-class@0.1.1(transitive)
- Removedinherits@1.0.2(transitive)
Updatedelement-class@^0.2.2