Merge branch 'master' into tizen_2.1
[platform/framework/web/web-ui-fw.git] / demos / tizen-winsets / widgets / popupwindow / popupwindow.js
1 $( document ).one( "pageinit", "#popupwindow-demo", function () {
2         $("#btn_textbox_popup_cancel").on("vclick", function ( ev ) {
3                 $("#textbox_popup").find("input").val("");
4                 $("#textbox_popup").popup("close");
5                 return false;
6         });
7
8        if ( $.tizen.__tizen__.util.isMobileBrowser() ) {
9                 var direction = window.screen.orientation;
10                 if ( direction === "landscape-primary" || direction === "landscape-secondary" ) {
11                         $( "#go_textbox_popup a" ).attr( "href", "#textbox_popup_landscape" );
12                 }
13         }
14 });
15
16 function onSuccessPopupCallback ( ori ) {
17         if ( ori.status === "PORTRAIT_PRIMARY" || ori.status === "PORTRAIT_SECONDARY" ) {
18                 $("#textbox_popup_landscape").popup("close");
19                 $("#go_textbox_popup a").attr("href", "#textbox_popup");
20         }
21         else if ( ori.status === "LANDSCAPE_PRIMARY" || ori.status === "LANDSCAPE_SECONDARY" ) {
22                 $("#textbox_popup").popup("close");
23                 $("#go_textbox_popup a").attr("href", "#textbox_popup_landscape");
24         }
25
26 }
27
28 function onErrorPopupCallback ( error ) {
29         console.error( "An error occurred " + error.message );
30 }
31
32 if ( $.tizen.__tizen__.util.isMobileBrowser() ) {
33         tizen.systeminfo.addPropertyValueChangeListener( "DEVICE_ORIENTATION", onSuccessPopupCallback, onErrorPopupCallback );
34 }
35