Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
1ba2ccac
Commit
1ba2ccac
authored
15 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Add support for string parsing and the device control string "GET <URI>"
parent
1cb83df8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ZuulTerm/chrome/content/Term.js
+55
-9
55 additions, 9 deletions
src/ZuulTerm/chrome/content/Term.js
with
55 additions
and
9 deletions
src/ZuulTerm/chrome/content/Term.js
+
55
−
9
View file @
1ba2ccac
var
connection
=
null
;
var
currtext
=
''
;
var
stringsequence
=
{
storing
:
false
,
value
:
''
,
type
:
0
};
function
writeHTML
(
data
)
{
...
...
@@ -11,6 +12,8 @@ function writeHTML(data)
var
offe
;
currtext
+=
data
;
if
(
term
==
null
)
return
;
term
.
innerHTML
=
currtext
;
var
winVisible
=
win
.
innerHeight
-
win
.
scrollMaxY
;
...
...
@@ -52,13 +55,39 @@ function writeHTML(data)
function
writeText
(
data
)
{
data
=
data
.
replace
(
/&/g
,
'
&
'
);
data
=
data
.
replace
(
/</g
,
'
<
'
);
data
=
data
.
replace
(
/>/g
,
'
>
'
);
data
=
data
.
replace
(
/'/g
,
'
'
'
);
data
=
data
.
replace
(
/"/g
,
'
"
'
);
data
=
data
.
replace
(
/ /g
,
'
'
);
writeHTML
(
data
);
if
(
stringsequence
.
storing
)
{
stringsequence
.
value
+=
data
;
}
else
{
data
=
data
.
replace
(
/&/g
,
'
&
'
);
data
=
data
.
replace
(
/</g
,
'
<
'
);
data
=
data
.
replace
(
/>/g
,
'
>
'
);
data
=
data
.
replace
(
/'/g
,
'
'
'
);
data
=
data
.
replace
(
/"/g
,
'
"
'
);
data
=
data
.
replace
(
/ /g
,
'
'
);
writeHTML
(
data
);
}
}
function
handleString
(
obj
)
{
var
doc
=
document
.
getElementById
(
"
frame
"
).
contentDocument
;
var
term
=
doc
.
getElementById
(
"
terminal
"
);
var
win
=
document
.
getElementById
(
"
frame
"
).
contentWindow
;
var
tmp
;
switch
(
obj
.
type
)
{
case
'
\
x90
'
:
tmp
=
obj
.
value
.
match
(
/^
([^\s]
+
)
(
.*
)
/
);
if
(
tmp
!=
null
)
{
switch
(
tmp
[
1
])
{
case
'
GET
'
:
win
.
location
=
tmp
[
2
];
break
;
}
}
break
;
}
}
function
handleCtrl
(
byte
)
...
...
@@ -100,20 +129,37 @@ function handleCtrl(byte)
case
'
\
x85
'
:
// NEL (Next Line)
writeHTML
(
"
<br>
"
);
break
;
case
'
\
x98
'
:
// SOS (Start Of String)
case
'
\
x90
'
:
// DCS (Device Control String)
case
'
\
x9d
'
:
// OSC (Operating System Command)
case
'
\
x9e
'
:
// PM (Privacy Message)
case
'
\
x9f
'
:
// APC (Application Program Command)
stringsequence
.
storing
=
true
;
stringsequence
.
value
=
''
;
stringsequence
.
type
=
byte
;
break
;
case
'
\
x9c
'
:
// ST (String Terminator)
stringsequence
.
storing
=
false
;
handleString
(
stringsequence
);
break
;
}
}
function
UpdateTerm
(
data
)
{
var
val
;
while
(
data
.
length
)
{
data
=
data
.
replace
(
/^
([^\x
00-
\x
1F
\x
80-
\x
9f
]
*
)
/
,
function
(
matched
,
text
)
{
data
=
data
.
replace
(
/^
([^\x
00-
\x
1F
\x
80-
\x
9f
]
+
)
/
,
function
(
matched
,
text
)
{
writeText
(
text
);
return
''
;
});
if
(
data
.
length
)
{
while
(
data
.
charCodeAt
(
0
)
<
32
)
{
val
=
data
.
charCodeAt
(
0
);
while
(
val
<
32
||
(
val
>=
0x90
&&
val
<=
0x9f
))
{
handleCtrl
(
data
.
substr
(
0
,
1
));
data
=
data
.
substr
(
1
);
val
=
data
.
charCodeAt
(
0
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment