Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch blahBlah
- {
- case 'this' :
- doThis() ;
- break;
- case 'main' :
- // What do I do here that is well behaved for all platforms???
- break;
- default:
- doFoo() ;
- }
- document.removeEventListener( "backbutton", function(){}, false );
- document.addEventListener( "backbutton", OverrideBackButton, false );
- function pageinit() {
- document.addEventListener("deviceready", deviceInfo, true);
- }
- function deviceInfo() {
- document.addEventListener("backbutton", onBackButton, true);
- }
- function onBackButton(e) {
- try{
- var activePage = $.mobile.activePage.attr('id');
- if(activePage == 'Options'){
- closeOptions();
- } else if(activePage == 'Popup'){
- closePopup();
- } else if(activePage == 'HomePage'){
- function checkButtonSelection(iValue){
- if (iValue == 2){
- navigator.app.exitApp();
- }
- }
- e.preventDefault();
- navigator.notification.confirm(
- "Are you sure you want to EXIT the program?",
- checkButtonSelection,
- 'EXIT APP:',
- 'Cancel,OK');
- } else {
- navigator.app.backHistory();
- }
- } catch(e){ console.log('Exception: '+e,3); }
- }
- if($("#mainPage").is(".ui-page-active")){
- navigator.app.exitApp();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement