-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.html
83 lines (79 loc) · 3.01 KB
/
list.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
<!DOCTYPE html>
<html class="mdc-typography">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Zeus Flight Deals</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.teal-indigo.min.css" />
<style>
.zeus-align-center {
justify-content: center;
}
.zeus-logo {
color: #ff5;
display: block;
font-size: 80px;
padding: 20px 0 0;
text-shadow: 0 3px 5px #bbb;
}
.mdl-list__item--three-line,
.mdl-list__item--three-line .mdl-list__item-text-body,
.mdl-list__item--three-line .mdl-list__item-primary-content {
height: auto;
}
</style>
</head>
<body>
<div class="mdl-grid zeus-align-center">
<div class="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--middle mdl-cell--8-col mdl-typography--text-center">
<i class="material-icons zeus-logo">flash_on</i>
<div class="mdl-card__title mdl-card--expand zeus-align-center">
<h2 class="mdl-card__title-text">Zeus: Past Deals</h2>
</div>
<div class="mdl-card__supporting-text mdl-typography--text-left" style="margin:0 auto">
<ul class="demo-list-three mdl-list"></ul>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect zeus-action--load-more" disabled>Load more</button>
</div>
</div>
</div>
<p class="mdl-typography--text-center"><a href="https://docs.google.com/forms/d/18PsuepzGdCdzjQV2GHbVdSlOesv8e0qQlonmtTmad2k">Send feedback</a></p>
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<script>
const data = {{DATA}};
const container = document.querySelector('ul');
const fragment = document.createDocumentFragment();
data.map(entry => {
entry.date = new Date(entry.date);
return entry;
}).reduce((save, { date, url, title }) => {
const group = `${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;
const index = save.indexOf(group);
if (~index) {
save.splice(save.length, 0, { url, title });
} else {
save.splice(index, 0, group, { url, title });
}
return save;
}, []).forEach(entry => {
if (typeof entry === 'string') {
const item = document.createElement('li');
item.className = 'mdl-list__item mdl-list__item--three-line';
item.innerHTML = `
<!-- <span class="mdl-list__item-secondary-content"></span> -->
<span class="mdl-list__item-primary-content">
<span class="mdl-list__item-text-body">${entry}</span>
</span>
`;
fragment.appendChild(item);
} else {
fragment.querySelector('li:last-child .mdl-list__item-primary-content').innerHTML +=
`<span style="display: block;margin:0 0 10px;"><a rel="noreferrer" href="${entry.url}" target="_blank">${entry.title}</a></span>`;
}
});
container.appendChild(fragment);
</script>
</body>
</html>