From 7410cf773e246bb7e8c35c5f4b03ee821bbbe273 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 15 Mar 2015 00:39:45 +0100 Subject: [PATCH] Return true/false in header functions --- src/scripts/header.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/scripts/header.js b/src/scripts/header.js index e63af5c..f970761 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -29,15 +29,15 @@ header.show = function() { if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin); 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; - - if (visible.photo()&&!visible.infobox()&&!visible.contextMenu()&&!visible.message()) { + var newMargin = -1*($('#imageview #image').height()/2); clearTimeout($(window).data('timeout')); @@ -52,17 +52,22 @@ header.hide = function(e, delay) { }, delay)); + return true; + } + return false; + } -header.setTitle = function(title) { +header.setTitle = function(title = 'Untitled') { - var $title = header.dom('#title'), - title = title || 'Untitled'; + var $title = header.dom('#title'); $title.html(title + build.iconic('caret-bottom')); + return true; + } header.setMode = function(mode) { @@ -77,6 +82,7 @@ header.setMode = function(mode) { $('#tools_album, #tools_photo').hide(); $('#tools_albums').show(); + return true; break; case 'album': @@ -100,6 +106,7 @@ header.setMode = function(mode) { $('#button_info_album, #button_trash_album, #button_share_album').show(); } + return true; break; case 'photo': @@ -108,10 +115,13 @@ header.setMode = function(mode) { $('#tools_albums, #tools_album').hide(); $('#tools_photo').show(); + return true; break; } + return false; + } header.setEditable = function(editable) { @@ -124,4 +134,6 @@ header.setEditable = function(editable) { if (editable) $title.addClass('editable'); else $title.removeClass('editable'); + return true; + } \ No newline at end of file