Ignore:
Timestamp:
Mar 26, 2015 2:52:37 PM (10 years ago)
Author:
quyenla
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/www/deploy/20150304/assets/js/frontend/lecture.js

    r830 r831  
    99if (p_period == -1 && is_overdate == 1)
    1010{
    11         $('#alert-trial-services').modal('show');
    12         $('#alert-trial-services').on('hidden.bs.modal', function () {
    13                 if (update_user_info == "1")
    14                 {
    15                         $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
    16                 }
    17         });
     11    $('#alert-trial-services').modal('show');
     12    $('#alert-trial-services').on('hidden.bs.modal', function () {
     13        if (update_user_info == "1")
     14        {
     15            $('#update_user_info').modal({backdrop: 'static', keyboard: false, });
     16        }
     17    });
    1818}
    1919else
    2020{
    21         if (update_user_info == "1")
    22         {
    23                 $('#update_user_info').modal({backdrop: 'static'});
    24         }
     21    if (update_user_info == "1")
     22    {
     23        $('#update_user_info').modal({backdrop: 'static'});
     24    }
    2525}
    2626
     
    5454    console.log('Show modal!');
    5555    $('#alert-services-package').modal('show');
    56         //$('#alert-services-package-bk').modal('show');
     56    //$('#alert-services-package-bk').modal('show');
    5757}
    5858
     
    124124}
    125125
    126 function DoCloseLecture () {
    127         g_Flash.SetVariable("command", "Quit App");             
    128 }
    129 
    130 function getLectureState () {
    131         var state = g_Flash.GetVariable("dataChanged");
    132         return state == 'true' ? true: (state == 'false' ? false:false);
     126function DoCloseLecture() {
     127    g_Flash.SetVariable("command", "Quit App");
     128}
     129
     130function getLectureState() {
     131    var state = g_Flash.GetVariable("dataChanged");
     132    return state == 'true' ? true : (state == 'false' ? false : false);
    133133}
    134134
     
    174174
    175175$(document).ready(function () {
    176       InitViolet();
    177     if(fileid!="")
    178     {
    179         console.log('http://sbgapi.violet.vn/space/file/id/'+fileid);
    180     DoOpenLecture('http://sbgapi.violet.vn/space/file/id/'+fileid);
    181     }
    182         var inFormOrLink = false;
    183 
    184         $(window).on('beforeunload', function() {
    185                 var e = $.Event('webapp:page:closing');
    186                 $(window).trigger(e); // let other modules determine whether to prevent closing
    187                 if(e.isDefaultPrevented()) {
    188                         return e.message;
    189                 }
    190         });
    191 
    192         $(window).on('webapp:page:closing', function(e) {
    193                 if(getLectureState()) {
    194                         e.preventDefault();
    195                         e.message = 'Bạn đang soạn bài giảng và chưa lưu dữ liệu. Bạn có muốn chuyển khỏi ứng dụng khÃŽng?';
    196                 }
    197         });
    198 
     176    InitViolet();
     177    var inFormOrLink = false;
     178
     179    $(window).on('beforeunload', function () {
     180        var e = $.Event('webapp:page:closing');
     181        $(window).trigger(e); // let other modules determine whether to prevent closing
     182        if (e.isDefaultPrevented()) {
     183            return e.message;
     184        }
     185    });
     186
     187    $(window).on('webapp:page:closing', function (e) {
     188        if (getLectureState()) {
     189            e.preventDefault();
     190            e.message = 'Bạn đang soạn bài giảng và chưa lưu dữ liệu. Bạn có muốn chuyển khỏi ứng dụng khÃŽng?';
     191        }
     192    });
     193    setTimeout(function () {
     194        if (fileid != "")
     195        {
     196            DoOpenLecture(api_url+'space/file/id/' + fileid);
     197        }
     198
     199    }, 1000);
    199200})
    200201
Note: See TracChangeset for help on using the changeset viewer.