This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
/
index.html
107 lines (97 loc) · 4.15 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
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>First page</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
<button onclick="window.plugins.socialsharing.share('Message only', null, null, null, function(msg) {alert(msg)}, function(msg) {alert(msg)})">social sharing (needs plugin)</button>
<br/>
<button onclick="alert('running cordova ' + device.cordova + ' on ' + device.platform)">device test (needs plugin)</button>
<br/>
<button onclick="window.plugins.toast.showShortTop('Hello there!', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast showShortTop</button>
<br/>
<button onclick="loadXHR()">Load file via embedded HTTP server</button>
<br/>
<button onclick="document.getElementById('webglFrame').src='https://www.scirra.com/demos/c2/particles/'">load webgl iframe</button>
<br/>
<button onclick="inAppBrowser()">InAppBrowser</button>
<br/>
<button onclick="storeInLS1()">Store val1 in LS</button>
<br/>
<button onclick="storeInLS2()">Store val2 in LS</button>
<br/>
<button onclick="readFromLS()">Read from LS</button>
<br/>
<br/>
<a href="https://github.com/eddyverbruggen" target="_blank">Test an external link</a>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
window.onerror = function(msg, file, line) {
alert(msg + '; ' + file + '; ' + line);
};
function storeInLS1() {
localStorage.setItem("mykey1", "myval1");
}
function storeInLS2() {
localStorage.setItem("mykey2", "myval2");
}
function readFromLS() {
alert("read: " + localStorage.getItem("mykey1") + " & " + localStorage.getItem("mykey2"));
}
// reroute protocol-less GET requests to our embedded http server to defeat Origin null issues
(function() {
var proxied = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
if (method == "GET" && url.indexOf("://") == -1) {
arguments[1] = "http://localhost:12344/" + url; // assuming the (overridable) port is 12344
}
return proxied.apply(this, arguments);
};
})();
function loadXHR() {
$.ajax({
url: "loadMeByXHR.txt" // will be dynamically prefix with http://
}).done(function(msg) {
alert('done: ' + msg);
}).fail(function(msg) {
alert('fail: ' + JSON.stringify(msg));
});
}
function inAppBrowser() {
var ref = window.open('http://google.com', '_blank', 'location=yes');
}
</script>
<iframe id="webglFrame" src="" frameborder="0"></iframe>
</body>
</html>