-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
163 lines (159 loc) · 7.39 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="All elm news in one place">
<meta name="keywords" content="elm, elm lang, news">
<meta name="author" content="Jacob Oakes">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>elm news</title>
<script type="text/javascript">
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-79825426-1', 'auto');
</script>
<script type="text/javascript">
function getQueryVariable(queryString, variable) {
var vars = queryString.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (pair[0] == variable) {
return pair[1];
}
}
return '';
}
/////////////////////////////////////////////////////////////////////////
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
// ----------------------------------------------------------------------
// This script checks to see if a redirect is present in the query string
// and converts it back into the correct url and adds it to the
// browser's history using window.history.replaceState(...),
// which won't cause the browser to attempt to load the new url.
// When the single page app is loaded further down in this file,
// the correct url will be waiting in the browser's history for
// the single page app to route accordingly.
/////////////////////////////////////////////////////////////////////////
(function(l) {
if (l.search) {
var q = {};
l.search.slice(1).split('&').forEach(function(v) {
var a = v.split('=');
q[a[0]] = a.slice(1).join('=').replace(/~and~/g, '&');
});
if (q.p !== undefined) {
if (q.p == '/redirect') {
var url = decodeURIComponent(getQueryVariable(q.q, 'url'));
var label = getQueryVariable(q.q, 'label') || 'unknown';
if (ga) {
ga('send', 'event', 'email', url, label);
}
window.location.replace(url);
} else {
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + (q.p || '') +
(q.q ? ('?' + q.q) : '') +
l.hash
);
}
}
}
}(window.location))
</script>
<script src="https://storage.googleapis.com/feednami-static/js/feednami-client-v1.0.1.js"></script>
<script src="/main.js"></script>
<link rel="stylesheet" type="text/css" href="/main.css" />
<link rel="apple-touch-icon" sizes="57x57" href="/assets/images/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/assets/images/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/assets/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/assets/images/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/assets/images/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/assets/images/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/assets/images/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/assets/images/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/assets/images/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/assets/images/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/assets/images/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/assets/images/manifest.json">
<link rel="mask-icon" href="/assets/images/safari-pinned-tab.svg" color="#5a6378">
<link rel="shortcut icon" href="/assets/images/favicon.ico">
<meta name="apple-mobile-web-app-title" content="elm news">
<meta name="application-name" content="elm news">
<meta name="msapplication-TileColor" content="#5a6378">
<meta name="msapplication-TileImage" content="/assets/images/mstile-144x144.png">
<meta name="msapplication-config" content="/assets/images/browserconfig.xml">
<meta name="theme-color" content="#5a6378">
</head>
<body class="page"> </body>
<script type="text/javascript">
var app = Elm.Main.fullscreen();
app.ports.registerEvent.subscribe(function(event) {
ga('send',
'event',
event.category,
event.action,
event.label, {
'transport': 'beacon',
'dimension1': event.title,
'dimension2': event.tag,
'dimension3': event.author,
});
});
app.ports.scrollIntoView.subscribe(function(id) {
// setTimeout is used to allow time for things to finish rendering
setTimeout(function() {
document.getElementById(id).scrollIntoView();
}, 100)
});
app.ports.pageView.subscribe(function(page) {
ga('set', 'page', page);
ga('send', 'pageview');
});
app.ports.fetchGoogleGroupMsgs.subscribe(function(tag) {
// 100 messages is the max that you can get from the rss feed
var url = 'https://discourse.elm-lang.org/latest.rss';
feednami.load(url, function(result) {
if (result.error) {
var error = {
tag: tag,
error: result.error.message
}
app.ports.errorGoogleGroupMsgs.send(error);
} else {
var entries = result.feed.entries
var stories = []
for (var i = 0; i < entries.length; i++) {
var entry = entries[i]
var story = {
author: entry.author,
title: entry.title,
date: entry.date_ms,
url: entry.link,
tag: tag,
};
stories.push(story);
}
var resp = {
stories: stories,
tag: tag
}
app.ports.fetchedGoogleGroupMsgs.send(resp);
}
})
});
</script>
</html>