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
b7ec5487
Commit
b7ec5487
authored
Apr 13, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to much faster console.log and separate utils into util.js.
parent
0f628064
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
233 additions
and
125 deletions
+233
-125
canvas.html
canvas.html
+3
-6
canvas.js
canvas.js
+7
-36
util.js
include/util.js
+27
-0
vnc.html
vnc.html
+2
-4
vnc.js
vnc.js
+194
-79
No files found.
canvas.html
View file @
b7ec5487
...
@@ -6,22 +6,19 @@
...
@@ -6,22 +6,19 @@
style=
"border-style: dotted; border-width: 1px;"
>
style=
"border-style: dotted; border-width: 1px;"
>
Canvas not supported.
Canvas not supported.
</canvas>
</canvas>
<br>
Debug:
<br>
<textarea
id=
"debug"
style=
"font-size: 9;"
cols=
80
rows=
25
></textarea>
</body>
</body>
<script
src=
"include/mootools.js"
></script>
<script
src=
"include/mootools.js"
></script>
<script
src=
"include/mootools-more.js"
></script>
<script
src=
"include/mootools-more.js"
></script>
<script
src=
"include/util.js"
></script>
<script
src=
"canvas.js"
></script>
<script
src=
"canvas.js"
></script>
<script>
<script>
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
debu
g
(
"here1"
);
console
.
lo
g
(
"here1"
);
Canvas
.
init
(
'tutorial'
,
640
,
480
);
Canvas
.
init
(
'tutorial'
,
640
,
480
);
Canvas
.
draw
();
Canvas
.
draw
();
debu
g
(
"here2"
);
console
.
lo
g
(
"here2"
);
}
}
</script>
</script>
</html>
</html>
canvas.js
View file @
b7ec5487
function
debug
(
str
)
{
cell
=
$
(
'debug'
);
cell
.
innerHTML
+=
str
+
"
\n
"
;
cell
.
scrollTop
=
cell
.
scrollHeight
;
}
function
dirObj
(
obj
,
parent
,
depth
)
{
var
msg
=
""
;
var
val
=
""
;
if
(
!
depth
)
{
depth
=
2
;
}
if
(
!
parent
)
{
parent
=
""
;
}
// Print the properties of the passed-in object
for
(
var
i
in
obj
)
{
if
((
depth
>
1
)
&&
(
typeof
obj
[
i
]
==
"object"
))
{
// Recurse attributes that are objects
msg
+=
dirObj
(
obj
[
i
],
parent
+
"."
+
i
,
depth
-
1
);
}
else
{
val
=
new
String
(
obj
[
i
]).
replace
(
"
\n
"
,
" "
);
if
(
val
.
length
>
30
)
{
val
=
val
.
substr
(
0
,
30
)
+
"..."
;
}
msg
+=
parent
+
"."
+
i
+
": "
+
val
+
"
\n
"
;
}
}
return
msg
;
}
Canvas
=
{
Canvas
=
{
c_x
:
0
,
c_x
:
0
,
...
@@ -38,25 +9,25 @@ ctx : null,
...
@@ -38,25 +9,25 @@ ctx : null,
mouseDown
:
function
(
e
)
{
mouseDown
:
function
(
e
)
{
evt
=
e
.
event
||
window
.
event
;
evt
=
e
.
event
||
window
.
event
;
e
.
stop
();
e
.
stop
();
debu
g
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' down:'
+
console
.
lo
g
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' down:'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
},
},
mouseUp
:
function
(
e
)
{
mouseUp
:
function
(
e
)
{
evt
=
e
.
event
||
window
.
event
;
evt
=
e
.
event
||
window
.
event
;
e
.
stop
();
e
.
stop
();
debu
g
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' up:'
+
console
.
lo
g
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' up:'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
},
},
keyDown
:
function
(
e
)
{
keyDown
:
function
(
e
)
{
e
.
stop
();
e
.
stop
();
debu
g
(
"keydown: "
+
e
.
key
+
"("
+
e
.
code
+
")"
);
console
.
lo
g
(
"keydown: "
+
e
.
key
+
"("
+
e
.
code
+
")"
);
},
},
keyUp
:
function
(
e
)
{
keyUp
:
function
(
e
)
{
e
.
stop
();
e
.
stop
();
debu
g
(
"keyup: "
+
e
.
key
+
"("
+
e
.
code
+
")"
);
console
.
lo
g
(
"keyup: "
+
e
.
key
+
"("
+
e
.
code
+
")"
);
},
},
ctxDisable
:
function
(
e
)
{
ctxDisable
:
function
(
e
)
{
...
@@ -71,7 +42,7 @@ ctxDisable: function (e) {
...
@@ -71,7 +42,7 @@ ctxDisable: function (e) {
init
:
function
(
id
,
width
,
height
,
keyDown
,
keyUp
,
mouseDown
,
mouseUp
)
{
init
:
function
(
id
,
width
,
height
,
keyDown
,
keyUp
,
mouseDown
,
mouseUp
)
{
debu
g
(
">> init_canvas"
);
console
.
lo
g
(
">> init_canvas"
);
Canvas
.
id
=
id
;
Canvas
.
id
=
id
;
...
@@ -100,7 +71,7 @@ init: function (id, width, height, keyDown, keyUp, mouseDown, mouseUp) {
...
@@ -100,7 +71,7 @@ init: function (id, width, height, keyDown, keyUp, mouseDown, mouseUp) {
if
(
!
c
.
getContext
)
return
;
if
(
!
c
.
getContext
)
return
;
Canvas
.
ctx
=
c
.
getContext
(
'2d'
);
Canvas
.
ctx
=
c
.
getContext
(
'2d'
);
debu
g
(
"<< init_canvas"
);
console
.
lo
g
(
"<< init_canvas"
);
},
},
clear
:
function
()
{
clear
:
function
()
{
...
@@ -162,7 +133,7 @@ copyImage: function(old_x, old_y, new_x, new_y, width, height) {
...
@@ -162,7 +133,7 @@ copyImage: function(old_x, old_y, new_x, new_y, width, height) {
getKeysym
:
function
(
e
)
{
getKeysym
:
function
(
e
)
{
evt
=
e
.
event
||
window
.
event
;
evt
=
e
.
event
||
window
.
event
;
var
keysym
;
var
keysym
;
//
debu
g(dirObj(e, null, 1));
//
console.lo
g(dirObj(e, null, 1));
/* Remap modifier and special keys */
/* Remap modifier and special keys */
switch
(
evt
.
keyCode
)
{
switch
(
evt
.
keyCode
)
{
...
...
include/util.js
0 → 100644
View file @
b7ec5487
if
((
!
window
.
console
)
||
(
!
/__debug__$/i
.
test
(
document
.
location
.
href
)))
{
// non-debug mode, an empty function
window
.
console
=
window
.
console
||
{};
window
.
console
.
log
=
function
(
message
)
{};
}
function
dirObj
(
obj
,
parent
,
depth
)
{
var
msg
=
""
;
var
val
=
""
;
if
(
!
depth
)
{
depth
=
2
;
}
if
(
!
parent
)
{
parent
=
""
;
}
// Print the properties of the passed-in object
for
(
var
i
in
obj
)
{
if
((
depth
>
1
)
&&
(
typeof
obj
[
i
]
==
"object"
))
{
// Recurse attributes that are objects
msg
+=
dirObj
(
obj
[
i
],
parent
+
"."
+
i
,
depth
-
1
);
}
else
{
val
=
new
String
(
obj
[
i
]).
replace
(
"
\n
"
,
" "
);
if
(
val
.
length
>
30
)
{
val
=
val
.
substr
(
0
,
30
)
+
"..."
;
}
msg
+=
parent
+
"."
+
i
+
": "
+
val
+
"
\n
"
;
}
}
return
msg
;
}
vnc.html
View file @
b7ec5487
...
@@ -16,21 +16,19 @@
...
@@ -16,21 +16,19 @@
style=
"border-style: dotted; border-width: 1px;"
>
style=
"border-style: dotted; border-width: 1px;"
>
Canvas not supported.
Canvas not supported.
</canvas>
</canvas>
<br>
Debug:
<br>
<textarea
id=
"debug"
style=
"font-size: 9;"
cols=
80
rows=
25
></textarea>
</body>
</body>
<script
src=
"include/mootools.js"
></script>
<script
src=
"include/mootools.js"
></script>
<script
src=
"include/mootools-more.js"
></script>
<script
src=
"include/mootools-more.js"
></script>
<script
src=
"include/base64.js"
></script>
<script
src=
"include/base64.js"
></script>
<script
src=
"include/des.js"
></script>
<script
src=
"include/des.js"
></script>
<script
src=
"include/util.js"
></script>
<script
src=
"canvas.js"
></script>
<script
src=
"canvas.js"
></script>
<script
src=
"vnc.js"
></script>
<script
src=
"vnc.js"
></script>
<script>
<script>
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
console
.
log
(
"onload"
);
var
uri
=
new
URI
(
window
.
location
);
var
uri
=
new
URI
(
window
.
location
);
$
(
'host'
).
value
=
uri
.
getData
(
"host"
)
||
''
;
$
(
'host'
).
value
=
uri
.
getData
(
"host"
)
||
''
;
$
(
'port'
).
value
=
uri
.
getData
(
"port"
)
||
''
;
$
(
'port'
).
value
=
uri
.
getData
(
"port"
)
||
''
;
...
...
vnc.js
View file @
b7ec5487
This diff is collapsed.
Click to expand it.
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