Return true/false in header functions

This commit is contained in:
Tobias Reich 2015-03-15 00:39:45 +01:00
parent 26cdd98dfc
commit 7410cf773e

View File

@ -29,15 +29,15 @@ header.show = function() {
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin); if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
else $('#imageview #image').removeClass('full'); else $('#imageview #image').removeClass('full');
return true;
} }
header.hide = function(e, delay) { header.hide = function(e, delay = 500) {
var newMargin = -1*($('#imageview #image').height()/2); if (visible.photo()&&!visible.sidebar()&&!visible.contextMenu()&&!visible.message()) {
if (delay===undefined) delay = 500; var newMargin = -1*($('#imageview #image').height()/2);
if (visible.photo()&&!visible.infobox()&&!visible.contextMenu()&&!visible.message()) {
clearTimeout($(window).data('timeout')); clearTimeout($(window).data('timeout'));
@ -52,17 +52,22 @@ header.hide = function(e, delay) {
}, delay)); }, delay));
return true;
} }
return false;
} }
header.setTitle = function(title) { header.setTitle = function(title = 'Untitled') {
var $title = header.dom('#title'), var $title = header.dom('#title');
title = title || 'Untitled';
$title.html(title + build.iconic('caret-bottom')); $title.html(title + build.iconic('caret-bottom'));
return true;
} }
header.setMode = function(mode) { header.setMode = function(mode) {
@ -77,6 +82,7 @@ header.setMode = function(mode) {
$('#tools_album, #tools_photo').hide(); $('#tools_album, #tools_photo').hide();
$('#tools_albums').show(); $('#tools_albums').show();
return true;
break; break;
case 'album': case 'album':
@ -100,6 +106,7 @@ header.setMode = function(mode) {
$('#button_info_album, #button_trash_album, #button_share_album').show(); $('#button_info_album, #button_trash_album, #button_share_album').show();
} }
return true;
break; break;
case 'photo': case 'photo':
@ -108,10 +115,13 @@ header.setMode = function(mode) {
$('#tools_albums, #tools_album').hide(); $('#tools_albums, #tools_album').hide();
$('#tools_photo').show(); $('#tools_photo').show();
return true;
break; break;
} }
return false;
} }
header.setEditable = function(editable) { header.setEditable = function(editable) {
@ -124,4 +134,6 @@ header.setEditable = function(editable) {
if (editable) $title.addClass('editable'); if (editable) $title.addClass('editable');
else $title.removeClass('editable'); else $title.removeClass('editable');
return true;
} }