OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <title>DeviceOrientationAbsolute test</title> |
| 4 <script type="text/javascript"> |
| 5 function checkOrientationAbsoluteEvent(event) { |
| 6 // Return true iff the orientation is close enough to (4, 5, 6). |
| 7 return Math.abs(event.alpha - 4) < 0.01 && |
| 8 Math.abs(event.beta - 5) < 0.01 && |
| 9 Math.abs(event.gamma - 6) < 0.01 && |
| 10 event.absolute == true; |
| 11 } |
| 12 |
| 13 function onOrientationAbsolute(event) { |
| 14 if (checkOrientationAbsoluteEvent(event)) { |
| 15 window.removeEventListener('deviceorientationabsolute', onOrientationA
bsolute); |
| 16 pass(); |
| 17 } else { |
| 18 fail(); |
| 19 } |
| 20 } |
| 21 |
| 22 function pass() { |
| 23 document.getElementById('status').innerHTML = 'PASS'; |
| 24 document.location = '#pass'; |
| 25 } |
| 26 |
| 27 function fail() { |
| 28 document.location = '#fail'; |
| 29 } |
| 30 </script> |
| 31 </head> |
| 32 <body onLoad="window.addEventListener('deviceorientationabsolute', onOrientati
onAbsolute)"> |
| 33 <div id="status">FAIL</div> |
| 34 </body> |
| 35 </html> |
OLD | NEW |