Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fdr2js
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner, Eric
fdr2js
Commits
3c9dc280
Commit
3c9dc280
authored
4 years ago
by
Eric
Browse files
Options
Downloads
Patches
Plain Diff
clean description update I
parent
de541340
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.html
+7
-2
7 additions, 2 deletions
index.html
index.js
+21
-5
21 additions, 5 deletions
index.js
with
28 additions
and
7 deletions
index.html
+
7
−
2
View file @
3c9dc280
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head><title>
TypeScript Dom Manipulation
</title></head>
<head>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
TypeScript Dom Manipulation
</title></head>
<body>
<body>
<div
id=
"app"
></div>
<div
id=
"app"
>
</div>
<!-- Assume index.js is the compiled output of index.ts -->
<!-- Assume index.js is the compiled output of index.ts -->
<script
src=
"index.js"
></script>
<script
src=
"index.js"
></script>
<script
type=
"module"
src=
"https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"
></script>
<script
type=
"module"
src=
"https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"
></script>
...
...
This diff is collapsed.
Click to expand it.
index.js
+
21
−
5
View file @
3c9dc280
// 1. Select the div element using the id property
// 1. Select the div element using the id property
const
app
=
document
.
getElementById
(
"
app
"
);
const
app
=
document
.
getElementById
(
"
app
"
);
const
viewer
=
document
.
createElement
(
"
div
"
);
viewer
.
setAttribute
(
"
width
"
,
"
500px
"
);
viewer
.
setAttribute
(
"
height
"
,
"
500px
"
);
// 2. Create a new <p></p> element programmatically
// 2. Create a new <p></p> element programmatically
const
description
=
document
.
createElement
(
"
p
"
);
const
description
=
document
.
createElement
(
"
ul
"
);
const
bucketpath
=
document
.
createElement
(
"
p
"
);
const
bucketpath
=
document
.
createElement
(
"
p
"
);
...
@@ -12,9 +16,22 @@ const userAction = async () => {
...
@@ -12,9 +16,22 @@ const userAction = async () => {
const
response
=
await
fetch
(
'
https://www.fdr.uni-hamburg.de/api/records/863
'
);
const
response
=
await
fetch
(
'
https://www.fdr.uni-hamburg.de/api/records/863
'
);
const
recordjson
=
await
response
.
json
();
const
recordjson
=
await
response
.
json
();
// read metadata from json response
// read metadata from json response
const
metadata
=
recordjson
.
metadata
;
const
metadata
=
recordjson
.
metadata
;
description
.
textContent
=
metadata
.
description
;
var
jsondescription
=
metadata
.
description
;
var
s
=
jsondescription
.
split
(
"
<p>
"
);
var
list
=
s
[
1
].
split
(
"
<br>
"
)
list
.
forEach
(
element
=>
{
var
listnode
=
document
.
createElement
(
"
li
"
);
var
listtext
=
document
.
createTextNode
(
element
.
replace
(
/
(
<
([^
>
]
+
)
>
)
/gi
,
""
));
listnode
.
appendChild
(
listtext
);
description
.
appendChild
(
listnode
)
})
// get bucket path from record json
// get bucket path from record json
...
@@ -27,15 +44,13 @@ const userAction = async () => {
...
@@ -27,15 +44,13 @@ const userAction = async () => {
{
{
if
(
element
.
key
.
includes
(
'
.glb
'
))
if
(
element
.
key
.
includes
(
'
.glb
'
))
{
{
console
.
log
(
element
.
key
);
const
filelink
=
element
.
links
.
self
;
const
filelink
=
element
.
links
.
self
;
console
.
log
(
filelink
);
const
modelviewer
=
document
.
createElement
(
"
model-viewer
"
);
const
modelviewer
=
document
.
createElement
(
"
model-viewer
"
);
modelviewer
.
setAttribute
(
"
src
"
,
filelink
);
modelviewer
.
setAttribute
(
"
src
"
,
filelink
);
modelviewer
.
setAttribute
(
"
auto-rotate
"
,
true
);
modelviewer
.
setAttribute
(
"
auto-rotate
"
,
true
);
modelviewer
.
setAttribute
(
"
camera-controls
"
,
true
);
modelviewer
.
setAttribute
(
"
camera-controls
"
,
true
);
app
?
.
appendChild
(
modelviewer
);
viewer
.
appendChild
(
modelviewer
);
}
}
});
});
...
@@ -45,3 +60,4 @@ const userAction = async () => {
...
@@ -45,3 +60,4 @@ const userAction = async () => {
// 4. Append the p element to the div element
// 4. Append the p element to the div element
app
?.
appendChild
(
description
);
app
?.
appendChild
(
description
);
app
?.
appendChild
(
viewer
);
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