Skip to content

Commit

Permalink
Site Manager: Prevent back when current site is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
salbahra committed Jun 24, 2015
1 parent 155e401 commit e3d9052
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions www/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1443,12 +1443,20 @@ var showSites = ( function() {
"</div>" +
"</div>" ),
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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e3d9052

Please sign in to comment.