-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
93 lines (83 loc) · 2.45 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
<title></title>
<link href="event.css" rel="stylesheet" />
</head>
<body>
<div id="Event" >
<div id="EventTitle"> Place Name of Event here !</div>
<div id="EventPlace"> Place Place of Event here !</div>
<div id="EventDate"> Place Date of Event here !</div>
</div>
<div id="App"></div>
</body>
<script src="event.js"></script>
<script>
function createActivity(obj){
// Activity
activity=document.createElement("div")
activity.classList.add('activity')
// timetag
timetag=document.createElement("div")
timetag.classList.add('timetag')
// hour
hour=document.createElement("div")
hour.innerText=obj.hour
hour.classList.add('hour')
// tags
tags=document.createElement("div")
tags.classList.add('tags')
obj.tags.forEach( x => {
tag = document.createElement("span")
tag.innerText=x
tags.appendChild(tag)
});
timetag.appendChild(hour)
timetag.appendChild(tags)
// Detail
detail=document.createElement("div")
detail.classList.add('detail')
// Title
title=document.createElement("div")
title.innerText=obj.title
title.classList.add('title')
detail.appendChild(title)
// Speaker
speaker=document.createElement("div")
speaker.innerText=obj.speaker
speaker.classList.add('speaker')
detail.appendChild(speaker)
activity.appendChild(timetag)
activity.appendChild(detail)
document.getElementById("App").appendChild(activity)
}
function compareByHours(a, b) {
let hoursA = parseHours(a.hour);
let hoursB = parseHours(b.hour);
return hoursA - hoursB;
}
// Helper function to parse hours from a string
function parseHours(timeString) {
let timeParts = timeString.split(':');
let hours = parseInt(timeParts[0], 10);
let minutes = parseInt(timeParts[1], 10);
if (timeParts[1].toLowerCase().indexOf("pm") > 0)
if (hours != 12)
hours = hours + 12
return hours + minutes / 60; // Convert minutes to fractional hours
}
document.addEventListener("DOMContentLoaded", function(){
document.getElementById("EventTitle").innerText = EventTitle;
document.getElementById("EventDate").innerText = EventDate;
document.getElementById("EventPlace").innerText = EventPlace;
activities.sort(compareByHours);
activities.forEach(x=>createActivity(x));
}
)
</script>
</html>