forked from cheeaun/hackerweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
187 lines (173 loc) · 7.29 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html manifest="manifest.appcache">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HackerWeb</title>
<meta name="apple-mobile-web-app-title" content="HackerWeb">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui">
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" href="icons/favicon.ico">
<link rel="shortcut icon" sizes="196x196" href="icons/favicon-196.png">
<link rel="shortcut icon" sizes="128x128" href="icons/favicon-128.png">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="icons/touch-icon-152.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="icons/touch-icon-144.png">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="icons/touch-icon-120.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="icons/touch-icon-114.png">
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="icons/touch-icon-76.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="icons/touch-icon-72.png">
<link rel="apple-touch-icon-precomposed" href="icons/touch-icon-114.png">
<style>body{ visibility: hidden; }</style>
<script>
// WP8 Viewport fix: http://trentwalton.com/2013/01/16/windows-phone-8-viewport-fix/
if (navigator.userAgent.match(/IEMobile\/10\.0/)){
var msViewportStyle = document.createElement('style');
msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}'));
document.getElementsByTagName('head')[0].appendChild(msViewportStyle);
}
</script>
<script>
var RavenConfig = { dsn: 'https://[email protected]/6152' };
if (location.hostname == 'cheeaun.github.io' || location.hostname == 'cheeaun.github.com' || location.hostname == 'app.hackerwebapp.com'){
var ra = document.createElement('script');
ra.type = 'text/javascript'; ra.async = true;
ra.src = '//cdn.ravenjs.com/1.1.0/native/raven.min.js';
var s0 = document.getElementsByTagName('script')[0];
s0.parentNode.insertBefore(ra, s0);
(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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-36575624-2', 'auto');
ga('send', 'pageview');
// Track device pixel ratios
if (window.devicePixelRatio) ga('set', 'dimension1', window.devicePixelRatio);
}
if (window.applicationCache){
// "Naturally" reload when an update is available
var reload = false;
window.applicationCache.addEventListener('updateready', function(){
if (window.applicationCache.status == window.applicationCache.UPDATEREADY){
window.applicationCache.swapCache();
reload = true;
}
}, false);
setInterval(function(){
try { // There's nothing to update for first-time load, browser freaks out :/
window.applicationCache.update();
} catch (e){}
}, 1000*60*60); // Every hour
var checkReload = function(){
if (reload) location.reload();
};
window.addEventListener('pageshow', checkReload, false);
window.addEventListener('focus', checkReload, false);
// Use GA to track the update rate of this manifest appcache thing
// and see how fast users are updated to the latest cache/version
if (typeof ga != 'undefined') window.addEventListener('load', function(){
setTimeout(function(){
var r = new XMLHttpRequest();
r.open('GET', 'manifest.appcache', true);
r.onload = function(){
var text = this.responseText;
if (!text) return;
var version = (text.match(/#\s\d[^\n\r]+/) || [])[0];
if (version) ga('send', 'event', 'Appcache', 'Version', version.replace(/^#\s/, ''));
};
r.send();
}, 1000);
}, false);
} else {
setTimeout(function(){
if (typeof ga != 'undefined') ga('send', 'event', 'Appcache', 'Version', 'n/a');
}, 1000);
}
</script>
</head>
<body>
<!--[if lt IE 9]>
<div id="outdated-browser">
<p>You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<p><small>Else, just go to <a href="https://news.ycombinator.com/">Hacker News</a> web site instead.</small></p>
</div>
<![endif]-->
<div id="apploader"></div>
<div class="view hidden" id="view-home">
<header>
<a href="#/about" class="header-button header-button-left"><button>About</button></a>
<h1 style="margin: 0 65px;">HackerWeb</h1>
<a class="header-button header-button-icon header-button-right" id="view-home-refresh"><button><i class="icon-refresh">Refresh</i></button></a>
</header>
<div class="scroll">
<section>
</section>
</div>
</div>
<div class="view hidden shaded" id="view-comments">
<header>
<a href="#/" class="header-button header-button-left header-back-button"><button>News</button></a>
<h1 style="margin: 0 75px;"></h1>
</header>
<div class="scroll">
<section>
</section>
</div>
</div>
<div class="view hidden shaded" id="view-about">
<header>
<a href="#/" class="header-button header-button-left"><button>Close</button></a>
<h1>About</h1>
</header>
<div class="scroll striped">
<section>
<div class="grouped-tableview cf">
<span id="y-icon"></span>
<p id="app-desc"><strong>HackerWeb</strong><br>A simply readable Hacker News web app.</p>
</div>
<ul class="grouped-tableview grouped-tableview-links">
<li><a href="http://hackerwebapp.com/" target="_blank" class="disclosure">HackerWeb homepage</a></li>
<li><a href="https://news.ycombinator.com/" target="_blank" class="disclosure">Hacker News homepage</a></li>
<li><a href="http://ycombinator.com/newsfaq.html" target="_blank" class="disclosure">Hacker News FAQ</a></li>
<li><a href="https://github.com/cheeaun/hackerweb" target="_blank" class="disclosure">HackerWeb on GitHub</a></li>
<li><a href="https://twitter.com/cheeaun" target="_blank" class="disclosure">Follow @cheeaun</a></li>
<li><a href="https://www.gittip.com/cheeaun/" target="_blank" class="disclosure">Gittip @cheeaun</a></li>
<li><a href="mailto:[email protected]?subject=HackerWeb feedback" class="disclosure">Send Feedback</a></li>
</ul>
<p class="foot-label">Built by Lim Chee Aun.<br>Not affiliated with Hacker News or YCombinator.</p>
</section>
</div>
</div>
<script>
(function(d, ua){
var hasLocalStorage = false;
try {
var testKey = '__hackerweb__test';
localStorage.setItem(testKey, testKey);
localStorage.removeItem(testKey);
hasLocalStorage = true;
} catch(e) {}
var theme = 'web';
if (ua && /iPhone|iPod|iPad/.test(ua)){
var version = parseInt((ua.match(/ OS (\d+)_/i) || [,0])[1], 10);
if (version >= 7){
theme = 'ios-2';
} else if (version >= 5){
theme = 'ios';
}
}
if (hasLocalStorage) theme = localStorage['hackerweb:options:theme'] || theme;
var head = d.head || d.getElementsByTagName('head')[0];
var link = d.createElement('link');
link.rel = 'stylesheet';
link.href = 'assets/css/hw-' + theme + '.css';
head.insertBefore(link, head.lastChild);
var script = d.createElement('script');
script.src = 'js/hw-' + theme + '.min.js';
head.insertBefore(script, head.lastChild);
if (typeof ga != 'undefined') setTimeout(function(){
ga('send', 'event', 'App', 'Theme', theme);
}, 2000);
})(document, navigator.userAgent);
</script>
</body>
</html>