From a64d447b7b0adf6a598f4ec1c27724ca48caf660 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Tue, 23 Aug 2016 12:09:41 +0200 Subject: [PATCH] Auto hide button add_to_chart when no data plotted. --- var/www/templates/terms_plot_tool.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/var/www/templates/terms_plot_tool.html b/var/www/templates/terms_plot_tool.html index 6108eb91..2d5799f0 100644 --- a/var/www/templates/terms_plot_tool.html +++ b/var/www/templates/terms_plot_tool.html @@ -130,6 +130,7 @@ /* Create the slider and button*/ + $('#plot-btn-add').hide(); var today = Date.now(); var old_day = today - (12*31*24*60*60)*1000; $( ".sliderRange" ).slider({ @@ -150,7 +151,9 @@ $('#plot-btn-add').click(addData); $("#TermInput").val($("#TermInput").attr("data-init-plot")); - $("#plot-btn").click(); + if($("#TermInput").attr("data-init-plot") != "") { + $("#plot-btn").click(); + } $("#TermInput").keyup(function(event){ if(event.keyCode == 13){ @@ -192,6 +195,7 @@ var graph_options = { function plotData() { + $('#plot-btn-add').show("fast"); var curthis = $(this); var term = $('#TermInput').val(); var range_start = new Date($( ".sliderRange" ).slider( "values", 0 )).getTime() / 1000;