From f17bc55a8f43843cf6eaa94474d1c54467e52156 Mon Sep 17 00:00:00 2001 From: ahr Date: Sun, 10 Dec 2017 17:28:29 +0100 Subject: [PATCH] hide prev/next image buttons when splitBy is not active --- .../src/main/resources/resources/js/search.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pdb-ui/src/main/resources/resources/js/search.js b/pdb-ui/src/main/resources/resources/js/search.js index de73e16..36a24db 100644 --- a/pdb-ui/src/main/resources/resources/js/search.js +++ b/pdb-ui/src/main/resources/resources/js/search.js @@ -257,8 +257,7 @@ function enableSplitBy(fieldValues) { splitBy['values'] = fieldValues; splitBy['index'] = 0; splitBy['query'] = $('#search-input').val(); - $('#prev_image').show(); - $('#next_image').show(); + showSplitBy(); } function disableSplitBy() { @@ -266,6 +265,17 @@ function disableSplitBy() { splitBy['values'] = []; splitBy['index'] = 0; splitBy['query'] = ''; + hideSplitBy(); +} + +function showSplitBy(){ + if(splitBy['values'].length > 0) { + $('#prev_image').show(); + $('#next_image').show(); + } +} + +function hideSplitBy(){ $('#prev_image').hide(); $('#next_image').hide(); } @@ -322,6 +332,7 @@ function showLoadingIcon() { //$('#result-view').html("
"); $('#result-image').html(""); + hideSplitBy(); startInvaders(); } @@ -394,8 +405,10 @@ function sendPlotRequest(query){ var success = function(response){ $('#result-image').html(''); + showSplitBy(); }; var error = function(e) { + showSplitBy(); if (e.status == 404){ $('#result-image').text("No data points found for query: " + query); }