forked from cheeaun/hackerweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
169 lines (159 loc) · 6.5 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
<!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">
<link rel="shortcut icon" href="icons/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="icons/touch-icon-144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="icons/touch-icon-114.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.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 src="//d3nslu0hdya83q.cloudfront.net/dist/1.0/raven.min.js"></script>
<script>
var _gaq = [];
if (location.hostname == 'cheeaun.github.io' || location.hostname == 'cheeaun.github.com' || location.hostname == 'app.hackerwebapp.com'){
Raven.config('https://[email protected]/6152').install();
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36575624-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
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 _gaq != '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) _gaq.push(['_trackEvent', 'Appcache', 'Version', version.replace(/^#\s/, '')]);
};
r.send();
}, 1000);
}, false);
} else {
setTimeout(function(){
_gaq.push(['_trackEvent', '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" id="view-comments">
<header>
<a href="#/" class="header-button header-button-left header-back-button"><button>News</button></a>
<h1 style="margin: 0 65px;"></h1>
</header>
<div class="scroll">
<section>
</section>
</div>
</div>
<div class="view hidden" 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) && parseInt((ua.match(/ OS (\d+)_/i) || [,0])[1], 10) >= 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 _gaq != 'undefined') setTimeout(function(){
_gaq.push(['_trackEvent', 'App', 'Theme', theme]);
}, 2000);
})(document, navigator.userAgent);
</script>
</body>
</html>