From e3d9052f74900db628d2a45462ccd4e788c512fc Mon Sep 17 00:00:00 2001 From: f613c71b3ed9988f9784f8b94f3d675053e7e9d3 Date: Tue, 23 Jun 2015 20:56:28 -0500 Subject: [PATCH] Site Manager: Prevent back when current site is deleted --- www/js/main.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/www/js/main.js b/www/js/main.js index f00657cde..686c4cd40 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -1443,12 +1443,20 @@ var showSites = ( function() { "" + "" ), makeStart = function() { - page.one( "pagebeforeshow", function( e ) { - e.stopImmediatePropagation(); + var finish = function() { header.eq( 0 ).hide(); $( "#header" ).show(); - $( "#footer, #footer-menu" ).hide(); - } ); + $( "#footer, #footer-menu" ).hide(); + }; + + if ( page.hasClass( "ui-page-active" ) ) { + finish(); + } else { + page.one( "pagebeforeshow", function( e ) { + e.stopImmediatePropagation(); + finish(); + } ); + } page.on( "swiperight swipeleft", function( e ) { e.stopImmediatePropagation(); @@ -1702,6 +1710,10 @@ var showSites = ( function() { list.find( ".deletesite" ).on( "click", function() { var site = siteNames[$( this ).data( "site" )]; + if ( $( "#site-selector" ).val() === site ) { + makeStart(); + } + delete sites[site]; storage.set( { "sites":JSON.stringify( sites ) }, function() { cloudSaveSites();