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
a8edf9d8
Commit
a8edf9d8
authored
Jul 22, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Query string cleanup and move it to util.js
parent
a7a89626
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
default_controls.js
include/default_controls.js
+4
-10
util.js
include/util.js
+9
-0
vnc_auto.html
vnc_auto.html
+8
-8
No files found.
include/default_controls.js
View file @
a8edf9d8
...
...
@@ -126,12 +126,6 @@ load: function(target) {
};
},
// Read a query string variable
getQueryVar
:
function
(
name
)
{
var
re
=
new
RegExp
(
'[?].*'
+
name
+
'=([^&#]*)'
);
return
(
document
.
location
.
href
.
match
(
re
)
||
[
''
,
null
])[
1
];
},
// Read form control compatible setting from cookie
getSetting
:
function
(
name
)
{
var
val
,
ctrl
=
$
(
'VNC_'
+
name
);
...
...
@@ -188,14 +182,14 @@ saveSetting: function(name) {
// Initial page load read/initialization of settings
initSetting
:
function
(
name
,
defVal
)
{
var
val
,
DC
=
DefaultControls
;
var
val
;
// Check Query string followed by cookie
val
=
DC
.
getQueryVar
(
name
);
val
=
Util
.
getQueryVar
(
name
);
if
(
val
===
null
)
{
val
=
Util
.
readCookie
(
name
,
defVal
);
}
D
C
.
updateSetting
(
name
,
val
);
D
efaultControls
.
updateSetting
(
name
,
val
);
Util
.
Debug
(
"Setting '"
+
name
+
"' initialized to '"
+
val
+
"'"
);
return
val
;
},
...
...
@@ -206,7 +200,7 @@ initSetting: function(name, defVal) {
// On close, settings are applied
clickSettingsMenu
:
function
()
{
var
DC
=
DefaultControls
;
if
(
D
efaultControls
.
settingsOpen
)
{
if
(
D
C
.
settingsOpen
)
{
DC
.
settingsApply
();
DC
.
closeSettingsMenu
();
...
...
include/util.js
View file @
a8edf9d8
...
...
@@ -160,6 +160,14 @@ Util.dirObj = function (obj, depth, parent) {
return
msg
;
};
// Read a query string variable
Util
.
getQueryVar
=
function
(
name
,
defVal
)
{
var
re
=
new
RegExp
(
'[?][^#]*'
+
name
+
'=([^&#]*)'
);
if
(
typeof
defVal
===
'undefined'
)
{
defVal
=
null
;
}
return
(
document
.
location
.
href
.
match
(
re
)
||
[
''
,
defVal
])[
1
];
};
/*
* Cross-browser routines
*/
...
...
@@ -264,6 +272,7 @@ 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
;
...
...
vnc_auto.html
View file @
a8edf9d8
...
...
@@ -40,6 +40,7 @@ Connect parameters are provided in query string:
}
function
sendCtrlAltDel
()
{
RFB
.
sendCtrlAltDel
();
return
false
;
}
function
updateState
(
state
,
msg
)
{
var
s
,
sb
,
klass
,
html
;
...
...
@@ -81,20 +82,19 @@ Connect parameters are provided in query string:
window
.
onload
=
function
()
{
var
host
,
port
,
password
;
url
=
document
.
location
.
href
;
host
=
(
url
.
match
(
/host=
([
A-Za-z0-9.
\-]
*
)
/
)
||
[
''
,
''
])[
1
];
port
=
(
url
.
match
(
/port=
([
0-9
]
*
)
/
)
||
[
''
,
''
])[
1
];
password
=
(
url
.
match
(
/password=
([^
&#
]
*
)
/
)
||
[
''
,
''
])[
1
];
host
=
Util
.
getQueryVar
(
'host'
,
null
);
port
=
Util
.
getQueryVar
(
'port'
,
null
);
password
=
Util
.
getQueryVar
(
'password'
,
''
);
if
((
!
host
)
||
(
!
port
))
{
updateState
(
'failed'
,
"Must specify host and port in URL"
);
return
;
}
RFB
.
setEncrypt
(
(
url
.
match
(
/encrypt=
([
A-Za-z0-9
]
*
)
/
)
||
[
''
,
1
])[
1
]
);
RFB
.
setBase64
(
(
url
.
match
(
/base64=
([
A-Za-z0-9
]
*
)
/
)
||
[
''
,
1
])[
1
]
);
RFB
.
setTrueColor
(
(
url
.
match
(
/true_color=
([
A-Za-z0-9
]
*
)
/
)
||
[
''
,
1
])[
1
]
);
RFB
.
setCursor
(
(
url
.
match
(
/cursor=
([
A-Za-z0-9
]
*
)
/
)
||
[
''
,
true
])[
1
]
);
RFB
.
setEncrypt
(
Util
.
getQueryVar
(
'encrypt'
,
true
)
);
RFB
.
setBase64
(
Util
.
getQueryVar
(
'base64'
,
true
)
);
RFB
.
setTrueColor
(
Util
.
getQueryVar
(
'true_color'
,
true
)
);
RFB
.
setCursor
(
Util
.
getQueryVar
(
'cursor'
,
true
)
);
RFB
.
setUpdateState
(
updateState
);
RFB
.
load
();
...
...
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