Permalink
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (97 sloc) 4.15 KB
<!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>