Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
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
Service Desk
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
alg
Knowledge Space WP Plugin
Commits
0402eea6
Commit
0402eea6
authored
3 years ago
by
y0083088
Browse files
Options
Downloads
Patches
Plain Diff
Added Tablist of links in InfoOverlay
parent
79b29141
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
graph.js
+75
-0
75 additions, 0 deletions
graph.js
kg-style.css
+28
-1
28 additions, 1 deletion
kg-style.css
with
103 additions
and
1 deletion
graph.js
+
75
−
0
View file @
0402eea6
...
@@ -153,6 +153,39 @@ function createInfoOverlay() {
...
@@ -153,6 +153,39 @@ function createInfoOverlay() {
description
.
innerText
=
'
Default Text
'
;
description
.
innerText
=
'
Default Text
'
;
textArea
.
appendChild
(
description
);
textArea
.
appendChild
(
description
);
const
link_container
=
document
.
createElement
(
'
div
'
);
const
links
=
document
.
createElement
(
'
div
'
);
const
linkClasses
=
getLinkClasses
();
link_container
.
id
=
'
link_container
'
;
links
.
className
=
'
tab
'
;
links
.
id
=
'
links
'
;
for
(
i
=
0
;
i
<
linkClasses
.
length
;
i
++
){
const
linkType
=
linkClasses
[
i
];
const
tablink
=
document
.
createElement
(
'
button
'
);
tablink
.
className
=
'
tablinks
'
;
tablink
.
id
=
linkType
+
"
_id
"
;
tablink
.
innerHTML
=
linkType
[
0
]
+
linkType
[
1
]
+
linkType
[
2
];
tablink
.
style
=
"
background-color:
"
+
edgeColors
[
linkClasses
[
i
]];
tablink
.
setAttribute
(
"
onclick
"
,
"
openTab(event,
"
+
linkType
+
"
_id)
"
);
//unusual function call
links
.
appendChild
(
tablink
);
}
link_container
.
appendChild
(
links
);
linkClasses
.
forEach
(
linkType
=>
{
const
tabcontent
=
document
.
createElement
(
'
div
'
);
tabcontent
.
className
=
'
tabcontent
'
;
tabcontent
.
id
=
linkType
+
"
_id_content
"
;
link_container
.
appendChild
(
tabcontent
);
})
overlayNode
.
appendChild
(
link_container
);
jQuery
(
'
#infoOverlayCloseButton
'
).
click
(
function
()
{
jQuery
(
'
#infoOverlayCloseButton
'
).
click
(
function
()
{
jQuery
(
'
#infoOverlay
'
).
slideUp
(
'
fast
'
);
jQuery
(
'
#infoOverlay
'
).
slideUp
(
'
fast
'
);
...
@@ -270,6 +303,31 @@ function updateInfoOverlay(node) {
...
@@ -270,6 +303,31 @@ function updateInfoOverlay(node) {
jQuery
(
'
#infoOverlayDescription
'
).
text
(
'
Default Text
'
);
jQuery
(
'
#infoOverlayDescription
'
).
text
(
'
Default Text
'
);
}
}
//tabs of the links to other nodes:
//delete old nodes from tabcontent
tabcontent
=
document
.
getElementsByClassName
(
"
tabcontent
"
);
for
(
i
=
0
;
i
<
tabcontent
.
length
;
i
++
)
{
childs
=
tabcontent
[
i
].
children
;
for
(
j
=
0
;
j
<
childs
.
length
;
j
++
)
{
tabcontent
[
i
].
removeChild
(
childs
[
j
]);
}
}
//add new nodes to tabcontent
for
(
i
=
0
;
i
<
tabcontent
.
length
;
i
++
)
{
//for every type of link
node
.
links
.
forEach
(
link
=>
{
//and for every link
if
(
link
.
type
+
'
_id_content
'
==
tabcontent
[
i
].
id
){
//is checked if the type is equal
const
linkButton
=
document
.
createElement
(
'
button
'
);
//and if so a new element is created
if
(
link
.
source
==
node
){
linkButton
.
innerHTML
=
link
.
target
.
id
;
}
if
(
link
.
target
==
node
){
linkButton
.
innerHTML
=
link
.
source
.
id
;
}
//linkButton.setAttribute("onclick", "focusOnNode(" + linkButton.node + ")"); //TODO: make it so that the node is the parameter.
tabcontent
[
i
].
appendChild
(
linkButton
);
//and added
}
});
}
jQuery
(
'
#infoOverlay
'
).
slideDown
(
'
fast
'
);
jQuery
(
'
#infoOverlay
'
).
slideDown
(
'
fast
'
);
}
}
...
@@ -334,6 +392,23 @@ function updateHighlight() {
...
@@ -334,6 +392,23 @@ function updateHighlight() {
.
linkDirectionalParticles
(
Graph
.
linkDirectionalParticles
());
.
linkDirectionalParticles
(
Graph
.
linkDirectionalParticles
());
}
}
//is used in createInfoOverlay, as an unusual function call to open link-tabs
function
openTab
(
event
,
tab
)
{
var
i
,
tabcontent
,
tablinks
;
// Get all elements with class="tabcontent" and hide them
tabcontent
=
document
.
getElementsByClassName
(
"
tabcontent
"
);
for
(
i
=
0
;
i
<
tabcontent
.
length
;
i
++
)
{
tabcontent
[
i
].
style
.
display
=
"
none
"
;
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks
=
document
.
getElementsByClassName
(
"
tablinks
"
);
for
(
i
=
0
;
i
<
tablinks
.
length
;
i
++
)
{
tablinks
[
i
].
className
=
tablinks
[
i
].
className
.
replace
(
"
active
"
,
""
);
}
// Show the current tab, and add an "active" class to the button that opened the tab
document
.
getElementById
(
tab
.
id
+
"
_content
"
).
style
.
display
=
"
block
"
;
event
.
currentTarget
.
className
+=
"
active
"
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
kg-style.css
+
28
−
1
View file @
0402eea6
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
width
:
350px
;
width
:
350px
;
max-width
:
400px
;
max-width
:
400px
;
padding
:
10px
;
padding
:
10px
;
left
:
0
px
;
left
:
0
;
display
:
block
;
display
:
block
;
background-color
:
rgba
(
0
,
0
,
0
,
.6
);
background-color
:
rgba
(
0
,
0
,
0
,
.6
);
}
}
...
@@ -99,4 +99,31 @@
...
@@ -99,4 +99,31 @@
display
:
block
;
display
:
block
;
height
:
2px
;
height
:
2px
;
width
:
78px
;
width
:
78px
;
}
.tab
{
overflow
:
hidden
;
border
:
1px
solid
#ccc
;
background-color
:
#f1f1f1
;
}
.tab
button
{
background-color
:
inherit
;
float
:
left
;
border
:
none
;
outline
:
none
;
cursor
:
pointer
;
padding
:
14px
16px
;
transition
:
0.3s
;
}
.tab
button
:hover
{
background-color
:
#ddd
;
}
.tab
button
.active
{
background-color
:
#ccc
;
}
.tabcontent
{
display
:
none
;
padding
:
6px
12px
;
border
:
1px
solid
#ccc
;
border-top
:
none
;
}
}
\ 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