Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IIKG1002_IDG1011
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Øivind Kolloen
IIKG1002_IDG1011
Commits
9e5ca338
Commit
9e5ca338
authored
Feb 6, 2020
by
Øivind Kolloen
Browse files
Options
Downloads
Patches
Plain Diff
Added starting point for JavaScript in HTML
parent
52ab9a09
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
lecture/JavaScript i HTML/side2.html
+26
-0
26 additions, 0 deletions
lecture/JavaScript i HTML/side2.html
lecture/JavaScript i HTML/tvguide.html
+108
-0
108 additions, 0 deletions
lecture/JavaScript i HTML/tvguide.html
with
134 additions
and
0 deletions
lecture/JavaScript i HTML/side2.html
0 → 100644
+
26
−
0
View file @
9e5ca338
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
Mitt flotte dokument
</title>
<style>
textarea
{
height
:
7em
;
width
:
15em
;
}
</style>
</head>
<body>
<h1>
Overskrift i dokumentet
</h1>
<p>
Lorum ipsum
</p>
<ul>
<li><a
href=
"index.html"
>
Forside
</a></li>
<li><a
href=
""
>
Side 2
</a></li>
<li><a
href=
""
>
Side 3
</a></li>
<li><a
href=
""
>
Side 4
</a></li>
<li><a
href=
""
>
Side 5
</a></li>
</ul>
</body>
</html>
This diff is collapsed.
Click to expand it.
lecture/JavaScript i HTML/tvguide.html
0 → 100644
+
108
−
0
View file @
9e5ca338
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
Document
</title>
<style>
.schedule
{
display
:
flex
;
flex-wrap
:
wrap
;
min-width
:
500px
;
max-width
:
1060px
;
margin
:
0
auto
;
}
.schedule
>
div
{
height
:
20em
;
width
:
15em
;
overflow-y
:
auto
;
padding-left
:
1em
;
box-shadow
:
3px
3px
14px
-4px
rgba
(
0
,
0
,
0
,
0.75
);
margin
:
4px
;
}
.schedule
details
{
display
:
inline-block
;
vertical-align
:
text-top
;
}
.schedule
summary
{
display
:
inline-block
;
width
:
10em
;
margin-left
:
-1em
;
width
:
11em
;
}
.schedule
summary
:hover
{
font-weight
:
bold
;
}
.schedule
summary
:focus
{
outline
:
none
;
}
.schedule
summary
::-webkit-details-marker
{
background
:
none
;
color
:
transparent
;
}
.schedule
details
div
{
display
:
inline-block
;
width
:
10.5em
;
}
/* scrollbar */
.schedule
::-webkit-scrollbar
{
width
:
2px
;
}
/* Track */
.schedule
::-webkit-scrollbar-track
{
background
:
#f1f1f1
;
}
/* Handle */
.schedule
::-webkit-scrollbar-thumb
{
background
:
#888
;
}
/* Handle on hover */
.schedule
::-webkit-scrollbar-thumb:hover
{
background
:
#555
;
}
</style>
</head>
<body>
<div
class=
"schedule"
>
<script>
fetch
(
"
http://folk.ntnu.no/oeivindk/tvguide.php?date=20190118
"
)
// NB, oppdater dato til dagens dato
.
then
(
data
=>
data
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
let
schedule
=
document
.
querySelector
(
'
.schedule
'
);
json
.
channels
.
forEach
(
channel
=>
{
let
div
=
document
.
createElement
(
'
DIV
'
);
// Hver kanal listes i en div
div
.
innerHTML
=
`<h2>
${
channel
.
title
}
</h2>`
;
channel
.
schedule
.
forEach
(
program
=>
{
let
now
=
new
Date
();
let
end
=
new
Date
(
program
.
end
);
if
(
end
>
now
)
{
// List kun programmer som enda ikke er ferdige
let
programInfo
=
document
.
createElement
(
'
DIV
'
);
// Hvert program legges inn i en div
let
startTime
=
new
Date
(
program
.
start
);
// Timer og minutter har kun et siffer dersom de er
<
10
,
legg
til
0
først
for
bedre
formatering
.
let
hours
=
(
startTime
.
getHours
()
+
""
).
padStart
(
2
,
"
0
"
);
let
minutes
=
(
startTime
.
getMinutes
()
+
""
).
padStart
(
2
,
"
0
"
);
programInfo
.
innerHTML
=
`<span>
${
hours
}
:
${
minutes
}
</span> <details><summary>
${
program
.
title
}
</summary><div>
${
program
.
desc
}
</div></details>`
;
div
.
appendChild
(
programInfo
);
}
});
// forEach schedule
schedule
.
appendChild
(
div
);
});
// forEach channels
});
// fetch
</script>
</div>
</body>
</html>
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