Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
a34bb29f
Commit
a34bb29f
authored
3 years ago
by
Stahl, Merle
Browse files
Options
Downloads
Patches
Plain Diff
Code aufgeräumt
parent
3eab582d
No related branches found
No related tags found
1 merge request
!29
Main
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
assets/cn_default.js
+21
-25
21 additions, 25 deletions
assets/cn_default.js
assets/cn_timeline.js
+26
-32
26 additions, 32 deletions
assets/cn_timeline.js
assets/index.html
+8
-7
8 additions, 7 deletions
assets/index.html
assets/json_text.json
+840
-1
840 additions, 1 deletion
assets/json_text.json
with
895 additions
and
65 deletions
assets/cn_default.js
+
21
−
25
View file @
a34bb29f
...
...
@@ -125,7 +125,8 @@ var simulation = d3.forceSimulation()
}).
strength
(
0.5
))
.
force
(
"
charge
"
,
d3
.
forceManyBody
().
strength
(
0.001
))
.
force
(
"
center
"
,
d3
.
forceCenter
(
width
/
2
-
20
,
height
/
2
+
20
))
.
force
(
"
yscale
"
,
d3
.
forceY
().
strength
(
function
(
d
)
{
.
force
(
"
yscale
"
,
d3
.
forceY
()
.
strength
(
function
(
d
)
{
if
(
d
.
group
==
"
Input
"
)
{
return
300
;}
else
{
return
200
;}
}).
y
(
function
(
d
)
{
return
y_scale
(
d
.
group
)}))
...
...
@@ -154,7 +155,7 @@ function failure(graph) {
* checks at a fixed interval whether the contents of the JSON file have changed
and reloads the program if necessary
*/
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
500
0
)
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
500
)
function
check_if_json_changed
()
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
newjson_string
=
JSON
.
stringify
(
graph
)
...
...
@@ -177,8 +178,7 @@ function update(links, nodes) {
update_links
(
links
);
update_nodes
(
nodes
);
simulation
.
nodes
(
nodes
)
simulation
.
nodes
(
nodes
)
.
on
(
"
tick
"
,
handle_tick
);
simulation
.
force
(
"
link
"
)
.
links
(
links
);
...
...
@@ -513,7 +513,8 @@ function get_svg_string(svgNode) {
try
{
if
(
!
s
.
cssRules
)
continue
;
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
e
.
name
!==
'
SecurityError
'
)
throw
e
;
// for Firefox
continue
;
}
...
...
@@ -524,14 +525,11 @@ function get_svg_string(svgNode) {
extractedCSSText
+=
cssRules
[
r
].
cssText
;
}
}
return
extractedCSSText
;
function
contains
(
str
,
arr
)
{
return
arr
.
indexOf
(
str
)
===
-
1
?
false
:
true
;
}
}
function
append_css
(
cssText
,
element
)
{
...
...
@@ -571,8 +569,6 @@ function svg_string_to_image( svgString, width, height, format, callback ) {
var
filesize
=
Math
.
round
(
blob
.
length
/
1024
)
+
'
KB
'
;
if
(
callback
)
callback
(
blob
,
filesize
);
});
};
image
.
src
=
imgsrc
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
assets/cn_timeline.js
+
26
−
32
View file @
a34bb29f
...
...
@@ -171,7 +171,7 @@ function failure(graph) {
* checks at a fixed interval whether the contents of the JSON file have changed
and reloads the program if necessary
*/
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
500
0
)
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
500
)
function
check_if_json_changed
()
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
newjson_string
=
JSON
.
stringify
(
graph
)
...
...
@@ -195,8 +195,7 @@ function update(links, nodes) {
update_links
(
links
);
update_nodes
(
nodes
);
simulation
.
nodes
(
nodes
)
simulation
.
nodes
(
nodes
)
.
on
(
"
tick
"
,
handle_tick
);
simulation
.
force
(
"
link
"
)
.
links
(
links
);
...
...
@@ -298,7 +297,6 @@ function update_marker(color, target) {
* @param {object} node - node
*/
function
click_node
(
node
)
{
d3
.
select
(
this
.
parentNode
).
raise
();
fix_nodes
(
node
);
if
(
to_remove
){
...
...
@@ -550,7 +548,8 @@ function get_svg_string(svgNode) {
try
{
if
(
!
s
.
cssRules
)
continue
;
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
e
.
name
!==
'
SecurityError
'
)
throw
e
;
// for Firefox
continue
;
}
...
...
@@ -561,14 +560,11 @@ function get_svg_string(svgNode) {
extractedCSSText
+=
cssRules
[
r
].
cssText
;
}
}
return
extractedCSSText
;
function
contains
(
str
,
arr
)
{
return
arr
.
indexOf
(
str
)
===
-
1
?
false
:
true
;
}
}
function
append_css
(
cssText
,
element
)
{
...
...
@@ -608,8 +604,6 @@ function svg_string_to_image( svgString, width, height, format, callback ) {
var
filesize
=
Math
.
round
(
blob
.
length
/
1024
)
+
'
KB
'
;
if
(
callback
)
callback
(
blob
,
filesize
);
});
};
image
.
src
=
imgsrc
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
assets/index.html
+
8
−
7
View file @
a34bb29f
...
...
@@ -88,9 +88,7 @@
</head>
<body>
<button
id=
"change_graph"
class=
"display"
onclick=
"display()"
>
Display Timeline
</button>
<!-- graph 576-->
<!-- graph -->
<svg
class=
"graph"
width=
"680"
height=
"560"
></svg>
<p
id=
"oldjson"
></p>
...
...
@@ -103,6 +101,7 @@
<button
id=
"abstract"
class=
"abstract"
onclick=
'display_abstract(true), highlight_button("abstract")'
>
Abstract
</button>
<!-- buttons -->
<button
id=
"change_graph"
class=
"display"
onclick=
"display()"
>
Display Timeline
</button>
<button
onclick=
"location.reload()"
>
Reload Graph
</button>
<button
class=
"resetZoom"
onclick=
"reset_view()"
>
Reset View
</button>
<button
class=
"save"
onclick=
"save_svg()"
>
Save
</button>
...
...
@@ -114,9 +113,11 @@
<script
src=
"https://cdn.rawgit.com/eligrey/canvas-toBlob.js/f1a01896135ab378aa5c0118eadd81da55e698d8/canvas-toBlob.js"
></script>
<script
src=
"https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js"
></script>
<!-- scripts to convert the content of a file into a hash value -->
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/core.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"
></script>
<!-- script to switch between default version and timeline version -->
<script
type=
"text/javascript"
>
if
(
window
.
location
.
hash
==
'
#default
'
)
{
document
.
getElementById
(
"
change_graph
"
).
innerHTML
=
'
Display Timeline
'
;
...
...
This diff is collapsed.
Click to expand it.
assets/json_text.json
+
840
−
1
View file @
a34bb29f
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