bookmarks: additional protection against multiple bookmark stars being added to the portal details

This commit is contained in:
Jon Atkins 2015-07-26 08:11:48 +01:00
parent 5a5a5a21fb
commit 0d88cfd8ba

View File

@ -292,26 +292,36 @@
} }
// Append a 'star' flag in sidebar. // Append a 'star' flag in sidebar.
window.plugin.bookmarks.onPortalSelectedPending = false;
window.plugin.bookmarks.onPortalSelected = function() { window.plugin.bookmarks.onPortalSelected = function() {
$('.bkmrksStar').remove(); $('.bkmrksStar').remove();
if(window.selectedPortal == null) return; if(window.selectedPortal == null) return;
setTimeout(function() { // the sidebar is constructed after firing the hook if (!window.plugin.bookmarks.onPortalSelectedPending) {
if(typeof(Storage) === "undefined") { window.plugin.bookmarks.onPortalSelectedPending = true;
$('#portaldetails > .imgpreview').after(plugin.bookmarks.htmlDisabledMessage);
return;
}
// Prepend a star to mobile status-bar setTimeout(function() { // the sidebar is constructed after firing the hook
if(window.plugin.bookmarks.isSmart) { window.plugin.bookmarks.onPortalSelectedPending = false;
$('#updatestatus').prepend(plugin.bookmarks.htmlStar);
$('#updatestatus .bkmrksStar').attr('title', ''); $('.bkmrksStar').remove();
}
if(typeof(Storage) === "undefined") {
$('#portaldetails > .imgpreview').after(plugin.bookmarks.htmlDisabledMessage);
return;
}
// Prepend a star to mobile status-bar
if(window.plugin.bookmarks.isSmart) {
$('#updatestatus').prepend(plugin.bookmarks.htmlStar);
$('#updatestatus .bkmrksStar').attr('title', '');
}
$('#portaldetails > h3.title').before(plugin.bookmarks.htmlStar);
window.plugin.bookmarks.updateStarPortal();
}, 0);
}
$('#portaldetails > h3.title').before(plugin.bookmarks.htmlStar);
window.plugin.bookmarks.updateStarPortal();
}, 0);
} }
// Update the status of the star (when a portal is selected from the map/bookmarks-list) // Update the status of the star (when a portal is selected from the map/bookmarks-list)