1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-04-18 17:46:45 +02:00

add demo page

This commit is contained in:
lxsang 2018-09-23 14:08:19 +02:00
parent 1a78d814eb
commit efe2061289
5 changed files with 73 additions and 21 deletions

View File

@ -22,25 +22,28 @@ class WebVNC extends window.classes.BaseObject
me = @ me = @
@client.onpassword = () -> @client.onpassword = () ->
return new Promise (r,e) -> return new Promise (r,e) ->
r('lxsan9') r('demopass')
@client.oncredential = () -> @client.oncredential = () ->
return new Promise (r,e) -> return new Promise (r,e) ->
r('mrsang', '!x$@n9') r('demo', 'demo')
@client.oncopy = (text) -> @client.oncopy = (text) ->
($ "#clipboard")[0].value = text ($ "#clipboard")[0].value = text
@client.init() @client.init()
.then () -> .then () ->
$("#connect").click (e) -> $("#connect").click (e) ->
me.client.connect "192.168.1.20:5901", { me.client.connect "/opt/www/vnc.conf", {
bbp: 32, bbp: 32,
flag: 3, flag: 3,
quality: 30 quality: 10
} }
$("#tbstatus").html "32bbp, compress JPEG & ZLib, JPEG quality 10%"
$("#stop").click (e) -> $("#stop").click (e) ->
me.client.disconnect() me.client.disconnect()
$("#selscale").on 'change', (e) ->
$("#btclipboard").click (e) -> value = Number(@value)/100
me.client.sendTextAsClipboard ($ "#clipboard")[0].value me.client.setScale value
#$("#btclipboard").click (e) ->
# me.client.sendTextAsClipboard ($ "#clipboard")[0].value
.catch (m,s) -> .catch (m,s) ->
console.error m, s console.error m, s
WebVNC.dependencies = [ WebVNC.dependencies = [

File diff suppressed because one or more lines are too long

View File

@ -188,12 +188,12 @@
me = this; me = this;
this.client.onpassword = function() { this.client.onpassword = function() {
return new Promise(function(r, e) { return new Promise(function(r, e) {
return r('lxsan9'); return r('demopass');
}); });
}; };
this.client.oncredential = function() { this.client.oncredential = function() {
return new Promise(function(r, e) { return new Promise(function(r, e) {
return r('mrsang', '!x$@n9'); return r('demo', 'demo');
}); });
}; };
this.client.oncopy = function(text) { this.client.oncopy = function(text) {
@ -201,17 +201,20 @@
}; };
return this.client.init().then(function() { return this.client.init().then(function() {
$("#connect").click(function(e) { $("#connect").click(function(e) {
return me.client.connect("192.168.1.20:5901", { return me.client.connect("/Users/mrsang/Documents/build/www/vnc.conf", {
bbp: 32, bbp: 32,
flag: 3, flag: 3,
quality: 30 quality: 10
}); });
}); });
$("#tbstatus").html("32bbp, compress JPEG & ZLib, JPEG quality 10%");
$("#stop").click(function(e) { $("#stop").click(function(e) {
return me.client.disconnect(); return me.client.disconnect();
}); });
return $("#btclipboard").click(function(e) { return $("#selscale").on('change', function(e) {
return me.client.sendTextAsClipboard(($("#clipboard"))[0].value); var value;
value = Number(this.value) / 100;
return me.client.setScale(value);
}); });
})["catch"](function(m, s) { })["catch"](function(m, s) {
return console.error(m, s); return console.error(m, s);

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,18 @@
<h1>VNC screen here</h1> <div id="screen_container">
<p><a id="connect" href="#">Connect</a><a id="stop" href="#">Disconnect</a></p> <ul id = "tool_bar">
<p> <li class ="title">VNC client demo</li>
<textarea id='clipboard'></textarea> <li><a id="connect" href="#">Connect</a></li>
<button id="btclipboard">Send</button> <li><a id="stop" href="#">Disconnect</a></li>
</p> <li>
Scale (percent):
<select id="selscale">
<option value="50">40</option>
<option value="60">60</option>
<option value="80">80</option>
<option value="100" selected="selected">100</option>
</select>
</li>
<li id ="tbstatus"></li>
</ul>
<div style="width:1px; display:block; clear:both;"></div>
<canvas id = "canvas" tabindex="1"></canvas> <canvas id = "canvas" tabindex="1"></canvas>