Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. switch blahBlah
  2. {
  3. case 'this' :
  4. doThis() ;
  5. break;
  6. case 'main' :
  7. // What do I do here that is well behaved for all platforms???
  8. break;
  9. default:
  10. doFoo() ;
  11. }
  12.  
  13. document.removeEventListener( "backbutton", function(){}, false );
  14.  
  15. document.addEventListener( "backbutton", OverrideBackButton, false );
  16.  
  17. function pageinit() {
  18. document.addEventListener("deviceready", deviceInfo, true);
  19. }
  20.  
  21.  
  22. function deviceInfo() {
  23. document.addEventListener("backbutton", onBackButton, true);
  24. }
  25.  
  26. function onBackButton(e) {
  27. try{
  28. var activePage = $.mobile.activePage.attr('id');
  29.  
  30. if(activePage == 'Options'){
  31. closeOptions();
  32. } else if(activePage == 'Popup'){
  33. closePopup();
  34. } else if(activePage == 'HomePage'){
  35.  
  36. function checkButtonSelection(iValue){
  37. if (iValue == 2){
  38. navigator.app.exitApp();
  39. }
  40. }
  41.  
  42. e.preventDefault();
  43. navigator.notification.confirm(
  44. "Are you sure you want to EXIT the program?",
  45. checkButtonSelection,
  46. 'EXIT APP:',
  47. 'Cancel,OK');
  48. } else {
  49. navigator.app.backHistory();
  50. }
  51. } catch(e){ console.log('Exception: '+e,3); }
  52. }
  53.  
  54. if($("#mainPage").is(".ui-page-active")){
  55.  
  56. navigator.app.exitApp();
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement