From f90987d284763008d7c11daab32ce8ab71893ca2 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Mon, 15 Aug 2016 14:53:46 +0200 Subject: [PATCH] Added date on slider --- .../sentiment_analysis_plot_tool.html | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/var/www/templates/sentiment_analysis_plot_tool.html b/var/www/templates/sentiment_analysis_plot_tool.html index 80861dc2..5c9c630f 100644 --- a/var/www/templates/sentiment_analysis_plot_tool.html +++ b/var/www/templates/sentiment_analysis_plot_tool.html @@ -76,20 +76,20 @@
    -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
    -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
@@ -97,7 +97,7 @@
- Date:10/09/15 - 15/09/16 + Date:
@@ -148,19 +148,25 @@ activePage = $('h1.page-header').attr('data-page'); $("#"+activePage).addClass("active"); - $( ".sliderRange" ).slider({ - range: true, - min: 0, - max: 500, - values: [ 192, 470 ], - slide: function( event, ui ) { - $( ".sliderRangeLabel" ).html( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); - } - }); + var today = Date.now(); + var old_day = today - (31*24*60*60)*1000; + $( ".sliderRange" ).slider({ + range: true, + min: old_day, + max: today, + values: [ today - (7*24*60*60)*1000, today ], + step: 24*60*60*1000, + slide: function( event, ui ) { + $( "#amount" ).val( new Date(ui.values[ 0 ]).toLocaleDateString() + " - " + new Date(ui.values[ 1 ]).toLocaleDateString() ); + } + }); - function randNum(){ - return ((Math.floor( Math.random()* (1+40-20) ) ) + 20)* 1200; - } + $( "#amount" ).val( new Date($( ".sliderRange" ).slider( "values", 0 )).toLocaleDateString() + + " - " + new Date($( ".sliderRange" ).slider( "values", 1 )).toLocaleDateString() ); + + function randNum(){ + return ((Math.floor( Math.random()* (1+40-20) ) ) + 20)* 1200; + }