diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/accelerometer.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-fb1989bda5d3e0a5472ba7644d57cae197733a8f.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/accelerometer.html')
-rw-r--r-- | misc/openlayers/examples/accelerometer.html | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/misc/openlayers/examples/accelerometer.html b/misc/openlayers/examples/accelerometer.html new file mode 100644 index 0000000..0721519 --- /dev/null +++ b/misc/openlayers/examples/accelerometer.html @@ -0,0 +1,100 @@ +<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <title>OpenLayers Accelerometer Usage</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <script type="text/javascript" src="browser.js"></script>
+
+ <style type="text/css">
+ .olControlAttribution {
+ bottom: 5px;
+ }
+ </style>
+ <script type="text/javascript">
+ function init() {
+ if (isEventSupported('deviceorientation', window) || isEventSupported('mozorientation', window) || isEventSupported('devicemotion', window)) {
+ if (window.DeviceOrientationEvent) {
+ window.addEventListener("deviceorientation", function (event) {
+ document.getElementById('resultDeviceOrientation').innerHTML = '';
+ if (typeof(event.alpha) != 'undefined') {
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Alpha: " + event.alpha + "<br>";
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Beta: " + event.beta + "<br>";
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.gamma + "<br>";
+ }
+ if (typeof(event.absolute) != 'undefined') {
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.absolute + "<br>";
+ }
+ if (typeof(event.compassCalibrate) != 'undefined') {
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.compassCalibrated + "<br>";
+ }
+ }, true);
+ }
+ if (window.DeviceMotionEvent) {
+ window.addEventListener('devicemotion', function (event) {
+ document.getElementById('resultDeviceMotion').innerHTML = '';
+ if (typeof(event.accelerationIncludingGravity) != 'undefined') {
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.x: " + event.accelerationIncludingGravity.x + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.y: " + event.accelerationIncludingGravity.y + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.z: " + event.accelerationIncludingGravity.z + "<br>";
+ }
+ if (typeof(event.acceleration) != 'undefined') {
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "acceleration.x: " + event.acceleration.x + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "acceleration.y: " + event.acceleration.y + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "acceleration.z: " + event.acceleration.z + "<br>";
+ }
+ if (typeof(event.rotationRate) != 'undefined') {
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "rotationRate.alpha: " + event.rotationRate.alpha + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "rotationRate.beta: " + event.rotationRate.beta + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "rotationRate.gamma: " + event.rotationRate.gamma + "<br>";
+ }
+ }, true);
+ }
+ if (window.MozOrientation) {
+ window.addEventListener("MozOrientation", function (orientation) {
+ document.getElementById('resultMozOrientation').innerHTML = "orientation.x: " + orientation.x + "<br>";
+ document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.y: " + orientation.y + "<br>";
+ document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.z: " + orientation.z + "<br>";
+ }, true);
+ }
+ } else {
+ alert("Unfortunately, your brower doesn't support the orientation usage");
+ }
+
+ }
+ </script>
+</head>
+<body onload="init()">
+<h1 id="title">Accelerometer</h1>
+
+<p id="shortdesc">
+ The goal of this script is to demonstrate the usage of accelerometer.
+</p>
+<p>
+ The orientation specification can be found <a href="http://dev.w3.org/geo/api/spec-source-orientation.html">here</a>.
+</p>
+
+<div id="tags">
+ browser, vendor, mobile, orientation
+</div>
+
+<h1>Device motion</h1>
+
+<div id="resultDeviceMotion">
+
+</div>
+<h1>Device orientation</h1>
+
+<div id="resultDeviceOrientation">
+
+</div>
+<h1>MOZ orientation</h1>
+
+<div id="resultMozOrientation">
+
+</div>
+</body>
+</html>
|