-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathoffline-ve001.html
115 lines (107 loc) · 5.49 KB
/
offline-ve001.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Left or Right?</title>
<meta name="description" content="Brain teaser game where you need to follow the instruction on the screen, but don't trust the arrow">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Left or Right?" />
<link rel="apple-touch-icon" sizes="57x57" href="apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="ms-icon-144x144.png">
<meta name="theme-color" content="#000000">
<link rel="stylesheet" href="style.css"/>
<link rel="manifest" href="manifest.json">
<meta property="og:url" content="https://giopunt.github.io/leftright/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Left or Right?" />
<meta property="og:description" content="Try Left or Right, a simple brain teaser game" />
<meta property="og:image" content="apple-icon-precomposed.png" />
</head>
<body>
<section id="main">
<div class="legend">
<h1>Left or <br/> Right?</h1>
<h2>⇆</h2>
<button id="start">START</button>
</div>
</section>
<section id="how-to">
<article class="how-to">
Follow the text, <b>don't trust the arrow.</b><br/><br/>
Swipe ⇆ on your screen or use your keyboard.
</article>
<button id="next">Try me!</button>
</section>
<section id="game">
<h2>Score: <span id="live-score"></span></h2>
<h2 class="time">Time left <span id="live-time"></span></h2>
<h1 id="leftArrow" class="arrow">←</h1>
<h1 id="rightArrow" class="arrow">→</h1>
<h1 id="rightText" class="text">RIGHT</h1>
<h1 id="leftText" class="text">LEFT</h1>
</section>
<section id="end">
<h2>SCORE: <span id="new-score"></span></h2>
<h2>HIGH SCORE: <span id="high-score"></span></h2>
<button id="startFromEnd">START</button>
<div class="social" style="display:none">
<h3>Share</h3>
<a class="facebook" target="_blank" href="https://www.facebook.com/sharer/sharer.php?app_id=127742960729771&u=https%3A%2F%2Fhickory-hugger.hyperdev.space%2F">Facebook</a>
<a class="twitter" target="_blank" href="https://twitter.com/intent/tweet?text=I%20just%20scored%20on%20Left%20or%20Right%3F%2C%20can%20you%20do%20better%3F&source=webclient">Twitter</a>
</div>
</section>
<div id="author">by <a href="http://www.giovannipuntil.com/portfolio/" target="_blank">giovanni puntil</a></div>
<script src="client.js" defer async></script>
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js').then(function() { console.log('Service Worker Registered'); });
}
if (!localStorage.getItem("offlineGA")) {
localStorage.setItem("offlineGA", "[]");
}
window.addEventListener('load', function() {
function updateOnlineStatus(event) {
var stored = JSON.parse(localStorage.getItem("offlineGA"));
for(var event in stored){
var store = Object.keys(stored[event]).map(function(k) { return stored[event][k] });
ga(store);
}
localStorage.setItem("offlineGA","[]");
}
window.addEventListener('online', updateOnlineStatus);
});
var oga = function() {
if (navigator.onLine || !("onLine" in navigator)) { // if online or if browser doesn't support onLine/offLine detection.
ga(arguments);
} else {
var stored = JSON.parse(localStorage.getItem("offlineGA"));
stored.push(arguments);
localStorage.setItem("offlineGA", JSON.stringify(stored));
}
};
(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');
oga('create', 'UA-80182500-1', 'auto');
oga('set', 'appName', 'LeftOrRight');
oga('send', 'pageview');
oga('send', 'screenview', {screenName: 'Home'});
document.body.addEventListener('touchmove', function(e){ e.preventDefault(); });
</script>
</body>
</html>