-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
103 lines (92 loc) · 3.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
94
95
96
97
98
99
100
101
102
103
<html>
<head>
<meta charset="utf-8" />
<title>Typhon Futé</title>
<script src="/js/base.js"></script>
<script src="/js/ajax.js"></script>
<script src="/js/marked.js"></script>
<script src="/js/models.js"></script>
<link href="http://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/list.css" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta http-equiv="refresh" content="900" />
</head>
<body>
<header>
<div class="wrapper">
<h1><img src="./images/logo.png" alt="Typhon Futé" /></h1>
<h2>Montpellier<span id="tendency"></span><span id="intensity">?</span></h2>
</div>
</header>
<main>
<div class="wrapper">
<section id="news"></section>
<section id="info">
<a href="#home" class="page"><</a>
<div class="content"></div>
</section>
</div>
</main>
<footer>
<a href="#info" class="page">Infos</a>
</footer>
<script>
(function(global) {
"use strict";
// System conf
var conf = {
debug: location.hash.indexOf('debug') >= 0,
publishedListId: "52e7cfd2f5f21b1b1033a646",
};
conf.url = conf.debug
? "/fixture.json"
: "https://api.trello.com/1/boards/52e7cfd2f5f21b1b1033a645/cards?key=11d0f0ce0e152c29b2fc61031c5fc229";
// Init Model object with conf.
Model.conf = conf;
// Rendering.
Model.news.all(function (cards) {
var newsItem, content, links;
cards.forEach(function (card) {
newsItem = document.createElement('article');
content = {
title: markdown(card.name),
body: markdown(card.desc)
};
newsItem.innerHTML = "<h1>{title}</h1>".replace('{title}',
content.title);
if (content.body) {
newsItem.innerHTML += "<p>{body}</p>".replace('{body}',
content.body);
newsItem.classList.add('expandable');
}
$$('#news').appendChild(newsItem);
// Click to select news article.
[].map.call($('#news article'), function (e) {
e.onclick = function () {
var current = $$('article.selected');
if(current) current.classList.remove('selected');
this.classList.add("selected");
}
});
});
});
Model.meta.get(function (data) {
$$('#tendency').innerHTML = data.tendency === 'down' ? "crue en baisse" : "crue en hausse";
$$('#intensity').innerHTML = data.intensity;
});
Model.info.get(function (data) {
$$('#info > .content').innerHTML = markdown(data.desc);
});
// Change page buttons.
[].map.call($('a.page'), function(a) {
a.onclick = function () {
var href = this.getAttribute('href');
if(href[0] === '#') href = href.substr(1);
$$('body').setAttribute('meta-page', href);
}
});
}(this));
</script>
</body>
</html>