// 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);