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
23e3a4c8
Commit
23e3a4c8
authored
16 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
generic ASCII horizontal or vertical scrollbar feature...very handy
parent
c94e1840
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
exec/load/scrollbar.js
+75
-0
75 additions, 0 deletions
exec/load/scrollbar.js
with
75 additions
and
0 deletions
exec/load/scrollbar.js
0 → 100644
+
75
−
0
View file @
23e3a4c8
/*
generic scrollbar for Synchronet
3/24/2009 - Matt Johnson (MCMLXXIX)
*/
function
Scrollbar
(
firstx
,
firsty
,
lastx
,
lasty
,
color
)
{
this
.
first
;
this
.
last
;
this
.
orientation
;
this
.
color
=
color
?
color
:
'
\
1n
'
;
this
.
init
=
function
(
fx
,
fy
,
lx
,
ly
)
{
this
.
first
=
{
'
x
'
:
fx
,
'
y
'
:
fy
};
this
.
last
=
{
'
x
'
:
lx
,
'
y
'
:
ly
};
if
(
fx
==
lx
)
this
.
orientation
=
1
;
else
if
(
fy
==
ly
)
this
.
orientation
=
0
;
else
exit
();
//if scrollbar orientation is not vertical or horizontal do not continue
}
this
.
draw
=
function
(
position
,
total
)
{
if
(
!
this
.
first
||
!
this
.
last
)
return
;
//if no start or end points initialized, do not draw
if
(
!
position
||
position
>
total
)
{
return
;
//if position is invalid, do not draw
}
var
percentage
=
position
/
total
;
if
(
this
.
orientation
==
1
)
this
.
drawVert
(
percentage
);
else
this
.
drawHoriz
(
percentage
);
}
this
.
drawVert
=
function
(
percentage
)
{
var
length
=
this
.
last
.
y
-
this
.
first
.
y
-
1
;
if
(
length
==
0
)
return
;
//who needs a zero length scrollbar?
var
index
=
parseInt
(
percentage
*
length
);
console
.
gotoxy
(
this
.
first
.
x
,
this
.
first
.
y
);
console
.
putmsg
(
this
.
color
+
"
\
1h
"
+
ascii
(
30
));
for
(
i
=
1
;
i
<=
length
;
i
++
)
{
console
.
down
();
console
.
left
();
if
(
i
==
index
)
console
.
putmsg
(
this
.
color
+
'
\
1h
\
xDB
'
);
else
console
.
putmsg
(
'
\
1n
'
+
this
.
color
+
'
\
xB0
'
);
}
console
.
down
();
console
.
left
();
console
.
putmsg
(
this
.
color
+
"
\
1h
"
+
ascii
(
31
));
}
this
.
drawHoriz
=
function
(
percentage
)
{
var
length
=
this
.
last
.
x
-
this
.
first
.
x
-
1
;
if
(
length
==
0
)
return
;
//who needs a zero length scrollbar?
var
index
=
parseInt
(
percentage
*
length
);
console
.
gotoxy
(
this
.
first
.
x
,
this
.
first
.
y
);
console
.
putmsg
(
this
.
color
+
"
\
1h
"
+
ascii
(
17
));
for
(
i
=
1
;
i
<=
length
;
i
++
)
{
if
(
i
==
index
)
console
.
putmsg
(
this
.
color
+
'
\
1h
\
xDB
'
);
else
console
.
putmsg
(
'
\
1n
'
+
this
.
color
+
'
\
xB0
'
);
}
console
.
putmsg
(
this
.
color
+
"
\
1h
"
+
ascii
(
16
));
}
if
(
firstx
&&
firsty
&&
lastx
&&
lasty
)
{
this
.
init
(
firstx
,
firsty
,
lastx
,
lasty
);
}
}
\ No newline at end of file
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