forked from jessemonroy650/Phonegap-Splashscreen-Test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
78 lines (75 loc) · 2.9 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
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>PhoneGap Splash Screen Test</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="buttons.css" />
<style>
body {margin:0px;font-size:large;}
.clear {clear:both;}
.hidden {visibility:collapse;display:none;}
.expose {visibility:visible;display:block;} /* Here for completeness only. */
.copyright {padding:5px;align:left;font-style:italic;font-size:small;}
#header {margin:0;padding:0;}
#exitApp {margin:0 0.1em;float:right}
</style>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="fastclick.js"></script>
<script type="text/javascript">
var my_media = null;
var mediaTimer = null;
// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);
//
function splash(time) {
navigator.splashscreen.show();
setTimeout(function() {
navigator.splashscreen.hide();
},
time);
}
//
function onDeviceReady() {
if (device.platform === "iOS") {
//alert("got iOS");
// hide Exit button. They don't have one on iOS devices.
// http://www.mzcart.com/javascript-how-to-addremove-css-class-from-a-dom-element/
document.getElementById('exitApp').classList.add("hidden");
/* deals with post-iOS-7 change that covers the status bar */
/* http://coenraets.org/blog/2013/09/phonegap-and-cordova-with-ios-7/ */
document.body.style.marginTop = "20px";
// Work-around iOS Quirk
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
} else if (device.platform == 'Android') {
// Get rid of 300ms delay
document.addEventListener('DOMContentLoaded', function() { FastClick.attach(document.body); }, false);
}
// Setup the button click
thePlace = document.getElementById('splash');
thePlace.addEventListener('click', function(e) {
//alert('got click');
splash(3000);
});
}
//
function onLoad() {
}
</script>
</head>
<body onload="onLoad()">
<div id=header class="button button-block button-large">
<img align=left src=favicon-48x48.png>
Splash Screen
<button id=exitApp onclick='navigator.app.exitApp()' class="button button-pill button-primary button-large">Exit</button>
</div>
<p class=clear />
<center>
<div id=splash class="button button-pill button-action button-large" style="margin:1em;">Splash</div>
</center>
<div class="copyright" style="padding:5px;align:left;font-style:italic;font-size:small;">
<span id=copyright>Created by Jesus Monroy, Jr. © 2015</span>
</div>
</body>
</html>