Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
43cf7bd8
Commit
43cf7bd8
authored
Feb 19, 2011
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some JSLint'ing
parent
9b8f457b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
34 deletions
+37
-34
canvas.js
include/canvas.js
+5
-5
rfb.js
include/rfb.js
+17
-15
ui.js
include/ui.js
+3
-2
websock.js
include/websock.js
+12
-12
No files found.
include/canvas.js
View file @
43cf7bd8
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
* See README.md for usage and integration instructions.
* See README.md for usage and integration instructions.
*/
*/
"use strict"
;
/*jslint browser: true, white: false, bitwise: false */
/*jslint browser: true, white: false, bitwise: false */
/*global window, Util, Base64 */
/*global window, Util, Base64
, changeCursor, getKeysym
*/
function
Canvas
(
conf
)
{
function
Canvas
(
conf
)
{
"use strict"
;
conf
=
conf
||
{};
// Configuration
conf
=
conf
||
{};
// Configuration
var
that
=
{},
// Public API interface
var
that
=
{},
// Public API interface
...
@@ -176,7 +176,7 @@ function constructor() {
...
@@ -176,7 +176,7 @@ function constructor() {
c_flush_timer
=
setTimeout
(
that
.
flush
,
100
);
c_flush_timer
=
setTimeout
(
that
.
flush
,
100
);
}
}
};
};
}
)(
);
}
()
);
}
}
}
}
...
@@ -617,7 +617,7 @@ that.changeCursor = function(pixels, mask, hotx, hoty, w, h) {
...
@@ -617,7 +617,7 @@ that.changeCursor = function(pixels, mask, hotx, hoty, w, h) {
}
else
{
}
else
{
changeCursor
(
conf
.
target
,
pixels
,
mask
,
hotx
,
hoty
,
w
,
h
,
conf
.
colourMap
);
changeCursor
(
conf
.
target
,
pixels
,
mask
,
hotx
,
hoty
,
w
,
h
,
conf
.
colourMap
);
}
}
}
}
;
return
constructor
();
// Return the public API interface
return
constructor
();
// Return the public API interface
...
@@ -721,7 +721,7 @@ function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
...
@@ -721,7 +721,7 @@ function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
url
=
"data:image/x-icon;base64,"
+
Base64
.
encode
(
cur
);
url
=
"data:image/x-icon;base64,"
+
Base64
.
encode
(
cur
);
target
.
style
.
cursor
=
"url("
+
url
+
") "
+
hotx
+
" "
+
hoty
+
", default"
;
target
.
style
.
cursor
=
"url("
+
url
+
") "
+
hotx
+
" "
+
hoty
+
", default"
;
//Util.Debug("<< changeCursor, cur.length: " + cur.length);
//Util.Debug("<< changeCursor, cur.length: " + cur.length);
}
;
}
...
...
include/rfb.js
View file @
43cf7bd8
...
@@ -6,19 +6,19 @@
...
@@ -6,19 +6,19 @@
* See README.md for usage and integration instructions.
* See README.md for usage and integration instructions.
*/
*/
"use strict"
;
/*jslint white: false, browser: true, bitwise: false, plusplus: false */
/*jslint white: false, browser: true, bitwise: false, plusplus: false */
/*global window, Util, Canvas,
VNC_native_ws, Base64, DES
*/
/*global window, Util, Canvas,
Websock, Websock_native, Base64, DES, noVNC_logo
*/
function
RFB
(
conf
)
{
function
RFB
(
conf
)
{
"use strict"
;
conf
=
conf
||
{};
// Configuration
conf
=
conf
||
{};
// Configuration
var
that
=
{},
// Public API interface
var
that
=
{},
// Public API interface
// Pre-declare private functions used before definitions (jslint)
// Pre-declare private functions used before definitions (jslint)
init_vars
,
updateState
,
init_msg
,
normal_msg
,
init_vars
,
updateState
,
fail
,
handle_message
,
framebufferUpdate
,
print_stats
,
init_msg
,
normal_msg
,
framebufferUpdate
,
print_stats
,
pixelFormat
,
clientEncodings
,
fbUpdateRequest
,
pixelFormat
,
clientEncodings
,
fbUpdateRequest
,
keyEvent
,
pointerEvent
,
clientCutText
,
keyEvent
,
pointerEvent
,
clientCutText
,
...
@@ -229,6 +229,8 @@ function connect() {
...
@@ -229,6 +229,8 @@ function connect() {
}
}
init_vars
=
function
()
{
init_vars
=
function
()
{
var
i
;
/* Reset state */
/* Reset state */
ws
=
new
Websock
();
ws
=
new
Websock
();
ws
.
init
();
ws
.
init
();
...
@@ -265,14 +267,14 @@ init_vars = function() {
...
@@ -265,14 +267,14 @@ init_vars = function() {
mouse_arr
=
[];
mouse_arr
=
[];
// Clear the per connection encoding stats
// Clear the per connection encoding stats
for
(
var
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
encStats
[
encodings
[
i
][
1
]][
0
]
=
0
;
encStats
[
encodings
[
i
][
1
]][
0
]
=
0
;
}
}
};
};
// Print statistics
// Print statistics
print_stats
=
function
()
{
print_stats
=
function
()
{
var
i
,
encName
,
s
;
var
i
,
s
;
Util
.
Info
(
"Encoding stats for this connection:"
);
Util
.
Info
(
"Encoding stats for this connection:"
);
for
(
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
s
=
encStats
[
encodings
[
i
][
1
]];
s
=
encStats
[
encodings
[
i
][
1
]];
...
@@ -285,8 +287,8 @@ print_stats = function() {
...
@@ -285,8 +287,8 @@ print_stats = function() {
for
(
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
encodings
.
length
;
i
+=
1
)
{
s
=
encStats
[
encodings
[
i
][
1
]];
s
=
encStats
[
encodings
[
i
][
1
]];
if
((
s
[
0
]
+
s
[
1
])
>
0
)
{
if
((
s
[
0
]
+
s
[
1
])
>
0
)
{
Util
.
Info
(
" "
+
encodings
[
i
][
0
]
+
": "
Util
.
Info
(
" "
+
encodings
[
i
][
0
]
+
": "
+
+
s
[
1
]
+
" rects"
);
s
[
1
]
+
" rects"
);
}
}
}
}
};
};
...
@@ -459,12 +461,13 @@ updateState = function(state, statusMsg) {
...
@@ -459,12 +461,13 @@ updateState = function(state, statusMsg) {
conf
.
updateState
(
that
,
state
,
oldstate
,
statusMsg
);
conf
.
updateState
(
that
,
state
,
oldstate
,
statusMsg
);
}
}
};
};
function
fail
(
msg
)
{
fail
=
function
(
msg
)
{
updateState
(
'failed'
,
msg
);
updateState
(
'failed'
,
msg
);
return
false
;
return
false
;
}
}
;
function
handle_message
()
{
handle_message
=
function
()
{
//Util.Debug(">> handle_message ws.rQlen(): " + ws.rQlen());
//Util.Debug(">> handle_message ws.rQlen(): " + ws.rQlen());
//Util.Debug("ws.rQslice(0,20): " + ws.rQslice(0,20) + " (" + ws.rQlen() + ")");
//Util.Debug("ws.rQslice(0,20): " + ws.rQslice(0,20) + " (" + ws.rQlen() + ")");
if
(
ws
.
rQlen
()
===
0
)
{
if
(
ws
.
rQlen
()
===
0
)
{
...
@@ -495,11 +498,11 @@ function handle_message() {
...
@@ -495,11 +498,11 @@ function handle_message() {
init_msg
();
init_msg
();
break
;
break
;
}
}
}
}
;
function
genDES
(
password
,
challenge
)
{
function
genDES
(
password
,
challenge
)
{
var
i
,
passwd
=
[]
,
des
;
var
i
,
passwd
=
[];
for
(
i
=
0
;
i
<
password
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
password
.
length
;
i
+=
1
)
{
passwd
.
push
(
password
.
charCodeAt
(
i
));
passwd
.
push
(
password
.
charCodeAt
(
i
));
}
}
...
@@ -653,9 +656,8 @@ init_msg = function() {
...
@@ -653,9 +656,8 @@ init_msg = function() {
if
(
rfb_version
>=
3.8
)
{
if
(
rfb_version
>=
3.8
)
{
updateState
(
'SecurityResult'
);
updateState
(
'SecurityResult'
);
return
;
return
;
}
else
{
// Fall through to ClientInitialisation
}
}
// Fall through to ClientInitialisation
break
;
break
;
case
2
:
// VNC authentication
case
2
:
// VNC authentication
if
(
rfb_password
.
length
===
0
)
{
if
(
rfb_password
.
length
===
0
)
{
...
...
include/ui.js
View file @
43cf7bd8
...
@@ -5,9 +5,10 @@
...
@@ -5,9 +5,10 @@
*
*
* See README.md for usage and integration instructions.
* See README.md for usage and integration instructions.
*/
*/
"use strict"
;
"use strict"
;
/*jslint white: false */
/*jslint white: false
, browser: true
*/
/*global
$,
Util, RFB, Canvas, Element, Fx */
/*global
window, $D, Util, Web
Util, RFB, Canvas, Element, Fx */
var
UI
=
{
var
UI
=
{
...
...
include/websock.js
View file @
43cf7bd8
...
@@ -78,7 +78,7 @@ function get_rQi() {
...
@@ -78,7 +78,7 @@ function get_rQi() {
}
}
set_rQi
=
function
(
val
)
{
set_rQi
=
function
(
val
)
{
rQi
=
val
;
rQi
=
val
;
}
}
;
function
rQlen
()
{
function
rQlen
()
{
return
rQ
.
length
-
rQi
;
return
rQ
.
length
-
rQi
;
...
@@ -193,7 +193,7 @@ function send(arr) {
...
@@ -193,7 +193,7 @@ function send(arr) {
//Util.Debug(">> send_array: " + arr);
//Util.Debug(">> send_array: " + arr);
sQ
=
sQ
.
concat
(
arr
);
sQ
=
sQ
.
concat
(
arr
);
return
flush
();
return
flush
();
}
;
}
function
send_string
(
str
)
{
function
send_string
(
str
)
{
//Util.Debug(">> send_string: " + str);
//Util.Debug(">> send_string: " + str);
...
@@ -210,7 +210,7 @@ function recv_message(e) {
...
@@ -210,7 +210,7 @@ function recv_message(e) {
try
{
try
{
decode_message
(
e
.
data
);
decode_message
(
e
.
data
);
if
(
rQlen
()
>
0
)
{
if
(
rQlen
()
>
0
)
{
eventHandlers
[
'message'
]
();
eventHandlers
.
message
();
// Compact the receive queue
// Compact the receive queue
if
(
rQ
.
length
>
rQmax
)
{
if
(
rQ
.
length
>
rQmax
)
{
//Util.Debug("Compacting receive queue");
//Util.Debug("Compacting receive queue");
...
@@ -229,13 +229,13 @@ function recv_message(e) {
...
@@ -229,13 +229,13 @@ function recv_message(e) {
Util
.
Warn
(
"recv_message, caught exception:"
+
exc
);
Util
.
Warn
(
"recv_message, caught exception:"
+
exc
);
}
}
if
(
typeof
exc
.
name
!==
'undefined'
)
{
if
(
typeof
exc
.
name
!==
'undefined'
)
{
eventHandlers
[
'error'
]
(
exc
.
name
+
": "
+
exc
.
message
);
eventHandlers
.
error
(
exc
.
name
+
": "
+
exc
.
message
);
}
else
{
}
else
{
eventHandlers
[
'error'
]
(
exc
);
eventHandlers
.
error
(
exc
);
}
}
}
}
//Util.Debug("<< recv_message");
//Util.Debug("<< recv_message");
}
;
}
// Set event handlers
// Set event handlers
...
@@ -258,19 +258,19 @@ function open(uri) {
...
@@ -258,19 +258,19 @@ function open(uri) {
websocket
.
onmessage
=
recv_message
;
websocket
.
onmessage
=
recv_message
;
websocket
.
onopen
=
function
(
e
)
{
websocket
.
onopen
=
function
(
e
)
{
Util
.
Debug
(
">> WebSock.onopen"
);
Util
.
Debug
(
">> WebSock.onopen"
);
eventHandlers
[
'open'
]
();
eventHandlers
.
open
();
Util
.
Debug
(
"<< WebSock.onopen"
);
Util
.
Debug
(
"<< WebSock.onopen"
);
}
}
;
websocket
.
onclose
=
function
(
e
)
{
websocket
.
onclose
=
function
(
e
)
{
Util
.
Debug
(
">> WebSock.onclose"
);
Util
.
Debug
(
">> WebSock.onclose"
);
eventHandlers
[
'close'
]
();
eventHandlers
.
close
();
Util
.
Debug
(
"<< WebSock.onclose"
);
Util
.
Debug
(
"<< WebSock.onclose"
);
}
}
;
websocket
.
onerror
=
function
(
e
)
{
websocket
.
onerror
=
function
(
e
)
{
Util
.
Debug
(
"<< WebSock.onerror: "
+
e
);
Util
.
Debug
(
"<< WebSock.onerror: "
+
e
);
eventHandlers
[
'error'
]
(
e
);
eventHandlers
.
error
(
e
);
Util
.
Debug
(
"<< WebSock.onerror: "
);
Util
.
Debug
(
"<< WebSock.onerror: "
);
}
}
;
}
}
function
close
()
{
function
close
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment