diff --git a/Makefile b/Makefile
index ce25268..2778a73 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ EXT=dylib
SERVER=plugin_manager.o ini.o http_server.o plugins/dictionary.o plugins/utils.o
SERVERLIB=-lpthread -ldl
#-lsocket
-PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT)
+PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT) wterm.$(EXT)
PLUGINSDEP = plugins/plugin.o plugins/dbhelper.o plugins/dictionary.o plugins/utils.o plugins/list.o
PLUGINLIBS = -lsqlite3
diff --git a/build/htdocs/index.html b/build/htdocs/index.html
index 9be0adc..de4872c 100644
--- a/build/htdocs/index.html
+++ b/build/htdocs/index.html
@@ -1,12 +1,14 @@
-
+
+
+
diff --git a/build/htdocs/scripts/camviewer.js b/build/htdocs/scripts/camviewer.js
index 8369770..be73550 100644
--- a/build/htdocs/scripts/camviewer.js
+++ b/build/htdocs/scripts/camviewer.js
@@ -1,3 +1,4 @@
+
var picam_config = {
name: 'picam_layout',
toolbar:{
diff --git a/build/htdocs/scripts/sidebar.js b/build/htdocs/scripts/sidebar.js
index e42cdf1..ef93fec 100644
--- a/build/htdocs/scripts/sidebar.js
+++ b/build/htdocs/scripts/sidebar.js
@@ -14,7 +14,8 @@ var sidebar_config = {
text: 'Plugins',
icon: 'fa-cogs'
},
- { id: 'level-fman', text: 'File manager', icon: 'fa-folder-open' }
+ { id: 'level-fman', text: 'File manager', icon: 'fa-folder-open' },
+ { id: 'level-wterm', text: 'Terminal', icon: 'fa-wrench' }
]
},
{
@@ -47,6 +48,9 @@ var sidebar_config = {
case 'level-picam':
w2ui.layout.content('main', w2ui.picam_layout);
break;
+ case 'level-wterm':
+ w2ui.layout.content('main', w2ui.wterm_layout);
+ break;
default: //do nothing
w2ui.layout.content('main',"Empty page");
console.log('Event: ' + event.type + ' Target: ' + event.target);
diff --git a/build/htdocs/scripts/wterm.js b/build/htdocs/scripts/wterm.js
new file mode 100644
index 0000000..3dbfcbb
--- /dev/null
+++ b/build/htdocs/scripts/wterm.js
@@ -0,0 +1,245 @@
+/*! terminal.js v2.0 | (c) 2014 Erik Österberg | https://github.com/eosterberg/terminaljs */
+
+var Terminal = (function () {
+ // PROMPT_TYPE
+ var PROMPT_INPUT = 1, PROMPT_PASSWORD = 2, PROMPT_CONFIRM = 3
+
+ var fireCursorInterval = function (inputField, terminalObj) {
+ var cursor = terminalObj._cursor
+ setTimeout(function () {
+ if (inputField.parentElement && terminalObj._shouldBlinkCursor) {
+ cursor.style.visibility = cursor.style.visibility === 'visible' ? 'hidden' : 'visible'
+ fireCursorInterval(inputField, terminalObj)
+ } else {
+ cursor.style.visibility = 'visible'
+ }
+ }, 500)
+ }
+
+ var firstPrompt = true;
+ promptInput = function (terminalObj, message, PROMPT_TYPE, callback) {
+ var shouldDisplayInput = (PROMPT_TYPE === PROMPT_INPUT)
+ var inputField = document.createElement('input')
+
+ inputField.style.position = 'absolute'
+ inputField.style.zIndex = '-100'
+ inputField.style.outline = 'none'
+ inputField.style.border = 'none'
+ inputField.style.opacity = '0'
+ inputField.style.fontSize = '0.2em'
+
+ terminalObj._inputLine.textContent = ''
+ terminalObj._input.style.display = 'block'
+ terminalObj.html.appendChild(inputField)
+ fireCursorInterval(inputField, terminalObj)
+
+ if (message.length) terminalObj.msg(PROMPT_TYPE === PROMPT_CONFIRM ? message + ' (y/n)' : message)
+
+ inputField.onblur = function () {
+ terminalObj._cursor.style.display = 'none'
+ }
+
+ inputField.onfocus = function () {
+ inputField.value = terminalObj._inputLine.textContent
+ terminalObj._cursor.style.display = 'inline'
+ }
+
+ terminalObj.html.onclick = function () {
+ inputField.focus()
+ }
+
+ inputField.onkeydown = function (e) {
+ if (e.which === 37 || e.which === 39 || e.which === 38 || e.which === 40 || e.which === 9) {
+ e.preventDefault()
+ } else if (shouldDisplayInput && e.which !== 13) {
+ setTimeout(function () {
+ terminalObj._inputLine.textContent = inputField.value
+ }, 1)
+ }
+ }
+ inputField.onkeyup = function (e) {
+ if (PROMPT_TYPE === PROMPT_CONFIRM || e.which === 13) {
+ terminalObj._input.style.display = 'none'
+ var inputValue = inputField.value
+ if (shouldDisplayInput) terminalObj._print(message+inputValue,"wterm_input_div")
+ terminalObj.html.removeChild(inputField)
+ if (typeof(callback) === 'function') {
+ if (PROMPT_TYPE === PROMPT_CONFIRM) {
+ callback(inputValue.toUpperCase()[0] === 'Y' ? true : false)
+ } else callback(inputValue)
+ }
+ }
+ }
+ if (firstPrompt) {
+ firstPrompt = false
+ setTimeout(function () { inputField.focus() }, 50)
+ } else {
+ inputField.focus()
+ }
+ }
+
+ var terminalBeep
+
+ var TerminalConstructor = function (id) {
+ if (!terminalBeep) {
+ terminalBeep = document.createElement('audio')
+ var source = '