Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PAnTHer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
puma
client
PAnTHer
Commits
298c9831
Commit
298c9831
authored
3 months ago
by
Lucio Zambon
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
5fd19848
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
door2d.js
+79
-0
79 additions, 0 deletions
door2d.js
with
79 additions
and
0 deletions
door2d.js
0 → 100644
+
79
−
0
View file @
298c9831
// jshint esversion: 6
const
doorNaming
=
{};
let
doorInterval
=
false
;
function
doorInit
()
{
fetch
((
conf
.
doorSrcUrl
+
'
&machine=
'
+
machine
).
replace
(
'
?&
'
,
'
?
'
),
{
cache
:
"
no-store
"
})
.
then
((
response
)
=>
{
return
response
.
json
();})
.
then
((
doorList
)
=>
{
for
(
let
facility
in
doorList
)
{
doorNaming
[
facility
]
=
[];
for
(
let
d
=
0
;
d
<
doorList
[
facility
].
length
;
d
++
)
{
if
(
doorNaming
[
facility
][
d
]
==
""
)
continue
;
doorNaming
[
facility
][
d
]
=
doorList
[
facility
][
d
];
const
id
=
doorNaming
[
facility
][
d
].
replace
(
'
.
'
,
'
_
'
);
$
(
'
#
'
+
id
).
css
(
'
fill
'
,
'
gray
'
);
$
(
'
#
'
+
id
).
css
(
'
stroke
'
,
'
gray
'
);
// console.log('doorNaming', facility, doorNaming[facility], d, id);
}
}
doorInterval
=
setInterval
(
doorRead
,
1000
);
});
}
function
doorMenu
(
menuParams
)
{
// console.log('doorMenu', menuParams, (conf.doorSrcUrl+'&machine='+machine).replace('?&','?'));
menuParams
.
door
=
document
.
location
.
search
.
indexOf
(
'
door
'
)
>-
1
;
gui
.
add
(
menuParams
,
'
door
'
).
name
(
'
doors
'
).
onChange
(
function
()
{
doorSwitch
(
menuParams
);});
if
(
menuParams
.
door
)
{
doorInit
();
}
}
function
door2d
(
lattice
,
menuParams
)
{
console
.
log
(
'
door2d
'
,
lattice
,
menuParams
);
$
(
'
.doorpss
'
).
css
(
'
fill
'
,
'
gray
'
);
$
(
'
.doorpss
'
).
css
(
'
stroke
'
,
'
gray
'
);
doorMenu
(
menuParams
);
}
function
doorSwitch
(
menuParams
)
{
console
.
log
(
'
doorSwitch()
'
,
menuParams
,
menuParams
.
door
);
if
(
doorInterval
!==
false
)
{
clearInterval
(
doorInterval
);
}
doorInterval
=
false
;
if
(
menuParams
.
door
==
false
)
{
for
(
let
facility
in
doorNaming
)
{
for
(
let
d
=
0
;
d
<
doorNaming
[
facility
].
length
;
d
++
)
{
const
id
=
doorNaming
[
facility
][
d
].
replace
(
'
.
'
,
'
_
'
);
$
(
'
#
'
+
id
).
css
(
'
fill
'
,
'
gray
'
);
$
(
'
#
'
+
id
).
css
(
'
stroke
'
,
'
gray
'
);
// console.log('doorNaming', facility, doorNaming[facility], d, id);
}
}
}
else
{
if
(
$
.
isEmptyObject
(
doorNaming
))
doorInit
();
else
{
doorRead
();
doorInterval
=
setInterval
(
doorRead
,
1000
);
}
}
}
function
doorRender
(
val
)
{
for
(
let
facility
in
val
)
{
for
(
let
d
=
0
;
d
<
val
[
facility
].
door
.
length
;
d
++
)
{
if
(
typeof
doorNaming
[
facility
][
d
]
==
'
undefined
'
)
continue
;
const
id
=
doorNaming
[
facility
][
d
].
replace
(
'
.
'
,
'
_
'
);
$
(
'
#
'
+
id
).
css
(
'
fill
'
,
val
[
facility
].
door
[
d
]
!=
1
?
'
#00000000
'
:
(
val
[
facility
].
hold
[
d
]
==
1
!=
facility
==
'
sr
'
?
'
yellow
'
:
'
white
'
));
$
(
'
#
'
+
id
).
css
(
'
stroke
'
,
val
[
facility
].
door
[
d
]
!=
1
?
'
red
'
:
'
#00000000
'
);
// console.log('doorNaming', facility, doorNaming[facility], d, id);
}
}
}
function
doorRead
()
{
fetch
((
conf
.
doorUrl
+
'
&machine=
'
+
machine
).
replace
(
'
?&
'
,
'
?
'
),
{
cache
:
"
no-store
"
})
.
then
((
response
)
=>
{
return
response
.
json
();})
.
then
((
eventData
)
=>
{
// console.log('fetch()',(conf.doorUrl+'&machine='+machine).replace('?&','?'), eventData);
doorRender
(
eventData
);
});
}
This diff is collapsed.
Click to expand it.
Preview
0%
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