diff --git a/Makefile b/Makefile index 5cb607f..d337c71 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BUILDDIR?=./build -PROJS?=grs info blog apps os doc ci +PROJS?=grs info blog os doc ci copyfiles = index.ls mimes.json main: copy for f in $(PROJS); do BUILDDIR=$(BUILDDIR)/"$${f}" make -C "$${f}" ; done diff --git a/apps/Makefile b/apps/Makefile deleted file mode 100644 index 2f255ea..0000000 --- a/apps/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -copyfiles = router.lua controllers logs views models -coffees = assets/coffee/bootstrap.coffee \ - assets/coffee/BaseObject.coffee \ - assets/coffee/APIManager.coffee \ - assets/coffee/MarkOn.coffee \ - assets/coffee/WebVNC.coffee - -SED=sed -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Darwin) - SED=gsed -endif - -main: js - - mkdir -p $(BUILDDIR)/assets - cp -rvf $(copyfiles) $(BUILDDIR) - cp -rv assets/css assets/scripts $(BUILDDIR)/assets - - cd $(BUILDDIR) && ln -s ../grs ./rst - -js: - - rm assets/scripts/main.* - for f in $(coffees); do (cat "$${f}"; echo) >> assets/scripts/main.coffee; done - coffee --compile assets/scripts/main.coffee - -rm assets/scripts/main.coffee \ No newline at end of file diff --git a/apps/assets/coffee/APIManager.coffee b/apps/assets/coffee/APIManager.coffee deleted file mode 100644 index 3421cd9..0000000 --- a/apps/assets/coffee/APIManager.coffee +++ /dev/null @@ -1,24 +0,0 @@ -class APIManager extends window.classes.BaseObject - constructor: (@args) -> - super "APIManager" - - init: () -> - me = @ - return console.error "No class found" unless @args and @args.length > 0 - cname = (@args.splice 0,1)[0].trim() - @ready() - .then () -> - if mobilecheck() - mobileConsole.init() - # load the class - return if not cname or cname is "" - return console.error("Cannot find class ", cname) unless window.classes[cname] - (new window.classes[cname](me.args)).init() - .catch ( m, s ) -> - console.error(m, s) - -APIManager.dependencies = [ - "/assets/scripts/mobile_console.js" -] - -makeclass "APIManager", APIManager \ No newline at end of file diff --git a/apps/assets/coffee/BaseObject.coffee b/apps/assets/coffee/BaseObject.coffee deleted file mode 100644 index 397a1d8..0000000 --- a/apps/assets/coffee/BaseObject.coffee +++ /dev/null @@ -1,36 +0,0 @@ -# private function -require = (lib) -> - return new Promise (r, e) -> - return r() if window.libraries[lib] - $.getScript window.myuri + lib - .done (d) -> - window.libraries[lib] = true - r() - .fail (m, s) -> - e(m, s) - -class BaseObject - constructor: (@name) -> - - ready: () -> - me = @ - return new Promise (r, e) -> - me.resolveDep() - .then () -> r() - .catch (m, s) -> e(m, s) - - resolveDep: () -> - me = @ - return new Promise (r, e) -> - dep = window.classes[me.name].dependencies - r() unless dep - - fn = (l, i) -> - return r() if i >= dep.length - require(l[i]) - .then () -> fn(l, i + 1) - .catch (m, s) -> e(m, s) - fn dep, 0 - -makeclass "BaseObject", BaseObject - \ No newline at end of file diff --git a/apps/assets/coffee/MarkOn.coffee b/apps/assets/coffee/MarkOn.coffee deleted file mode 100644 index 6aebd53..0000000 --- a/apps/assets/coffee/MarkOn.coffee +++ /dev/null @@ -1,17 +0,0 @@ -class MarkOn extends window.classes.BaseObject - constructor: () -> - super "MarkOn" - - init: () -> - me = @ - @ready() - .then () -> - me.editor = new SimpleMDE { element: $("#editor")[0] } - .catch (m, s) -> - console.error(m, s) - -MarkOn.dependencies = [ - "/rst/gscripts/mde/simplemde.min.js" -] - -makeclass "MarkOn", MarkOn \ No newline at end of file diff --git a/apps/assets/coffee/WebVNC.coffee b/apps/assets/coffee/WebVNC.coffee deleted file mode 100644 index 93db32f..0000000 --- a/apps/assets/coffee/WebVNC.coffee +++ /dev/null @@ -1,55 +0,0 @@ -class WebVNC extends window.classes.BaseObject - constructor: () -> - super "WebVNC" - - init: () -> - me = @ - @ready() - .then () -> - me.initVNCClient() - .catch (m, s) -> - console.error(m, s) - - initVNCClient: () -> - args = - { - element: 'canvas', - #ws: 'wss://localhost:9192/wvnc', - ws: 'wss://lxsang.me/wvnc', - worker: '/assets/scripts/decoder.js' - } - - @client = new WVNC args - me = @ - @client.onpassword = () -> - return new Promise (r,e) -> - r('demopass') - @client.oncredential = () -> - return new Promise (r,e) -> - r('demo', 'demo') - @client.oncopy = (text) -> - cosole.log text - @client.onerror = (m) -> - alert(m) - @client.init() - .then () -> - $("#connect").click (e) -> - me.client.connect "/opt/www/vnc.conf", { - bbp: 32, - flag: 3, - quality: 30 - } - $("#tbstatus").html "32bbp, compression JPEG & ZLib, JPEG quality 30%" - $("#stop").click (e) -> - me.client.disconnect() - $("#selscale").on 'change', (e) -> - value = Number(@value)/100 - me.client.setScale value - #$("#btclipboard").click (e) -> - # me.client.sendTextAsClipboard ($ "#clipboard")[0].value - .catch (m,s) -> - console.error m, s -WebVNC.dependencies = [ - "/assets/scripts/wvnc.js" -] -makeclass "WebVNC", WebVNC \ No newline at end of file diff --git a/apps/assets/coffee/bootstrap.coffee b/apps/assets/coffee/bootstrap.coffee deleted file mode 100644 index 11d740b..0000000 --- a/apps/assets/coffee/bootstrap.coffee +++ /dev/null @@ -1,20 +0,0 @@ -window.classes = {} -window.libraries = {} -window.myuri = "/" -window.mobilecheck = () -> - if navigator.userAgent.match(/Android/i) or navigator.userAgent.match(/webOS/i) or navigator.userAgent.match(/iPhone/i) or navigator.userAgent.match(/iPad/i) or navigator.userAgent.match(/iPod/i) or navigator.userAgent.match(/BlackBerry/i) or navigator.userAgent.match(/Windows Phone/i) - return true - return false - -window.makeclass = (n, o) -> window.classes[n] = o - -### -window.require = (lib) -> - return new Promise (r, e) -> - return r() if window.libraries[lib] - $.getScript window.myuri + lib - .done (d) -> - window.libraries[lib] = true - r() - .fail (m, s) -> - e(m, s) ### diff --git a/apps/assets/css/style.css b/apps/assets/css/style.css deleted file mode 100644 index 4a0972f..0000000 --- a/apps/assets/css/style.css +++ /dev/null @@ -1,46 +0,0 @@ -/** - * simplemde v1.11.2 - * Copyright Next Step Webs, Inc. - * @link https://github.com/NextStepWebs/simplemde-markdown-editor - * @license MIT - */ - .CodeMirror{color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important;-webkit-user-select:none;-moz-user-select:none;user-select:none}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:none;font-variant-ligatures:none}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected,.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror{height:auto;min-height:300px;border:1px solid #ddd;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:1}.CodeMirror-scroll{min-height:300px}.CodeMirror-fullscreen{background:#fff;position:fixed!important;top:50px;left:0;right:0;bottom:0;height:auto;z-index:9}.CodeMirror-sided{width:50%!important}.editor-toolbar{position:relative;opacity:.6;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:0 10px;border-top:1px solid #bbb;border-left:1px solid #bbb;border-right:1px solid #bbb;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar:after,.editor-toolbar:before{display:block;content:' ';height:1px}.editor-toolbar:before{margin-bottom:8px}.editor-toolbar:after{margin-top:8px}.editor-toolbar:hover,.editor-wrapper input.title:focus,.editor-wrapper input.title:hover{opacity:.8}.editor-toolbar.fullscreen{width:100%;height:50px;overflow-x:auto;overflow-y:hidden;white-space:nowrap;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen::before{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,1)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen::after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,rgba(255,255,255,1)));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);position:fixed;top:0;right:0;margin:0;padding:0}.editor-toolbar a{display:inline-block;text-align:center;text-decoration:none!important;color:#2c3e50!important;width:30px;height:30px;margin:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar a.active,.editor-toolbar a:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar a:before{line-height:30px}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar a.fa-header-x:after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar a.fa-header-1:after{content:"1"}.editor-toolbar a.fa-header-2:after{content:"2"}.editor-toolbar a.fa-header-3:after{content:"3"}.editor-toolbar a.fa-header-bigger:after{content:"▲"}.editor-toolbar a.fa-header-smaller:after{content:"▼"}.editor-toolbar.disabled-for-preview a:not(.no-disable){pointer-events:none;background:#fff;border-color:transparent;text-shadow:inherit}@media only screen and (max-width:700px){.editor-toolbar a.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-preview,.editor-preview-side{padding:10px;background:#fafafa;overflow:auto;display:none;box-sizing:border-box}.editor-statusbar .lines:before{content:'lines: '}.editor-statusbar .words:before{content:'words: '}.editor-statusbar .characters:before{content:'characters: '}.editor-preview{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;border:1px solid #ddd}.editor-preview-active,.editor-preview-active-side{display:block}.editor-preview-side>p,.editor-preview>p{margin-top:0}.editor-preview pre,.editor-preview-side pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.CodeMirror .CodeMirror-code .cm-tag{color:#63a35c}.CodeMirror .CodeMirror-code .cm-attribute{color:#795da3}.CodeMirror .CodeMirror-code .cm-string{color:#183691}.CodeMirror .CodeMirror-selected{background:#d9d9d9}.CodeMirror .CodeMirror-code .cm-header-1{font-size:200%;line-height:200%}.CodeMirror .CodeMirror-code .cm-header-2{font-size:160%;line-height:160%}.CodeMirror .CodeMirror-code .cm-header-3{font-size:125%;line-height:125%}.CodeMirror .CodeMirror-code .cm-header-4{font-size:110%;line-height:110%}.CodeMirror .CodeMirror-code .cm-comment{background:rgba(0,0,0,.05);border-radius:2px}.CodeMirror .CodeMirror-code .cm-link{color:#7f8c8d}.CodeMirror .CodeMirror-code .cm-url{color:#aab2b3}.CodeMirror .CodeMirror-code .cm-strikethrough{text-decoration:line-through}.CodeMirror .CodeMirror-placeholder{opacity:.5}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:rgba(255,0,0,.15)} - -#canvas{ - border: 2px solid #333333; - display: block; - margin: 0 auto; - margin-top: 5px; -} - -ul#tool_bar{ - padding: 0; - margin: 0; - list-style: none; - background-color: #333333; - display: block; - color:white; - width:100%; - height: 20px; - padding:10px; -} -ul#tool_bar li{ - float: left; - margin:0; - margin-right: 10px; -} -ul#tool_bar li.title { - font-weight: bold; -} - -ul#tool_bar li a { - display: bock; - background-color: #007ACC; - color: white; - text-decoration: none; - padding: 5px; - border:1px solid white; -} -ul#tool_bar li a:hover{ - color: #f65e5a; -} \ No newline at end of file diff --git a/apps/assets/scripts/decoder.js b/apps/assets/scripts/decoder.js deleted file mode 100644 index 4cdf372..0000000 --- a/apps/assets/scripts/decoder.js +++ /dev/null @@ -1 +0,0 @@ -var api,onmessage,resolution,wasm_update;importScripts("wvnc_asm.js"),api={},resolution=void 0,Module.onRuntimeInitialized=function(){return api={createBuffer:Module.cwrap("create_buffer","number",["number","number"]),destroyBuffer:Module.cwrap("destroy_buffer","",["number"]),updateBuffer:Module.cwrap("update","number",["number","number","number","number","number","number"]),decodeBuffer:Module.cwrap("decode","number",["number","number","number","number"])}},wasm_update=function(e){var r,u,n,t,a,o,d,f,i,s,m;if(s=(r=new Uint8Array(e))[1]|r[2]<<8,m=r[3]|r[4]<<8,i=r[5]|r[6]<<8,t=r[7]|r[8]<<8,n=r[9],a=api.createBuffer(r.length),Module.HEAP8.set(r,a),d=i*t*4,o=api.decodeBuffer(a,r.length,resolution.depth,d),u=new Uint8Array(Module.HEAP8.buffer,o,d),e={},(f=new Uint8Array(d)).set(u,0),e.pixels=f.buffer,e.x=s,e.y=m,e.w=i,e.h=t,postMessage(e,[e.pixels]),api.destroyBuffer(a),0!==n||32!==resolution.depth)return api.destroyBuffer(o)},onmessage=function(e){return e.data.depth?resolution=e.data:wasm_update(e.data)}; \ No newline at end of file diff --git a/apps/assets/scripts/main.js b/apps/assets/scripts/main.js deleted file mode 100644 index 6d34a36..0000000 --- a/apps/assets/scripts/main.js +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by CoffeeScript 2.5.1 -(function() { - var APIManager, BaseObject, MarkOn, WebVNC, require; - - window.classes = {}; - - window.libraries = {}; - - window.myuri = "/"; - - window.mobilecheck = function() { - if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) { - return true; - } - return false; - }; - - window.makeclass = function(n, o) { - return window.classes[n] = o; - }; - - /* - window.require = (lib) -> - return new Promise (r, e) -> - return r() if window.libraries[lib] - $.getScript window.myuri + lib - .done (d) -> - window.libraries[lib] = true - r() - .fail (m, s) -> - e(m, s) */ - // private function - require = function(lib) { - return new Promise(function(r, e) { - if (window.libraries[lib]) { - return r(); - } - return $.getScript(window.myuri + lib).done(function(d) { - window.libraries[lib] = true; - return r(); - }).fail(function(m, s) { - return e(m, s); - }); - }); - }; - - BaseObject = class BaseObject { - constructor(name) { - this.name = name; - } - - ready() { - var me; - me = this; - return new Promise(function(r, e) { - return me.resolveDep().then(function() { - return r(); - }).catch(function(m, s) { - return e(m, s); - }); - }); - } - - resolveDep() { - var me; - me = this; - return new Promise(function(r, e) { - var dep, fn; - dep = window.classes[me.name].dependencies; - if (!dep) { - r(); - } - fn = function(l, i) { - if (i >= dep.length) { - return r(); - } - return require(l[i]).then(function() { - return fn(l, i + 1); - }).catch(function(m, s) { - return e(m, s); - }); - }; - return fn(dep, 0); - }); - } - - }; - - makeclass("BaseObject", BaseObject); - - APIManager = class APIManager extends window.classes.BaseObject { - constructor(args1) { - super("APIManager"); - this.args = args1; - } - - init() { - var cname, me; - me = this; - if (!(this.args && this.args.length > 0)) { - return console.error("No class found"); - } - cname = (this.args.splice(0, 1))[0].trim(); - return this.ready().then(function() { - if (mobilecheck()) { - mobileConsole.init(); - } - // load the class - if (!cname || cname === "") { - return; - } - if (!window.classes[cname]) { - return console.error("Cannot find class ", cname); - } - return (new window.classes[cname](me.args)).init(); - }).catch(function(m, s) { - return console.error(m, s); - }); - } - - }; - - APIManager.dependencies = ["/assets/scripts/mobile_console.js"]; - - makeclass("APIManager", APIManager); - - MarkOn = class MarkOn extends window.classes.BaseObject { - constructor() { - super("MarkOn"); - } - - init() { - var me; - me = this; - return this.ready().then(function() { - return me.editor = new SimpleMDE({ - element: $("#editor")[0] - }); - }).catch(function(m, s) { - return console.error(m, s); - }); - } - - }; - - MarkOn.dependencies = ["/rst/gscripts/mde/simplemde.min.js"]; - - makeclass("MarkOn", MarkOn); - - WebVNC = class WebVNC extends window.classes.BaseObject { - constructor() { - super("WebVNC"); - } - - init() { - var me; - me = this; - return this.ready().then(function() { - return me.initVNCClient(); - }).catch(function(m, s) { - return console.error(m, s); - }); - } - - initVNCClient() { - var args, me; - args = { - element: 'canvas', - //ws: 'wss://localhost:9192/wvnc', - ws: 'wss://lxsang.me/wvnc', - worker: '/assets/scripts/decoder.js' - }; - this.client = new WVNC(args); - me = this; - this.client.onpassword = function() { - return new Promise(function(r, e) { - return r('demopass'); - }); - }; - this.client.oncredential = function() { - return new Promise(function(r, e) { - return r('demo', 'demo'); - }); - }; - this.client.oncopy = function(text) { - return cosole.log(text); - }; - this.client.onerror = function(m) { - return alert(m); - }; - return this.client.init().then(function() { - $("#connect").click(function(e) { - return me.client.connect("/opt/www/vnc.conf", { - bbp: 32, - flag: 3, - quality: 30 - }); - }); - $("#tbstatus").html("32bbp, compression JPEG & ZLib, JPEG quality 30%"); - $("#stop").click(function(e) { - return me.client.disconnect(); - }); - return $("#selscale").on('change', function(e) { - var value; - value = Number(this.value) / 100; - return me.client.setScale(value); - }); - //$("#btclipboard").click (e) -> - // me.client.sendTextAsClipboard ($ "#clipboard")[0].value - }).catch(function(m, s) { - return console.error(m, s); - }); - } - - }; - - WebVNC.dependencies = ["/assets/scripts/wvnc.js"]; - - makeclass("WebVNC", WebVNC); - -}).call(this); diff --git a/apps/assets/scripts/mobile_console.js b/apps/assets/scripts/mobile_console.js deleted file mode 100644 index 66e7176..0000000 --- a/apps/assets/scripts/mobile_console.js +++ /dev/null @@ -1,1325 +0,0 @@ -/*! - * hnl.mobileConsole - javascript mobile console - v1.2.6 - 26/10/2016 - * Adds html console to webpage. Especially useful for debugging JS on mobile devices. - * Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear' - * Inspired by code by jakub fiala (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d) - * Licensed under the MIT license - * - * Original author: @hnldesign - * Further changes, comments: @hnldesign - * Copyright (c) 2014-2016 HN Leussink - * Dual licensed under the MIT and GPL licenses. - * - * Info: http://www.hnldesign.nl/work/code/javascript-mobile-console/ - * Demo: http://code.hnldesign.nl/demo/hnl.MobileConsole.html - */ -var console = window.console; - -var mobileConsole = (function () { - 'use strict'; - - //stop if there is no console in this browser - if (!console) { - alert('mobileConsole not supported on this browser'); - return; - } - //polyfills - if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; - } - if (!Array.prototype.filter) { - Array.prototype.filter = function(fun/*, thisArg*/) { - 'use strict'; - - if (this === void 0 || this === null) { - throw new TypeError(); - } - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun !== 'function') { - throw new TypeError(); - } - - var res = []; - var thisArg = arguments.length >= 2 ? arguments[1] : void 0; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; - - // NOTE: Technically this should Object.defineProperty at - // the next index, as push can be affected by - // properties on Object.prototype and Array.prototype. - // But that method's new, and collisions should be - // rare, so use the more-compatible alternative. - if (fun.call(thisArg, val, i, t)) { - res.push(val); - } - } - } - - return res; - }; - } - - //options and other variable containers - var options = { - overrideAutorun: false, - version : '1.2.6', - baseClass : 'mobileConsole_', - animParams: 'all 200ms ease', - browserinfo: { - browserChrome: /chrome/.test(navigator.userAgent.toLowerCase()), - ffox: /firefox/.test(navigator.userAgent.toLowerCase()) && !/chrome/.test(navigator.userAgent.toLowerCase()), - safari: /safari/.test(navigator.userAgent.toLowerCase()) && !/chrome/.test(navigator.userAgent.toLowerCase()), - trident: /trident/.test(navigator.userAgent.toLowerCase()), - evtLstn: typeof window.addEventListener === 'function', - isCrap: document.querySelectorAll === undefined - }, - methods : ['log', 'trace', 'info', 'warn', 'error', 'group', 'groupCollapsed', 'groupEnd', 'table', 'assert', 'time', 'timeEnd', 'clear'], - hideButtons : ['group', 'groupCollapsed', 'groupEnd', 'table', 'assert', 'time', 'timeEnd'], - ratio: 0.4, - paddingLeft: 0, - groupDepth: 0 - }, - messages = { - clear : 'Console was cleared', - empty: '(Empty string)' - }, - status = { - initialized: false, - acActive : false, - acHovered : false, - acInput : '', - timers : {} - }, - history = { - output : { - prevMsg : '', - prevMethod : '', - counter : 0 - }, - input : { - commands : window.sessionStorage ? (sessionStorage.getItem('mobileConsoleCommandHistory') ? JSON.parse(sessionStorage.getItem('mobileConsoleCommandHistory')) : []) : [], - commandIdx: window.sessionStorage ? (sessionStorage.getItem('mobileConsoleCommandHistory') ? JSON.parse(sessionStorage.getItem('mobileConsoleCommandHistory')).length : 0) : 0, - acIdx: 0, - acHovered: false - } - }, - //'backup' original console for reference & internal debugging - originalConsole = { - log: (typeof console.log === 'function') ? console.log.bind(console) : null, - info: (typeof console.info === 'function') ? console.info.bind(console) : null, - dir: (typeof console.dir === 'function') ? console.dir.bind(console) : null, - group: (typeof console.group === 'function') ? console.group.bind(console) : null, - groupEnd: (typeof console.groupEnd === 'function') ? console.groupEnd.bind(console) : null, - warn: (typeof console.warn === 'function') ? console.warn.bind(console) : null, - error: (typeof console.error === 'function') ? console.error.bind(console) : null, - trace: (typeof console.trace === 'function') ? console.trace.bind(console) : null, - clear: (typeof console.clear === 'function') ? console.clear.bind(console) : null - }, - // reference variables - mobileConsole, consoleElement, commandLine; - - if(options.browserinfo.isCrap) { - console.error( - '--==## Error: Browser not supported by Mobile Console ##==--' + '\n' + - 'MobileConsole v' + options.version + ', running on ' + navigator.userAgent.toLowerCase() - ); - return false; - } - - //helpers for all sub functions - function isMobile() { - var check = false; - (function (a) { - if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) { - check = true; - } - }(navigator.userAgent || navigator.vendor || window.opera)); - return check; - } - function setCSS(el, css) { - var i; - for (i in css) { - if (css.hasOwnProperty(i)) { - el.style[i] = css[i]; - } - } - return el; - } - function htmlToString(html) { - return String(html).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/ /g, '\u00a0').replace(/(?:\r\n|\r|\n)/g, '
').trim(); - } - function createElem(type, className, css) { - if (!type || typeof setCSS !== 'function') { return; } - var element = setCSS(document.createElement(type), css); - if (className) { element.className = options.baseClass + className; } - return setCSS(element, css); - } - function storeCommand(command) { - if (history) { - history.input.commands.push(encodeURI(command.trim())); - history.input.commandIdx = history.input.commands.length; - if (window.sessionStorage) { sessionStorage.setItem('mobileConsoleCommandHistory', JSON.stringify(history.input.commands)); } - } - } - function valBetween(val, min, max) { - return (Math.min(max, Math.max(min, val))); - } - function getMaxHeight() { - return valBetween(Math.floor((window.innerHeight || document.documentElement.clientHeight) * options.ratio), 55, 300); - } - function getClass(item) { - var returnVal = ''; - if (item && item.constructor) { - returnVal = item.constructor.name; - } else { - returnVal = Object.prototype.toString.call(item); - } - return String(returnVal); - } - - // DocReady - Fires supplied function when document is ready - if (typeof 'docReady' !== 'function') { - (function (funcName, baseObj) { - // The public function name defaults to window.docReady - // but you can pass in your own object and own function name and those will be used - // if you want to put them in a different namespace - funcName = funcName || 'docReady'; - baseObj = baseObj || window; - var i, len, readyList = [], readyFired = false, readyEventHandlersInstalled = false; - - // call this when the document is ready - // this function protects itself against being called more than once - function ready() { - if (!readyFired) { - // this must be set to true before we start calling callbacks - readyFired = true; - for (i = 0, len = readyList.length; i < len; i = i + 1) { - // if a callback here happens to add new ready handlers, - // the docReady() function will see that it already fired - // and will schedule the callback to run right after - // this event loop finishes so all handlers will still execute - // in order and no new ones will be added to the readyList - // while we are processing the list - readyList[i].fn.call(window, readyList[i].ctx); - } - // allow any closures held by these functions to free - readyList = []; - } - } - - function readyStateChange() { - if (document.readyState === 'complete') { - ready(); - } - } - - // This is the one public interface - // docReady(fn, context); - // the context argument is optional - if present, it will be passed - // as an argument to the callback - baseObj[funcName] = function (callback, context) { - // if ready has already fired, then just schedule the callback - // to fire asynchronously, but right away - if (readyFired) { - setTimeout(function () {callback(context); }, 1); - return; - } - // add the function and context to the list - readyList.push({fn: callback, ctx: context}); - // if document already ready to go, schedule the ready function to run - if (document.readyState === 'complete') { - setTimeout(ready, 1); - } else if (!readyEventHandlersInstalled) { - // otherwise if we don't have event handlers installed, install them - if (document.addEventListener) { - // first choice is DOMContentLoaded event - document.addEventListener('DOMContentLoaded', ready, false); - // backup is window load event - window.addEventListener('load', ready, false); - } else { - // must be IE - document.attachEvent('onreadystatechange', readyStateChange); - window.attachEvent('onload', ready); - } - readyEventHandlersInstalled = true; - } - }; - }('docReady', window)); - } - - // elements - var elements = { - lines: [], - acItems: [], - base: createElem('div', 'base', { - boxSizing: 'border-box', - position: 'fixed', - resize: 'none', - fontSize: '12px', - lineHeight: '14px', - bottom: 0, - top: 'auto', - right: 0, - width: '100%', - zIndex: 10000, - padding: 0, - paddingBottom: isMobile() ? '35px' : '25px', - margin: 0, - border: '0 none', - borderTop: '1px solid #808080', - backgroundColor: '#ffffff' - }), - topbar : createElem('div', 'topbar', { - boxSizing: 'border-box', - position: 'absolute', - height: '28px', - left: 0, - right: 0, - display: 'block', - padding: '0 2px', - overflow: 'hidden', - webkitOverflowScrolling: 'touch', - color: '#444444', - backgroundColor: '#f3f3f3', - border: '0 none', - borderTop: '1px solid #a3a3a3', - borderBottom: '1px solid #a3a3a3', - whiteSpace: 'nowrap', - overflowX: 'auto' - }), - scrollcontainer : createElem('div', 'scroller', { - boxSizing: 'border-box', - border: '0 none', - fontFamily: 'Consolas, monaco, monospace', - position: 'relative', - display: 'block', - height: getMaxHeight() + 'px', - overflow: 'auto', - webkitOverflowScrolling: 'touch', - '-webkit-transition': options.animParams, - '-moz-transition': options.animParams, - '-o-transition': options.animParams, - 'transition': options.animParams - }), - table : createElem('table', 'table', { - border: '0 none', - margin: 0, - position: 'relative', - tableLayout: 'auto', - width: '100%', - borderCollapse: 'collapse' - }), - stackTraceTable : createElem('table', 'stackTraceTable', { - border: '0 none', - margin: 0, - display: 'none', - marginLeft: '10px', - marginTop: isMobile() ? '8px' : '4px', - tableLayout: 'auto', - maxWidth: '100%', - color: '#333333' - }), - tr : createElem('tr', 'table_row', { - verticalAlign: 'top' - }), - td : createElem('td', 'table_row', { - border: '0 none', - padding: '2px 4px', - verticalAlign: 'top' - }), - msgContainer : createElem('span', 'msgContainer', { - border: '0 none', - margin: 0, - display: 'inline', - overflow: 'hidden' - }), - tdLeft : createElem('td', 'table_row_data', { - border: '0 none', - textAlign: 'left', - padding: isMobile() ? '8px 12px' : '4px 8px' - }), - tdRight : createElem('td', 'table_row_data', { - border: '0 none', - textAlign: 'left', - padding: isMobile() ? '8px 12px' : '4px 8px', - whiteSpace: 'nowrap', - overflow: 'hidden' - }), - link : createElem('a', 'link', { - color: '#1155cc', - textDecoration: 'underline' - }), - dot : createElem('div', 'table_row_data_dot', { - display: 'inline', - borderRadius: '50%', - fontSize: '80%', - fontWeight: 'bold', - padding: '2px 5px', - textAlign: 'center', - marginRight: '5px', - backgroundColor: '#333333', - color: '#ffffff' - }), - button : createElem('button', 'button', { - display: 'inline-block', - fontFamily: '"Helvetica Neue",Helvetica,Arial,sans-serif', - fontWeight: 'normal', - textTransform: 'capitalize', - fontSize: '12px', - lineHeight: '26px', - height: '26px', - padding: '0 8px', - margin: 0, - textAlign: 'center', - marginRight: '5px', - border: '0 none', - backgroundColor: 'transparent', - color: 'inherit', - cursor: 'pointer' - }), - buttons : { - }, - input : createElem('div', 'input', { - boxSizing: 'border-box', - height: isMobile() ? '35px' : '29px', - fontFamily: 'Consolas, monaco, monospace', - position: 'absolute', - bottom: 0, - left: 0, - right: 0, - margin: 0, - border: '0 none', - borderTop: '1px solid #EEEEEE' - }), - gt : createElem('DIV', 'gt', { - position: 'absolute', - bottom: 0, - width: '25px', - lineHeight: isMobile() ? '34px' : '28px', - height: isMobile() ? '34px' : '28px', - textAlign: 'center', - fontSize: '16px', - fontFamily: 'Consolas, monaco, monospace', - fontWeight: 'bold', - color: '#3577B1', - zIndex: 2 - }), - consoleinput : createElem('input', 'consoleinput', { - boxSizing: 'border-box', - position: 'absolute', - bottom: 0, - width : '100%', - fontSize: isMobile() ? '16px' : 'inherit', //prevents ios safari's zoom on focus - fontFamily: 'Consolas, monaco, monospace', - paddingLeft: '25px', - margin: 0, - height: isMobile() ? '35px' : '25px', - border: '0 none', - outline: 'none', - outlineWidth: 0, - boxShadow: 'none', - '-moz-appearance': 'none', - '-webkit-appearance': 'none', - backgroundColor: 'transparent', - color: '#000000', - zIndex: 1 - }), - autocomplete : createElem('div', 'autocomplete', { - display: 'none', - position: 'absolute', - bottom: isMobile() ? '35px' : '28px', - left: 0, - boxShadow: '1px 2px 5px rgba(0,0,0,0.1)', - color: '#000000', - backgroundColor: '#FFFFFF', - border: '1px solid #b5b5b5' - }), - autocompleteItem : createElem('a', 'autocompleteitem', { - display: 'block', - textDecoration: 'none', - fontSize: isMobile() ? '16px' : 'inherit', - padding: '5px 8px', - wordWrap: 'break-word', - whiteSpace: 'nowrap' - }), - arrowUp: '', - arrowDown: '', - arrowRight: '' - }; - - //shared functions - - var setLineStyle = (function () { - var lineStyles = function (style) { - switch (style) { - case 'log': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#000000' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#8097bd' - } - }; - case 'info': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#1f3dc4' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#367AB4' - } - }; - case 'warn': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#CE8724', - backgroundColor : '#fff6e0' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#e8a400' - } - }; - case 'error': - case 'table': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#FF0000', - backgroundColor : '#ffe5e5' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#FF0000' - } - }; - case 'assert': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#FF0000', - backgroundColor : '#ffe5e5' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#FF0000' - } - }; - case 'trace': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#000000' - }, - dot : { - //will not happen - } - }; - case 'time': - case 'timeEnd': - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#0000ff' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#0000ff' - } - }; - default: - return { - text : { - borderBottom: '1px solid #DDDDDD', - color: '#000000' - }, - dot : { - color: '#FFFFFF', - backgroundColor: '#8097bd' - } - }; - } - - }; - var color, dot; - - return function (element, type, msg) { - if (status.initialized) { - color = (msg === 'undefined' || msg === htmlToString(messages.empty)) ? {color: '#808080'} : ((msg === htmlToString(messages.clear)) ? {color: '#808080', fontStyle: 'italic'} : (lineStyles(type) !== undefined ? lineStyles(type).text : lineStyles.log.text)); - dot = lineStyles(type) !== undefined ? lineStyles(type).dot : lineStyles.log.dot; - setCSS(element, color); - //has dot? - if (element.childNodes[0].childNodes[0].className.indexOf('dot') !== -1) { - setCSS(element.childNodes[0].childNodes[0], lineStyles(type).dot); - } - } - }; - }()), - getLink = function (href, textString) { - var HTMLurl = elements.link.cloneNode(false); - if (href) { - HTMLurl.setAttribute('href', href); - HTMLurl.setAttribute('target', '_blank'); - } - HTMLurl.innerHTML = textString || href.split('\\').pop().split('/').filter(Boolean).pop(); - return HTMLurl; - }, - toggleHeight = function () { - if (status.initialized) { - var existingPadding = parseInt(document.body.style.paddingBottom, 10) - Math.abs(elements.base.offsetHeight + elements.topbar.offsetHeight); - var newHeight = (elements.base.minimized) ? getMaxHeight() + 'px' : '0px'; - setCSS(elements.scrollcontainer, { - height: newHeight - }); - setCSS(document.body, { - paddingBottom: existingPadding + Math.abs(parseInt(newHeight, 10) + elements.topbar.offsetHeight) + 'px' - }); - elements.buttons.toggler.innerHTML = (elements.base.minimized) ? elements.arrowDown : elements.arrowUp; - elements.buttons.toggler.setAttribute('title', (elements.base.minimized) ? 'Minimize console' : 'Maximize console'); - elements.base.minimized = !elements.base.minimized; - return elements.base.minimized; - } - return 'Not built!'; - }, - about = (function () { - return function () { - console.info( - '--==## Mobile Console ' + (status.initialized ? 'active' : 'inactive') + ' ##==--' + '\n' + - '--===============================--' + '\n' + - 'MobileConsole v' + options.version + ', running on ' + navigator.userAgent.toLowerCase() - ); - }; - }()); - - // --==** sub functions start here **==-- - - //initializes the console HTML element - function initConsoleElement() { - //reference - var ref; - //core - function toggleScroll() { - elements.scrollcontainer.scrollTop = elements.scrollcontainer.scrollHeight; - elements.scrollcontainer.scrollLeft = 0; - } - function assemble() { - var i = options.methods.length, key; - - //add buttons - while (i--) { - elements.buttons[options.methods[i]] = elements.button.cloneNode(false); - elements.buttons[options.methods[i]].innerHTML = options.methods[i].charAt(0).toUpperCase() + options.methods[i].slice(1); - elements.buttons[options.methods[i]].setAttribute('title', (options.methods[i] !== 'clear') ? 'Toggle the display of ' + options.methods[i] + ' messages' : 'Clear the console'); - } - //add min/maximize button - elements.buttons.toggler = elements.button.cloneNode(false); - elements.buttons.toggler.innerHTML = elements.arrowDown; - elements.buttons.toggler.setAttribute('title', 'Minimize console'); - - //assemble everything - for (key in elements.buttons) { - if (elements.buttons.hasOwnProperty(key)) { - elements.topbar.insertBefore(elements.buttons[key], elements.topbar.firstChild); - } - } - elements.scrollcontainer.appendChild(elements.table); - - elements.base.appendChild(elements.topbar); - elements.base.appendChild(elements.scrollcontainer); - - status.initialized = true; - return elements.base; - } - function attach(console) { - document.body.appendChild(console); - setCSS(elements.topbar, { - top: -Math.abs(elements.topbar.offsetHeight) + 'px' - }); - var existingPadding = isNaN(parseInt(document.body.style.paddingBottom, 10)) ? 0 : parseInt(document.body.style.paddingBottom, 10); - setCSS(document.body, { - paddingBottom: existingPadding + Math.abs(console.offsetHeight + elements.topbar.offsetHeight) + 'px' - }); - elements.scrollcontainer.scrollTop = elements.scrollcontainer.scrollHeight; - - return elements.base; - } - function toggleLogType() { - //togglelogtype is a click handler; 'this' is the button that was clicked - var button = this; - var logType = button.innerHTML.toLowerCase(); - var elems = elements.lines[logType], i = elems.length; - button.toggled = (button.toggled === undefined) ? true : !button.toggled; - setCSS(button, { opacity: (button.toggled) ? '0.5' : '' }); - while (i--) { - setCSS(elems[i], { display: (button.toggled) ? 'none' : '' }); - } - toggleScroll(); - button.blur(); - return button; - } - function setBinds() { - var methods = options.methods, i = methods.length; - while (i--) { - if (methods[i] !== 'clear') { - if (options.browserinfo.evtLstn) { - elements.buttons[methods[i]].addEventListener('click', toggleLogType, false); - } else { - elements.buttons[methods[i]].attachEvent('onclick', toggleLogType); - } - } - if (options.hideButtons.indexOf(methods[i]) !== -1) { - setCSS(elements.buttons[methods[i]], { display: 'none' }); - } - } - if (options.browserinfo.evtLstn) { - elements.buttons.toggler.addEventListener('click', toggleHeight, false); - elements.buttons.clear.addEventListener('click', console.clear, false); - } else { - elements.buttons.toggler.attachEvent('onclick', toggleHeight); - elements.buttons.clear.attachEvent('onclick', console.clear); - } - } - //init - function init() { - var element = assemble(); - docReady(function () { - setBinds(); - attach(element); - }); - //expose Public methods and variables - return { - toggleHeight : toggleHeight, - toggleScroll : toggleScroll - }; - } - if (!ref) { - ref = init(); - } - return ref; - } - - //initializes the new console logger - function initConsole() { - //reference - var ref; - //sub helpers - function isElement(o) { - return ( - typeof HTMLElement === 'object' ? o instanceof HTMLElement : //DOM2 - o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string' - ); - } - function objectToString(object) { - var simpleObject = {}, prop, classname = getClass(object); - if (!isElement(object)) { - for (prop in object) { - if (!object.hasOwnProperty(prop) || (typeof (object[prop]) === 'object') || (typeof (object[prop]) === 'function')) { - continue; - } - simpleObject[prop] = object[prop]; - } - return '' + classname + ' ' + JSON.stringify(simpleObject) + ''; // returns cleaned up JSON - } - return htmlToString(object.outerHTML); - } - function urlFromString(string) { - string = String(string); - //searches for url in string, returns url as string - var match, uriPattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig; - try { - match = string.match(uriPattern)[0]; - return match; - } catch (e) { - return ''; - } - } - function filterOut(array, match) { - return array.filter(function(item){ - return typeof item === 'string' && item.indexOf(match) === -1; - }); - } - function preFilterTrace(array) { - var newArray = array.split('\n').filter(Boolean), //filter cleans out empty values - isCommandLine = false, stealthThese, i; - if (newArray[0].indexOf('http') === -1) { newArray.shift(); } //remove first line if contains no 'http' (Chrome starts with 'Error', Firefox doesn't..) - if (newArray[0].indexOf('console.') !== -1 || newArray[0].indexOf('console[method]') !== -1) { newArray.shift(); } - if (newArray.length > 0) { - isCommandLine = newArray[newArray.length - 1].indexOf('keydown') !== -1; - newArray = newArray.filter(function(item){ return item !== ''; }); - - if (isCommandLine) { - stealthThese = ['submitCommand', 'eval', 'setBinds', 'interceptConsole', 'newConsole']; - newArray.pop(); //remove last index, as it is the keydown event. - i = stealthThese.length; - while(i--) { - newArray = filterOut(newArray, stealthThese[i]); - } - } - } - if (isCommandLine || newArray.length === 0) { - newArray.push('(anonymous function) console:1:1'); - } - return newArray; - } - //core - function formatStackTrace(trace, origtrace) { - var callStack = []; - //original stack is hidden inside trace object, if specified - var stackTraceOrig = (trace !== undefined && trace[4] !== undefined) ? trace[4].stack : undefined; - //if the first line contains this, skip it. Meant for browsers that begin the stack with the error message itself (already captured before formatStackTrace) - var traceToProcess = (origtrace && origtrace !== '') ? origtrace : stackTraceOrig, - i, - lines, - url, - txt, - thisLine, - lineAndColumn, - caller, - separator = options.browserinfo.ffox ? '@' : '()'; - - //stop if no source trace can be determined - if (!traceToProcess) { return; } - - lines = preFilterTrace(traceToProcess); //pre filters all lines by filtering out all mobileConsole's own methods so mobileConsole runs Stealth and unobtrusive - i = lines.length; - while (i--) { - thisLine = lines[i].trim(); - lineAndColumn = thisLine.match(/(?::)(\d+)(?::)(\d+)/); - url = urlFromString(thisLine).replace(lineAndColumn[0], '').split('#')[0] || ''; - caller = htmlToString(thisLine.replace(urlFromString(thisLine), '').replace(separator, '').replace('at ', '').trim()); - if (caller === '' || caller === lineAndColumn[0]) { continue; } - if (url[url.length - 1] === '/') { - txt = '(index)'; - } else { - txt = url.split('\\').pop().split('/').filter(Boolean).pop() || caller; - } - callStack.push({ - caller: caller, - url: url ? url.split(':')[0] + ':' + url.split(':')[1] : caller, - linkText: txt + lineAndColumn[0], - line: lineAndColumn[1], - col: lineAndColumn[2], - originalLine: thisLine - }); - } - return callStack; - } - function traceToTable(table, trace) { - var i, tdLeft, tdRight, tr; - if (trace === undefined) { - return; - } - trace.reverse(); //reverse order of trace, as it is in a browser's console - i = trace.length; - while (i--) { - tdLeft = elements.td.cloneNode(false); - tdRight = elements.td.cloneNode(false); - tr = elements.tr.cloneNode(false); - tdLeft.innerHTML = trace[i].caller; - tdRight.innerHTML = ' @ '; - tdRight.appendChild(getLink((trace[i].url || ''), trace[i].linkText)); - tr.appendChild(tdLeft); - tr.appendChild(tdRight); - table.insertBefore(tr, table.firstChild); - } - return table; - } - function colorizeData(key, value) { - var valueColor = '#3c53da', keyColor = '#ae33b7', classname = getClass(value); - if (value && classname.indexOf('HTML') !== -1) { - value = htmlToString(value.outerHTML); - valueColor = '#ad8200'; - } else if (key === 'innerHTML' || key === 'outerHTML') { - value = htmlToString(value); - valueColor = '#ad8200'; - } - if (value === null) { - valueColor = '#808080'; - } - if (typeof value === 'string') { - valueColor = '#c54300'; - //HARD limit, for speed/mem issues with consecutive logging of large strings - if (value.length > 400) { - value = '"' + String(value).substring(0, 400) + '" [...]
Note: string was truncated to 400 chars'; - } else { - value = '"' + value + '"'; - } - } - return '' + key + ': ' + value + ''; - } - function objectToTable(table, object) { - var i; - for (i in object) { - var tdLeft = elements.td.cloneNode(false), tr = elements.tr.cloneNode(false); - tdLeft.innerHTML = colorizeData(i, object[i]); - tr.appendChild(tdLeft); - table.appendChild(tr); - } - return table; - } - function toggleDetails() { - //toggleDetails is a click handler; 'this' is the button that was clicked - var button = this, i, hidden; - if (button.getAttribute('toggles') === 'table') { - var tables = button.parentElement.getElementsByTagName('table'); - i = tables.length; - while (i--) { - hidden = (tables[i].currentStyle ? tables[i].currentStyle.display : window.getComputedStyle(tables[i], null).display) === 'none'; - button.innerHTML = button.innerHTML.replace((hidden ? elements.arrowRight : elements.arrowDown), (hidden ? elements.arrowDown : elements.arrowRight)); - setCSS(tables[i], { display: hidden ? 'table' : 'none' }); - } - } - } - function isRepeat(message, method) { - return (history.output.prevMsg === message && history.output.prevMethod === method) && (typeof message !== 'object') && (method !== 'trace') && (method !== 'group') && (method !== 'groupCollapsed') && (method !== 'groupEnd'); - } - function newConsole() { - try { - //get arguments, set vars - var method = arguments[0], className, - message = (arguments[1].newMessage !== undefined) ? arguments[1].newMessage : undefined, - stackTrace = (arguments[1].newStackTrace !== undefined) ? arguments[1].newStackTrace : undefined; - - //if message emtpy, show empty message-message - if (message === '') { message = messages.empty; } - - if (isRepeat(message, method) && method.indexOf('time') === -1) { - // up the counter and add the dot - history.output.counter = history.output.counter + 1; - elements.table.lastChild.countDot = elements.table.lastChild.countDot || elements.dot.cloneNode(false); - elements.table.lastChild.firstChild.insertBefore(elements.table.lastChild.countDot, elements.table.lastChild.firstChild.firstChild).innerHTML = history.output.counter; - setLineStyle(elements.table.lastChild, method, message); - } else { - history.output.prevMsg = message; - history.output.prevMethod = method; - history.output.counter = 1; - - //an object requires some more handling - if (typeof message === 'object' && method !== 'assert' && method !== 'timeEnd') { - className = getClass(message); - if (className.indexOf('HTML') !== -1 && className !== 'HTMLDocument') { - message = htmlToString(message.outerHTML.match(/<(.*?)>/g)[0] + '...' + message.outerHTML.match(/<(.*?)>/g).pop()); //gets first and last tag, adds '...' in middle. e.g.
...
- } else { - message = objectToString(message); - } - } else if (method !== 'assert' && method.indexOf('time') === -1) { - message = htmlToString(message); - } - - var detailTable, - stackTable, - msgContainer = elements.msgContainer.cloneNode(false), - lineContainer = elements.tr.cloneNode(false), - leftContainer = elements.tdLeft.cloneNode(true), - rightContainer = elements.tdRight.cloneNode(false), - arrows = stackTrace ? elements.arrowRight + ' ' : ''; - - switch (method) { - case 'assert': - if (message[0] === false) { - msgContainer.innerHTML = arrows + 'Assertion failed: ' + message[1]; - } - stackTable = traceToTable(elements.stackTraceTable.cloneNode(false), stackTrace); - method = 'error'; //groups it under 'error' and is thus toggleable in view - break; - case 'log': - case 'debug': - case 'info': - case 'warn': - if (typeof arguments[1].newMessage === 'object') { - detailTable = objectToTable(elements.stackTraceTable.cloneNode(false), arguments[1].newMessage); - msgContainer.innerHTML = elements.arrowRight + ' ' + message; - } else { - msgContainer.innerHTML = message; - } - break; - case 'error': - case 'trace': - case 'dir': - case 'table': - //left side - if (method === 'table' || typeof arguments[1].newMessage === 'object') { - detailTable = objectToTable(elements.stackTraceTable.cloneNode(false), arguments[1].newMessage); - msgContainer.innerHTML = elements.arrowRight + ' ' + message; - } else if (method === 'trace') { - message = 'console.trace()'; - msgContainer.innerHTML = arrows + message; - } else { - msgContainer.innerHTML = arrows + message; - } - stackTable = traceToTable(elements.stackTraceTable.cloneNode(false), stackTrace); - break; - case 'group': - case 'groupCollapsed': - case 'groupEnd': - if (method !== 'groupEnd') { - options.groupDepth = options.groupDepth + 1; - msgContainer.innerHTML = '' + message + ''; - msgContainer.setAttribute('toggles', 'group_' + options.groupDepth); - } else { - options.groupDepth = valBetween(options.groupDepth - 1, 0, 99); - history.output.prevMsg = ''; - } - if (options.groupDepth > 0) { - options.paddingLeft = (options.groupDepth * 23) + 'px'; - } else { - options.paddingLeft = 0; - } - break; - case 'time': - case 'timeEnd': - var timerName = arguments[1].newMessage || 'default', now, passed; - if (method === 'time') { - status.timers[timerName] = Date.now(); - if (typeof arguments[1].original === 'function') { - arguments[1].original.apply(console, arguments[1].originalArguments); //make sure we still call the original console.time to start the browser's console timer - } - return; - } - now = Date.now(); - if (!status.timers[timerName]) { - console.warn('Timer "' + timerName + '" does not exist.'); - return; - } - passed = now - (status.timers[timerName] || 0); - message = timerName + ': ' + passed + 'ms'; - msgContainer.innerHTML = message; - delete status.timers[timerName]; - break; - default: - msgContainer.innerHTML = message; - } - - if (!msgContainer.innerHTML) { return; } - leftContainer.appendChild(msgContainer); - - if (detailTable || stackTable) { - setCSS(msgContainer, {cursor : 'pointer'}); - leftContainer.appendChild(detailTable || stackTable); - msgContainer.setAttribute('toggles', 'table'); - } - - //populate right side - if (stackTrace && stackTrace[stackTrace.length - 1] !== undefined) { - rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'})); - } - - //add to line - lineContainer.appendChild(leftContainer); - lineContainer.appendChild(rightContainer); - - //set colors - setCSS(lineContainer, { display: (elements.buttons[method].toggled ? 'none' : '') }); - setLineStyle(lineContainer, method, message); - - //set binds - if (options.browserinfo.evtLstn) { - msgContainer.addEventListener('click', toggleDetails, false); - } else { - msgContainer.attachEvent('onclick', toggleDetails); - } - - //store the lines in the object corresponding to the method used - elements.lines[method].push(lineContainer); - - //handle grouping (group and groupEnd - if (options.paddingLeft !== 0) { - setCSS(leftContainer, {paddingLeft: options.paddingLeft}); - setCSS(msgContainer, {borderLeft: '1px solid #808080', paddingLeft: '5px'}); - } - - //add the line to the table - elements.table.appendChild(lineContainer); - } - //scroll - consoleElement.toggleScroll(); - //========================================================== - //make sure we still call the original method, if applicable (not window.onerror) - if (typeof arguments[1].original === 'function') { - arguments[1].original.apply(console, arguments[1].originalArguments); - } - } catch (e) { - //not logging. why? throw error - if (isMobile()) { alert(e); } - originalConsole.error('mobileConsole generated an error logging this event!'); - originalConsole.error(arguments); - originalConsole.error(e); - //try to re-log it as an error - newConsole('error', e); - } - - - } - function interceptConsole(method) { - var original = console[method], i, stackTraceOrig; - console[method] = function () { - var args = Array.prototype.slice.call(arguments); - args.original = original; - args.originalArguments = arguments; - args.newMessage = (method === 'assert') ? [args[0], args[1]] : args[0]; - //create an Error and get its stack trace and format it - try { throw new Error(); } catch (e) { stackTraceOrig = e.stack; } - args.newStackTrace = formatStackTrace(args.newStackTrace, stackTraceOrig); - if (method === 'clear') { - elements.table.innerHTML = ''; - history.output.prevMethod = ''; - i = options.methods.length; - while (i--) { - elements.lines[options.methods[i]] = []; - } - options.groupDepth = 0; - options.paddingLeft = 0; - console.log(messages.clear); - originalConsole.clear(); - return; - } - //Handle the new console logging - newConsole(method, args); - }; - } - //init - function init() { - //Intercept all original console methods including trace. Register the event type as a line type. - var i = options.methods.length; - while (i--) { - elements.lines[options.methods[i]] = []; - interceptConsole(options.methods[i]); - } - //Bind to window.onerror - window.onerror = function() { - var args = Array.prototype.slice.call(arguments); - args.newMessage = args[0]; - args.newStackTrace = formatStackTrace(arguments); - newConsole('error', args); - }; - - //expose Public methods and variables - return { - //nothing yet to expose - }; - } - //return - if (!ref) { - ref = init(); - } - return ref; - } - - //initialize the console commandline - function initCommandLine() { - //reference - var ref; - //sub helpers - function getFromArrayById(id) { - var pos = elements.acItems.map(function(x) {return x.id; }).indexOf(id); - return { - position: pos, - element: (pos !== -1) ? elements.acItems[pos] : undefined - }; - } - function findInArray(array, match) { - return array.filter(function(item, index, self){ - return (typeof item === 'string' && item.indexOf(match) > -1) && (index === self.indexOf(item)); - }); - } - //core - function assemble() { - elements.consoleinput.setAttribute('type', 'text'); - elements.consoleinput.setAttribute('autocapitalize', 'off'); - elements.consoleinput.setAttribute('autocorrect', 'off'); - elements.autocompleteItem.setAttribute('href', '#'); - elements.gt.innerHTML = '>'; - elements.input.appendChild(elements.gt); - elements.input.appendChild(elements.consoleinput); - elements.input.appendChild(elements.autocomplete); - elements.base.appendChild(elements.input); - - return elements.base; - } - function submitCommand(command) { - if (command !== '') { - storeCommand(command); - var result; - try { - result = eval.call(window, command.trim()); - console.log.call(window, result); - } catch(e) { - console.error(e.message); - } finally { - elements.consoleinput.value = ''; - } - } - } - function hoverAutoComplete(e) { - if (e === undefined) { return; } - //unset any already hovered elements - var hovered = getFromArrayById('hover').element, target = e.target, over; - if (hovered !== undefined) { - setCSS(hovered, { - color: '', - backgroundColor: 'rgba(0, 0, 0, 0)' - }).id = ''; - } - if (e.type === 'mouseover') { - status.acHovered = true; - over = true; - } else { - over = false; - } - setCSS(target, { - color: over ? '#FFFFFF' : '', - backgroundColor: over ? 'rgba(66, 139, 202, 1)' : 'rgba(0, 0, 0, 0)' - }).id = over ? 'hover' : ''; - } - function toggleAutoComplete(show) { - var hidden = (elements.autocomplete.currentStyle ? elements.autocomplete.currentStyle.display : window.getComputedStyle(elements.autocomplete, null).display) === 'none'; - show = (show === undefined) ? hidden : show; - setCSS(elements.autocomplete, {display: (show) ? 'inherit' : 'none'}); - status.acActive = show; - if (!show) { status.acHovered = false; } - } - function clickAutoComplete(e) { - e.preventDefault(); - elements.consoleinput.value = e.target.innerHTML; - elements.consoleinput.focus(); - toggleAutoComplete(); - } - function autoComplete(command) { - if (command.length < 1) { - toggleAutoComplete(false); - return; - } - var searchString = encodeURI(command), matches, match, row, i, maxAmount = isMobile() ? 3 : 5; - elements.autocomplete.innerHTML = ''; - elements.acItems = []; - matches = findInArray(history.input.commands, searchString); - matches = matches.slice(Math.max(matches.length - maxAmount, 0)); - i = matches.length; - while (i--) { - match = decodeURI(matches[i]); - row = elements.autocompleteItem.cloneNode(false); - row.innerHTML = match; - row.onmouseover = hoverAutoComplete; - elements.autocomplete.insertBefore(row, elements.autocomplete.firstChild); - elements.acItems.unshift(row); - } - toggleAutoComplete(matches.length > 0); - } - function setBinds() { - if (options.browserinfo.evtLstn) { - elements.autocomplete.addEventListener('click', clickAutoComplete, false); - } else { - elements.autocomplete.attachEvent('onclick', clickAutoComplete); - } - document.onkeydown = function (e) { - if (e.target === elements.consoleinput) { - if ((e.key === 'Enter' || e.keyCode === 13)) { //enter - e.preventDefault(); - if(!status.acHovered) { - submitCommand(elements.consoleinput.value); - } else { - elements.consoleinput.value = getFromArrayById('hover').element.innerHTML; - elements.consoleinput.focus(); - } - toggleAutoComplete(false); - status.acInput = ''; - } else if ((e.keyCode === 38 || e.keyCode === 40)) { //up and down arrows for history browsing - e.preventDefault(); - var up = (e.keyCode === 40); - if(status.acActive) { - //autocomplete window is opened - //get id of currently hovered element - var hovered = getFromArrayById('hover').position; - var counter = (hovered === -1) ? elements.acItems.length : hovered; - //hover new (in- or decreased number) one - counter = valBetween((counter += (up) ? 1 : -1), 0, elements.acItems.length - 1); - hoverAutoComplete({target : elements.acItems[counter], type : 'mouseover'}); - } else { - //autocompete window not opened - var hist = history.input.commands; - history.input.commandIdx += (up) ? 1 : -1; - history.input.commandIdx = valBetween(history.input.commandIdx, 0, hist.length); - elements.consoleinput.value = hist[history.input.commandIdx] === undefined ? '' : decodeURI(hist[history.input.commandIdx]); - } - } - } - if (e.keyCode === 27 && status.acActive) { - toggleAutoComplete(false); - } - }; - document.onkeyup = function (e) { - if (e.target === elements.consoleinput && status.acInput !== elements.consoleinput.value && (e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 27 && e.key !== 'Enter' && e.keyCode !== 13)) { - status.acInput = elements.consoleinput.value.trim(); - autoComplete(elements.consoleinput.value); - } - }; - } - //init - function init() { - var element = assemble(); - setBinds(); - //expose Public methods and variables - return { - //nothing yet to expose - }; - } - //return - if (!ref) { - ref = init(); - } - return ref; - } - - function init() { - if (!status.initialized) { - status.initialized = true; - //populate references - if (!mobileConsole) { - //taps into native console and adds new functionality - mobileConsole = initConsole(); - } - if (!consoleElement && mobileConsole) { - //creates the new HTML console element and attaches it to document - consoleElement = initConsoleElement(); - } - if (!commandLine && consoleElement && mobileConsole) { - //creates an HTML commandline and attaches it to existing console element - commandLine = initCommandLine(); - } - //log a 'welcome' message - console.info( '--==## Mobile Console v' + options.version + ' ' + (status.initialized ? 'active' : 'inactive' ) + ' ##==--' ); - } else if (options.browserinfo.isCrap) { - console.error( - '--==## Error: Browser not supported by Mobile Console ##==--' + '\n' + - '--===============================--' + '\n' + - 'MobileConsole v' + options.version + ', running on ' + navigator.userAgent.toLowerCase() - ); - } - } - - //autorun if mobile - if (isMobile() || options.overrideAutorun) { - init(); - } - - //expose the mobileConsole - return { - init : init, - about: about, - toggle : toggleHeight, - status : status, - options : options - }; - -}()); \ No newline at end of file diff --git a/apps/assets/scripts/wvnc.js b/apps/assets/scripts/wvnc.js deleted file mode 100644 index 887b6aa..0000000 --- a/apps/assets/scripts/wvnc.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var e;e=function(){function e(e){var t,n;this.socket=void 0,this.ws=void 0,this.canvas=void 0,n="decoder.js",this.scale=1,e.ws&&(this.ws=e.ws),this.canvas=e.element,"string"==typeof this.canvas&&(this.canvas=document.getElementById(this.canvas)),e.worker&&(n=e.worker),this.decoder=new Worker(n),(t=this).mouseMask=0,this.decoder.onmessage=function(e){return t.process(e.data)}}return e.prototype.init=function(){var n;return n=this,new Promise(function(e,t){return n.canvas?(n.initInputEvent(),e()):t("Canvas is not set")})},e.prototype.initInputEvent=function(){var e,n,s,o;if((s=this).canvas&&(n=function(e){var t;return t=s.canvas.getBoundingClientRect(),{x:Math.floor((e.clientX-t.left)/s.scale),y:Math.floor((e.clientY-t.top)/s.scale)}},o=function(e){var t;return t=n(e),s.sendPointEvent(t.x,t.y,s.mouseMask)},s.canvas))return s.canvas.oncontextmenu=function(e){return e.preventDefault(),!1},s.canvas.onmousemove=function(e){return o(e)},s.canvas.onmousedown=function(e){var t;return t=1<>8,s[2]=255&t,s[3]=t>>8,s[4]=n,this.socket.send(this.buildCommand(5,s))},e.prototype.sendKeyEvent=function(e,t){var n;if(this.socket)return(n=new Uint8Array(3))[0]=255&e,n[1]=e>>8,n[2]=t,console.log(e,t),this.socket.send(this.buildCommand(6,n))},e.prototype.buildCommand=function(e,t){var n,s;switch(s=void 0,typeof t){case"string":s=(new TextEncoder).encode(t);break;case"number":s=new Uint8Array([t]);break;default:s=t}return(n=new Uint8Array(s.length+3))[0]=e,n[2]=s.length>>8,n[1]=15&s.length,n.set(s,3),n.buffer},e.prototype.oncopy=function(e){return console.log("Get clipboard text: "+e)},e.prototype.onpassword=function(){return new Promise(function(e,t){return t("onpassword is not implemented")})},e.prototype.sendTextAsClipboard=function(e){if(this.socket)return console.log("send ",e),this.socket.send(this.buildCommand(7,e))},e.prototype.oncredential=function(){return new Promise(function(e,t){return t("oncredential is not implemented")})},e.prototype.consume=function(e){var t,n,s,o,a,r,i;switch(t=(n=new Uint8Array(e.data))[0],r=this,t){case 254:return n=n.subarray(1,n.length-1),s=new TextDecoder("utf-8"),console.log("Error",s.decode(n));case 129:return console.log("Request for password"),this.onpassword().then(function(e){return r.socket.send(r.buildCommand(2,e))});case 130:return console.log("Request for login"),this.oncredential().then(function(e,t){var n;return(n=new Uint8Array(e.length+t.length+1)).set((new TextEncoder).encode(e),0),n.set(["\0"],e.length),n.set((new TextEncoder).encode(t),e.length+1),r.socket.send(r.buildCommand(3,n))});case 131:return console.log("resize"),i=n[1]|n[2]<<8,a=n[3]|n[4]<<8,o=n[5],this.initCanvas(i,a,o),this.socket.send(this.buildCommand(4,1));case 132:return this.decoder.postMessage(n.buffer,[n.buffer]);case 133:return n=n.subarray(1),s=new TextDecoder("utf-8"),this.oncopy(s.decode(n)),this.socket.send(this.buildCommand(4,1));default:return console.log(t)}},e}(),window.WVNC=e}).call(this); \ No newline at end of file diff --git a/apps/assets/scripts/wvnc_asm.js b/apps/assets/scripts/wvnc_asm.js deleted file mode 100644 index 65b2c88..0000000 --- a/apps/assets/scripts/wvnc_asm.js +++ /dev/null @@ -1,4 +0,0 @@ -var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+"/";var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));process["on"]("unhandledRejection",(function(reason,p){process["exit"](1)}));Module["quit"]=(function(status){process["exit"](status)});Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){return read(f)}}Module["readBinary"]=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WEB){if(document.currentScript){scriptDirectory=document.currentScript.src}}else{scriptDirectory=self.location.href}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=(function(title){document.title=title})}else{}var out=Module["print"]||(typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null);var err=Module["printErr"]||(typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var STACK_ALIGN=16;function staticAlloc(size){var ret=STATICTOP;STATICTOP=STATICTOP+size+15&-16;return ret}function dynamicAlloc(size){var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;var ret=size=Math.ceil(size/factor)*factor;return ret}var asm2wasmImports={"f64-rem":(function(x,y){return x%y}),"debugger":(function(){debugger})};var functionPointers=new Array(0);var GLOBAL_BASE=1024;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}var JSfuncs={"stackSave":(function(){stackSave()}),"stackRestore":(function(){stackRestore()}),"arrayToC":(function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};function ccall(ident,returnType,argTypes,args,opts){function convertReturnValue(ret){if(returnType==="string")return Pointer_stringify(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return UTF8ToString(ptr)}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}var WASM_PAGE_SIZE=65536;var ASMJS_PAGE_SIZE=16777216;var MIN_TOTAL_MEMORY=16777216;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBuffer(buf){Module["buffer"]=buffer=buf}function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}if(!Module["reallocBuffer"])Module["reallocBuffer"]=(function(size){var ret;try{var oldHEAP8=HEAP8;ret=new ArrayBuffer(size);var temp=new Int8Array(ret);temp.set(oldHEAP8)}catch(e){return false}var success=_emscripten_replace_memory(ret);if(!success)return false;return ret});function enlargeMemory(){var PAGE_MULTIPLE=Module["usingWasm"]?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE;var LIMIT=2147483648-PAGE_MULTIPLE;if(HEAP32[DYNAMICTOP_PTR>>2]>LIMIT){return false}var OLD_TOTAL_MEMORY=TOTAL_MEMORY;TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);while(TOTAL_MEMORY>2]){if(TOTAL_MEMORY<=536870912){TOTAL_MEMORY=alignUp(2*TOTAL_MEMORY,PAGE_MULTIPLE)}else{TOTAL_MEMORY=Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,PAGE_MULTIPLE),LIMIT)}}var replacement=Module["reallocBuffer"](TOTAL_MEMORY);if(!replacement||replacement.byteLength!=TOTAL_MEMORY){TOTAL_MEMORY=OLD_TOTAL_MEMORY;return false}updateGlobalBuffer(replacement);updateGlobalBufferViews();return true}var byteLength;try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get);byteLength(new ArrayBuffer(4))}catch(e){byteLength=(function(buffer){return buffer.byteLength})}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}function integrateWasmJS(){var wasmTextFile="wvnc_asm.wast";var wasmBinaryFile="wvnc_asm.wasm";var asmjsCodeFile="wvnc_asm.temp.asm.js";if(!isDataURI(wasmTextFile)){wasmTextFile=locateFile(wasmTextFile)}if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}if(!isDataURI(asmjsCodeFile)){asmjsCodeFile=locateFile(asmjsCodeFile)}var wasmPageSize=64*1024;var info={"global":null,"env":null,"asm2wasm":asm2wasmImports,"parent":Module};var exports=null;function mergeMemory(newBuffer){var oldBuffer=Module["buffer"];if(newBuffer.byteLength>2]=poolPtr;HEAP32[environ>>2]=envPtr}else{envPtr=HEAP32[environ>>2];poolPtr=HEAP32[envPtr>>2]}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]==="string"){var line=key+"="+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error("Environment size exceeded TOTAL_ENV_SIZE!")}var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}var SYSCALLS={varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffers){___syscall146.buffers=[null,[],[]];___syscall146.printChar=(function(stream,curr){var buffer=___syscall146.buffers[stream];assert(buffer);if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}})}for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=value;return value}DYNAMICTOP_PTR=staticAlloc(4);STACK_BASE=STACKTOP=alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;Module["wasmTableSize"]=212;Module["wasmMaxTableSize"]=212;Module.asmGlobalArg={};Module.asmLibraryArg={"abort":abort,"enlargeMemory":enlargeMemory,"getTotalMemory":getTotalMemory,"abortOnCannotGrowMemory":abortOnCannotGrowMemory,"___buildEnvironment":___buildEnvironment,"___setErrNo":___setErrNo,"___syscall140":___syscall140,"___syscall146":___syscall146,"___syscall54":___syscall54,"___syscall6":___syscall6,"_emscripten_memcpy_big":_emscripten_memcpy_big,"_exit":_exit,"_getenv":_getenv,"DYNAMICTOP_PTR":DYNAMICTOP_PTR,"STACKTOP":STACKTOP};var asm=Module["asm"](Module.asmGlobalArg,Module.asmLibraryArg,buffer);Module["asm"]=asm;var ___emscripten_environ_constructor=Module["___emscripten_environ_constructor"]=(function(){return Module["asm"]["___emscripten_environ_constructor"].apply(null,arguments)});var ___errno_location=Module["___errno_location"]=(function(){return Module["asm"]["___errno_location"].apply(null,arguments)});var _create_buffer=Module["_create_buffer"]=(function(){return Module["asm"]["_create_buffer"].apply(null,arguments)});var _decode=Module["_decode"]=(function(){return Module["asm"]["_decode"].apply(null,arguments)});var _destroy_buffer=Module["_destroy_buffer"]=(function(){return Module["asm"]["_destroy_buffer"].apply(null,arguments)});var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=(function(){return Module["asm"]["_emscripten_replace_memory"].apply(null,arguments)});var _free=Module["_free"]=(function(){return Module["asm"]["_free"].apply(null,arguments)});var _malloc=Module["_malloc"]=(function(){return Module["asm"]["_malloc"].apply(null,arguments)});var _update=Module["_update"]=(function(){return Module["asm"]["_update"].apply(null,arguments)});var stackAlloc=Module["stackAlloc"]=(function(){return Module["asm"]["stackAlloc"].apply(null,arguments)});var stackRestore=Module["stackRestore"]=(function(){return Module["asm"]["stackRestore"].apply(null,arguments)});var stackSave=Module["stackSave"]=(function(){return Module["asm"]["stackSave"].apply(null,arguments)});var dynCall_vi=Module["dynCall_vi"]=(function(){return Module["asm"]["dynCall_vi"].apply(null,arguments)});Module["asm"]=asm;Module["cwrap"]=cwrap;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]&&status===0){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}Module["quit"](status,new ExitStatus(status))}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run() - - - diff --git a/apps/assets/scripts/wvnc_asm.wasm b/apps/assets/scripts/wvnc_asm.wasm deleted file mode 100644 index b54362f..0000000 Binary files a/apps/assets/scripts/wvnc_asm.wasm and /dev/null differ diff --git a/apps/controllers/IndexController.lua b/apps/controllers/IndexController.lua deleted file mode 100644 index 9f508f6..0000000 --- a/apps/controllers/IndexController.lua +++ /dev/null @@ -1,30 +0,0 @@ -BaseController:subclass("IndexController", { - registry = {} -}) - -function IndexController:index( ... ) - return true -end - -function IndexController:actionnotfound(...) - self.template:setView("index") - return self:index(table.unpack({...})) -end - -function IndexController:json(...) - std.json() - echo( JSON.encode(REQUEST)) - return false -end - -function IndexController:get(...) - return true -end - -function IndexController:form(...) - return true -end - -function IndexController:upload(...) - return true -end \ No newline at end of file diff --git a/apps/controllers/MarkOnController.lua b/apps/controllers/MarkOnController.lua deleted file mode 100644 index ef1b748..0000000 --- a/apps/controllers/MarkOnController.lua +++ /dev/null @@ -1,13 +0,0 @@ -BaseController:subclass("MarkOnController", { - registry = {} -}) - -function MarkOnController:index( ... ) - self.template:set("args", "['MarkOn']") - return true -end - -function MarkOnController:actionnotfound(...) - self.template:setView("index") - return self:index(table.unpack({...})) -end \ No newline at end of file diff --git a/apps/controllers/ScriptController.lua b/apps/controllers/ScriptController.lua deleted file mode 100644 index ba6af6a..0000000 --- a/apps/controllers/ScriptController.lua +++ /dev/null @@ -1,19 +0,0 @@ -BaseController:subclass("ScriptController", { - registry = {} -}) - -function ScriptController:index( name ) - local path = WWW_ROOT..DIR_SEP.."assets"..DIR_SEP.."shs"..DIR_SEP..name..".sh" - - if ulib.exists(path) then - std.header("text/plain") - std.f(path) - else - self:error("No script found") - end - return false -end - -function ScriptController:actionnotfound(...) - return self:index(table.unpack({...})) -end \ No newline at end of file diff --git a/apps/controllers/WebVNCController.lua b/apps/controllers/WebVNCController.lua deleted file mode 100644 index 659bc60..0000000 --- a/apps/controllers/WebVNCController.lua +++ /dev/null @@ -1,13 +0,0 @@ -BaseController:subclass("WebVNCController", { - registry = {} -}) - -function WebVNCController:index( ... ) - self.template:set("args", "['WebVNC']") - return true -end - -function WebVNCController:actionnotfound(...) - self.template:setView("index") - return self:index(table.unpack({...})) -end \ No newline at end of file diff --git a/apps/router.lua b/apps/router.lua deleted file mode 100644 index 3e67cdd..0000000 --- a/apps/router.lua +++ /dev/null @@ -1,59 +0,0 @@ - --- the rewrite rule for the framework --- should be something like this --- ^\/apps\/+(.*)$ = /apps/router.lua?r=<1>& --- some global variables -DIR_SEP = "/" -WWW_ROOT = __ROOT__.."/apps" -if HEADER.Host then - HTTP_ROOT= "https://"..HEADER.Host -else - HTTP_ROOT = "https://apps.lxsang.me" -end --- class path: path.to.class -BASE_FRW = "" --- class path: path.to.class -CONTROLLER_ROOT = BASE_FRW.."apps.controllers" -MODEL_ROOT = BASE_FRW.."apps.models" --- file path: path/to/file -VIEW_ROOT = WWW_ROOT..DIR_SEP.."views" -LOG_ROOT = WWW_ROOT..DIR_SEP.."logs" - --- require needed library -require(BASE_FRW.."silk.api") -POLICY.mimes["application/wasm"] = true --- registry object store global variables -local REGISTRY = {} --- set logging level -REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = true, DEBUG = false}} -REGISTRY.db = DBHelper:new{db="iosapps"} -REGISTRY.layout = 'default' -REGISTRY.fileaccess = true - -REGISTRY.db:open() -local router = Router:new{registry = REGISTRY} -REGISTRY.router = router -router:setPath(CONTROLLER_ROOT) ---router:route('edit', 'post/edit', "ALL" ) - --- example of depedencies to the current main route ---[[ -- each layout may have different dependencies -local default_routes_dependencies = { - edit = { - url = "post/edit", - visibility = { - shown = true, - routes = { - ["post/index"] = true - } - } - }, - --category = { - -- url = "cat/index", - -- visibility = "ALL" - --} -} -router:route('default', default_routes_dependencies )]] -router:delegate() -if REGISTRY.db then REGISTRY.db:close() end - diff --git a/apps/views/default/MarkOn/index.ls b/apps/views/default/MarkOn/index.ls deleted file mode 100644 index d1ae457..0000000 --- a/apps/views/default/MarkOn/index.ls +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/views/default/index/form.ls b/apps/views/default/index/form.ls deleted file mode 100644 index c6cbc08..0000000 --- a/apps/views/default/index/form.ls +++ /dev/null @@ -1,15 +0,0 @@ - -
-
- Personal information: - First name:
-
- Last name:
-

- -
-
\ No newline at end of file diff --git a/apps/views/default/index/get.ls b/apps/views/default/index/get.ls deleted file mode 100644 index 9cd36f2..0000000 --- a/apps/views/default/index/get.ls +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/apps/views/default/index/index.ls b/apps/views/default/index/index.ls deleted file mode 100644 index 6998991..0000000 --- a/apps/views/default/index/index.ls +++ /dev/null @@ -1,3 +0,0 @@ -

- Site under construction -

\ No newline at end of file diff --git a/apps/views/default/index/testrq.ls b/apps/views/default/index/testrq.ls deleted file mode 100644 index 8625f20..0000000 --- a/apps/views/default/index/testrq.ls +++ /dev/null @@ -1,11 +0,0 @@ - -
-
- First name:
-
- Last name:
-

- -
\ No newline at end of file diff --git a/apps/views/default/index/upload.ls b/apps/views/default/index/upload.ls deleted file mode 100644 index 045c4e6..0000000 --- a/apps/views/default/index/upload.ls +++ /dev/null @@ -1,12 +0,0 @@ - - -
- Select image to upload: - - - -
\ No newline at end of file diff --git a/apps/views/default/layout.ls b/apps/views/default/layout.ls deleted file mode 100644 index 0b4c7de..0000000 --- a/apps/views/default/layout.ls +++ /dev/null @@ -1,32 +0,0 @@ - - - - Application pages - - - - - - - - - - -
- -
- - \ No newline at end of file diff --git a/apps/views/default/webVNC/index.ls b/apps/views/default/webVNC/index.ls deleted file mode 100644 index b627820..0000000 --- a/apps/views/default/webVNC/index.ls +++ /dev/null @@ -1,18 +0,0 @@ -
-
    -
  • VNC client demo
  • -
  • Connect
  • -
  • Disconnect
  • -
  • - Scale (percent): - -
  • -
  • -
-
- \ No newline at end of file diff --git a/blog/Makefile b/blog/Makefile index fea52af..950c1c0 100644 --- a/blog/Makefile +++ b/blog/Makefile @@ -1,6 +1,6 @@ copyfiles = assets views models controllers router.lua main: - - mkdir $(BUILDDIR) + - mkdir -p $(BUILDDIR) cp -rvf $(copyfiles) $(BUILDDIR) - cd $(BUILDDIR) && ln -s ../grs ./rst diff --git a/ci/Makefile b/ci/Makefile index 846b9e3..e39980b 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -1,6 +1,6 @@ copyfiles = router.lua scripts main: - - mkdir $(BUILDDIR) + - mkdir -p $(BUILDDIR) cp -rvf $(copyfiles) $(BUILDDIR) - mkdir -p $(BUILDDIR)/log \ No newline at end of file diff --git a/doc/Makefile b/doc/Makefile index fa4e7c8..2b0a5a4 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,6 +1,6 @@ copyfiles = views controllers router.lua assets main: - - mkdir $(BUILDDIR) + - mkdir -p $(BUILDDIR) cp -rvf $(copyfiles) $(BUILDDIR) - cd $(BUILDDIR) && ln -s ../grs ./rst \ No newline at end of file diff --git a/info/Makefile b/info/Makefile index 0e56e7a..3a93bfb 100644 --- a/info/Makefile +++ b/info/Makefile @@ -1,6 +1,6 @@ copyfiles = style.css router.lua models views controllers robot.txt main: - - mkdir $(BUILDDIR) + - mkdir -p $(BUILDDIR) cp -rvf $(copyfiles) $(BUILDDIR) - cd $(BUILDDIR) && ln -s ../grs ./rst \ No newline at end of file diff --git a/os/Makefile b/os/Makefile index 10bba26..f81fc0e 100644 --- a/os/Makefile +++ b/os/Makefile @@ -1,6 +1,6 @@ copyfiles = controllers libs router.lua main: - - mkdir $(BUILDDIR) + - mkdir -p $(BUILDDIR) cp -rfv $(copyfiles) $(BUILDDIR) - cd $(BUILDDIR) && ln -s ../grs ./rst \ No newline at end of file