Compare commits
18 Commits
master
...
primalmoti
| Author | SHA1 | Date |
|---|---|---|
|
|
11f3271a52 | |
|
|
8ded53c1de | |
|
|
434699bf23 | |
|
|
5e5d81dd86 | |
|
|
f8f5c923dd | |
|
|
93c860e8e5 | |
|
|
78223532ce | |
|
|
9fc59562a1 | |
|
|
045c117dbb | |
|
|
eb7b25ae17 | |
|
|
edd9a72c0e | |
|
|
9046dbf244 | |
|
|
5c7418cf36 | |
|
|
61bddad2ea | |
|
|
30a532d38c | |
|
|
212733afbf | |
|
|
33ebb52b56 | |
|
|
ed5573e806 |
|
|
@ -1,3 +1,4 @@
|
|||
*.pyc
|
||||
*.o
|
||||
wsproxy
|
||||
*.DS_Store
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//"use strict";
|
||||
/*jslint browser: true, white: false, bitwise: false */
|
||||
/*global window, Util, Base64 */
|
||||
|
||||
function Canvas(conf) {
|
||||
Canvas = function(conf) {
|
||||
|
||||
conf = conf || {}; // Configuration
|
||||
var that = {}, // Public API interface
|
||||
|
|
@ -41,6 +41,7 @@ Util.conf_default(conf, that, 'true_color', true);
|
|||
Util.conf_default(conf, that, 'focused', true);
|
||||
Util.conf_default(conf, that, 'colourMap', []);
|
||||
Util.conf_default(conf, that, 'scale', 1);
|
||||
Util.conf_default(conf, that, 'focusContainer', document);
|
||||
|
||||
// Override some specific getters/setters
|
||||
that.set_prefer_js = function(val) {
|
||||
|
|
@ -76,8 +77,6 @@ that.get_height = function() {
|
|||
return c_height;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
|
@ -386,8 +385,8 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
|
|||
c_mouseButton = mouseButtonFunc || null;
|
||||
c_mouseMove = mouseMoveFunc || null;
|
||||
|
||||
Util.addEvent(document, 'keydown', onKeyDown);
|
||||
Util.addEvent(document, 'keyup', onKeyUp);
|
||||
Util.addEvent(conf.focusContainer, 'keydown', onKeyDown);
|
||||
Util.addEvent(conf.focusContainer, 'keyup', onKeyUp);
|
||||
Util.addEvent(c, 'mousedown', onMouseDown);
|
||||
Util.addEvent(c, 'mouseup', onMouseUp);
|
||||
Util.addEvent(c, 'mousemove', onMouseMove);
|
||||
|
|
@ -395,38 +394,52 @@ that.start = function(keyPressFunc, mouseButtonFunc, mouseMoveFunc) {
|
|||
onMouseWheel);
|
||||
|
||||
/* Work around right and middle click browser behaviors */
|
||||
Util.addEvent(document, 'click', onMouseDisable);
|
||||
Util.addEvent(document.body, 'contextmenu', onMouseDisable);
|
||||
Util.addEvent(conf.focusContainer, 'click', onMouseDisable);
|
||||
Util.addEvent(conf.focusContainer.body, 'contextmenu', onMouseDisable);
|
||||
|
||||
Util.Debug("<< Canvas.start");
|
||||
};
|
||||
|
||||
that.rescale = function(factor) {
|
||||
var c, tp, x, y,
|
||||
properties = ['transform', 'WebkitTransform', 'MozTransform', null];
|
||||
properties = ['transform', 'WebkitTransform', 'MozTransform', 'oTransform', null],
|
||||
origin = ['transformOrigin', 'WebkitTransformOrigin', 'MozTransformOrigin', 'oTransformOrigin', null];
|
||||
|
||||
if (conf.scale === factor) {
|
||||
return;
|
||||
}
|
||||
|
||||
c = conf.target;
|
||||
tp = properties.shift();
|
||||
while (tp) {
|
||||
if (typeof c.style[tp] !== 'undefined') {
|
||||
conf.scale = factor;
|
||||
x = c.width - c.width * factor;
|
||||
y = c.height - c.height * factor;
|
||||
|
||||
//tp = properties.shift();
|
||||
|
||||
if (typeof(c.style.zoom) != "undefined") {
|
||||
c.style.zoom = conf.scale;
|
||||
return
|
||||
}
|
||||
|
||||
while (tp = properties.shift()) {
|
||||
if (typeof c.style[tp] != 'undefined') {
|
||||
break;
|
||||
}
|
||||
tp = properties.shift();
|
||||
}
|
||||
|
||||
|
||||
while (tpo = origin.shift()) {
|
||||
if (typeof c.style[tpo] != 'undefined') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tp === null) {
|
||||
Util.Debug("No scaling support");
|
||||
return;
|
||||
}
|
||||
|
||||
if (conf.scale === factor) {
|
||||
//Util.Debug("Canvas already scaled to '" + factor + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
conf.scale = factor;
|
||||
x = c.width - c.width * factor;
|
||||
y = c.height - c.height * factor;
|
||||
c.style[tp] = "scale(" + conf.scale + ") translate(-" + x + "px, -" + y + "px)";
|
||||
|
||||
c.style[tpo] = "top left";
|
||||
c.style[tp] = "scale(" + conf.scale + ")";
|
||||
};
|
||||
|
||||
that.resize = function(width, height, true_color) {
|
||||
|
|
@ -452,8 +465,8 @@ that.clear = function() {
|
|||
|
||||
that.stop = function() {
|
||||
var c = conf.target;
|
||||
Util.removeEvent(document, 'keydown', onKeyDown);
|
||||
Util.removeEvent(document, 'keyup', onKeyUp);
|
||||
Util.removeEvent(conf.focusContainer, 'keydown', onKeyDown);
|
||||
Util.removeEvent(conf.focusContainer, 'keyup', onKeyUp);
|
||||
Util.removeEvent(c, 'mousedown', onMouseDown);
|
||||
Util.removeEvent(c, 'mouseup', onMouseUp);
|
||||
Util.removeEvent(c, 'mousemove', onMouseMove);
|
||||
|
|
@ -461,8 +474,8 @@ that.stop = function() {
|
|||
onMouseWheel);
|
||||
|
||||
/* Work around right and middle click browser behaviors */
|
||||
Util.removeEvent(document, 'click', onMouseDisable);
|
||||
Util.removeEvent(document.body, 'contextmenu', onMouseDisable);
|
||||
Util.removeEvent(conf.focusContainer, 'click', onMouseDisable);
|
||||
Util.removeEvent(conf.focusContainer.body, 'contextmenu', onMouseDisable);
|
||||
|
||||
// Turn off cursor rendering
|
||||
if (conf.cursor_uri) {
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@
|
|||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//"use strict";
|
||||
/*jslint white: false, browser: true, bitwise: false */
|
||||
/*global window, WebSocket, Util, Canvas, VNC_native_ws, Base64, DES */
|
||||
|
||||
|
||||
function RFB(conf) {
|
||||
|
||||
RFB = function(conf) {
|
||||
conf = conf || {}; // Configuration
|
||||
var that = {}, // Public API interface
|
||||
|
||||
|
|
@ -140,6 +139,8 @@ Util.conf_default(conf, that, 'true_color', true, true);
|
|||
Util.conf_default(conf, that, 'b64encode', true, true);
|
||||
Util.conf_default(conf, that, 'local_cursor', true, true);
|
||||
|
||||
Util.conf_default(conf, that, 'focusContainer', document);
|
||||
|
||||
// time to wait for connection
|
||||
Util.conf_default(conf, that, 'connectTimeout', 2000);
|
||||
// frequency to check for send/receive
|
||||
|
|
@ -195,7 +196,7 @@ function constructor() {
|
|||
}
|
||||
// Initialize canvas
|
||||
try {
|
||||
canvas = new Canvas({'target': conf.target});
|
||||
canvas = new Canvas({'target': conf.target, 'focusContainer': conf.focusContainer});
|
||||
} catch (exc) {
|
||||
Util.Error("Canvas exception: " + exc);
|
||||
updateState('fatal', "No working Canvas");
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
"use strict";
|
||||
/*jslint bitwise: false, white: false */
|
||||
/*global window, console, document, navigator, ActiveXObject*/
|
||||
/*global window, document, navigator, ActiveXObject*/
|
||||
|
||||
// Globals defined here
|
||||
var Util = {}, $;
|
||||
Util = {};
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -303,18 +303,14 @@ Util.Flash = (function(){
|
|||
/*
|
||||
* Cookie handling. Dervied from: http://www.quirksmode.org/js/cookies.html
|
||||
*/
|
||||
|
||||
// No days means only for this browser session
|
||||
Util.createCookie = function(name,value,days) {
|
||||
var date, expires;
|
||||
if (days) {
|
||||
date = new Date();
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
expires = "; expires="+date.toGMTString();
|
||||
}
|
||||
else {
|
||||
expires = "";
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
}
|
||||
else var expires = "";
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
};
|
||||
|
||||
|
|
@ -329,7 +325,7 @@ Util.readCookie = function(name, defaultValue) {
|
|||
};
|
||||
|
||||
Util.eraseCookie = function(name) {
|
||||
Util.createCookie(name,"",-1);
|
||||
createCookie(name,"",-1);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -13,16 +13,19 @@
|
|||
var VNC_native_ws, WebSocket__swfLocation;
|
||||
|
||||
/*
|
||||
* Load supporting scripts
|
||||
* RFB namespace
|
||||
*/
|
||||
function get_VNC_uri_prefix() {
|
||||
return (typeof VNC_uri_prefix !== "undefined") ? VNC_uri_prefix : "include/";
|
||||
}
|
||||
|
||||
(function () {
|
||||
RFB = {
|
||||
|
||||
get_VNC_uri_prefix: function () {
|
||||
return (typeof VNC_uri_prefix !== "undefined") ? VNC_uri_prefix : "include/";
|
||||
},
|
||||
|
||||
loadExtras: function () {
|
||||
var extra = "", start, end;
|
||||
|
||||
start = "<script src='" + get_VNC_uri_prefix();
|
||||
start = "<script src='" + RFB.get_VNC_uri_prefix();
|
||||
end = "'><\/script>";
|
||||
|
||||
// Uncomment to activate firebug lite
|
||||
|
|
@ -47,5 +50,5 @@ function get_VNC_uri_prefix() {
|
|||
extra += start + "web-socket-js/web_socket.js" + end;
|
||||
}
|
||||
document.write(extra);
|
||||
}());
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ Connect parameters are provided in query string:
|
|||
<script type='text/javascript'
|
||||
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
||||
-->
|
||||
<script src="include/init.js"></script>
|
||||
<script src="include/vnc.js"></script>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue