[TemporaryStorage] add files required for SDK build
[samples/web/TemporaryStorage.git] / tizen-web-ui-fw / latest / js / src / jquery.mobile.zoom.iosorientationfix.js
1 (function( $, window ) {
2
3         // This fix addresses an iOS bug, so return early if the UA claims it's something else.
4         if ( !(/iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ) {
5                 return;
6         }
7
8   var zoom = $.mobile.zoom,
9                 evt, x, y, z, aig;
10
11   function checkTilt( e ) {
12                 evt = e.originalEvent;
13                 aig = evt.accelerationIncludingGravity;
14
15                 x = Math.abs( aig.x );
16                 y = Math.abs( aig.y );
17                 z = Math.abs( aig.z );
18
19                 // If portrait orientation and in one of the danger zones
20     if ( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ) {
21                         if ( zoom.enabled ) {
22                                 zoom.disable();
23                         }
24     }   else if ( !zoom.enabled ) {
25                         zoom.enable();
26     }
27   }
28
29   $.mobile.$window
30                 .bind( "orientationchange.iosorientationfix", zoom.enable )
31                 .bind( "devicemotion.iosorientationfix", checkTilt );
32
33 }( jQuery, this ));