Changeset 718
- Timestamp:
- Jan 29, 2015 6:01:14 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/assets/js/frontend/lecture.js
r717 r718 128 128 129 129 function DoCloseLecture () { 130 g_Flash.SetVariable("command", "Quit App"); 130 g_Flash.SetVariable("command", "Quit App"); 131 } 132 133 function getLectureState () { 134 var state = g_Flash.GetVariable("dataChanged"); 135 return state == 'true' ? true: (state == 'false' ? false:false); 131 136 } 132 137 … … 176 181 var inFormOrLink = false; 177 182 178 /*$( window ).bind('beforeunload',function(e) { 179 console.log('unload'); 180 e.preventDefault(); 181 });*/ 183 $(window).on('beforeunload', function() { 184 var e = $.Event('webapp:page:closing'); 185 $(window).trigger(e); // let other modules determine whether to prevent closing 186 if(e.isDefaultPrevented()) { 187 return e.message; 188 } 189 }); 190 191 $(window).on('webapp:page:closing', function(e) { 192 if(getLectureState()) { 193 e.preventDefault(); 194 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?'; 195 } 196 }); 197 182 198 })
Note: See TracChangeset
for help on using the changeset viewer.