From b24b8d0026c1bdb43a6a5f05d71afbef6957bae1 Mon Sep 17 00:00:00 2001 From: Hannah Smith Date: Sun, 25 Oct 2015 02:26:06 -0700 Subject: [PATCH 1/3] fix --- flask/site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask/site.py b/flask/site.py index 1459142..9e1f973 100644 --- a/flask/site.py +++ b/flask/site.py @@ -58,7 +58,7 @@ def calc_tweets(): result = [] c = 0 while c < 10000: - res = es.search(index="index", body={"query": {"match_all": {}}}, doc_type=query, size=1000, from=c)["hits"]["hits"] + res = es.search(index="index", body={"query": {"match_all": {}}}, doc_type=query, size=1000, from_=c)["hits"]["hits"] for r in res: a = {"lat": r["_source"]["lat"], "lng": r["_source"]["lng"], "wgt": r["_source"]["score"], "name": r["_source"]["name"], "text": r["_source"]["text"]} result.append(a) From e946b4c76a7aa8717b3c0332464c6f364413c17b Mon Sep 17 00:00:00 2001 From: Hannah Smith Date: Sun, 25 Oct 2015 08:57:25 -0700 Subject: [PATCH 2/3] tbl --- flask/templates/index.html | 64 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/flask/templates/index.html b/flask/templates/index.html index 530fe0c..a09fff0 100644 --- a/flask/templates/index.html +++ b/flask/templates/index.html @@ -76,11 +76,13 @@

Twitter Topic Topography

-
-
    +
    + + + +
    +
    -
-
@@ -107,9 +109,9 @@

Holla

/*global google*/ var map, sad_heatmap, happy_heatmap, neutral_heatmap; $SCRIPT_ROOT = {{request.script_root | tojson | safe}}; - + $(function() { - var temp="Choose!"; + var temp="Choose!"; $("#ideas").val(temp); }); @@ -151,7 +153,7 @@

Holla

'rgba(255, 40, 20, 1)', 'rgba(255, 0, 0, 1)' ] - + var neutral_gradient = [ 'rgba(255, 255, 255, 0)', 'rgba(0, 208, 229, 1)', @@ -163,7 +165,7 @@

Holla

] $("select#ideas").change(function() { - + $.ajax({ url: $SCRIPT_ROOT + '/munging', type: 'GET', @@ -192,14 +194,14 @@

Holla

} }); - + var $value = $('#ideas option:selected').text(); $("#tweeter a").attr("href", "https://twitter.com/search?q=" + $value); - $('#tweeter ul').empty(); + $('#tweeter').find('tbody').empty(); $.ajax({ url: $SCRIPT_ROOT + '/_tweet_calcs', //TO DO type: 'GET', - dataType: 'json', + dataType: 'json', data: { 'query': $value }, @@ -209,7 +211,6 @@

Holla

var sad_array = []; var neutral_array = []; $.each(json.result, function(i, item) { - console.log(item.name); var coordinates = new google.maps.LatLng(parseInt(item.lat), parseInt(item.lng)); if (item.wgt < 0) { var weightedLoc = { @@ -217,23 +218,24 @@

Holla

weight: item.wgt * -100 }; sad_array.push(weightedLoc); - $('#tweeter ul').append('
  • ' + item.name + '

    ' + item.text + '

  • '); + + $('#tweeter').find('tbody').append('' + item.name + '

    ' + item.text + '

    '); } else if (item.wgt > 0) { var weightedLoc = { location: coordinates, weight: item.wgt * 100 }; happy_array.push(weightedLoc); - $('#tweeter ul').append('

  • ' + item.name + '

    ' + item.text + '

  • '); + $('#tweeter').find('tbody').append('' + item.name + '

    ' + item.text + '

    '); } else if (item.wgt == 0) { var weightedLoc = { location: coordinates, weight: 0 }; neutral_array.push(weightedLoc); - $('#tweeter ul').append('

  • ' + item.name + '

    ' + item.text + '

  • '); + $('#tweeter').find('tbody').append('' + item.name + '

    ' + item.text + '

    '); } - + }); @@ -245,7 +247,7 @@

    Holla

    if(typeof happy_heatmap !== 'undefined' ){ happy_heatmap.setMap(null); } - + if(typeof neutral_heatmap !== 'undefined' ){ neutral_heatmap.setMap(null); } @@ -254,7 +256,7 @@

    Holla

    $("button#sadness").css("background-color", "#FFFFFF"); $("button#neutral").css("background-color", "#FFFFFF"); $("button#happy").css("background-color", "#FFFFFF"); - + sad_heatmap = new google.maps.visualization.HeatmapLayer({ data: sad_array, map: map, @@ -270,7 +272,7 @@

    Holla

    gradient: happy_gradient, opacity: .5 }); - + neutral_heatmap = new google.maps.visualization.HeatmapLayer({ data: neutral_array, map: map, @@ -301,9 +303,9 @@

    Holla

    $("button#sadness").css("background-color", "#FFFFFF"); $("button#all").css("background-color", "#FFFFFF"); $("button#neutral").css("background-color", "#FFFFFF"); - $("li#happy").show(); - $("li#neutral").hide(); - $("li#sad").hide(); + $("td#happy").show(); + $("td#neutral").hide(); + $("td#sad").hide(); }); $("button#sadness").click(function() { if(typeof sad_heatmap !== 'undefined' ){ @@ -319,9 +321,9 @@

    Holla

    $("button#happy").css("background-color", "#FFFFFF"); $("button#all").css("background-color", "#FFFFFF"); $("button#neutral").css("background-color", "#FFFFFF"); - $("li#happy").hide(); - $("li#neutral").hide(); - $("li#sad").show(); + $("td#happy").hide(); + $("td#neutral").hide(); + $("td#sad").show(); }); $("button#all").click(function() { if(typeof sad_heatmap !== 'undefined' ){ @@ -337,9 +339,9 @@

    Holla

    $("button#sadness").css("background-color", "#FFFFFF"); $("button#happy").css("background-color", "#FFFFFF"); $("button#neutral").css("background-color", "#FFFFFF"); - $("li#neutral").show(); - $("li#happy").show(); - $("li#sad").show(); + $("td#neutral").show(); + $("td#happy").show(); + $("td#sad").show(); }); $("button#neutral").click(function() { if(typeof sad_heatmap !== 'undefined' ){ @@ -355,9 +357,9 @@

    Holla

    $("button#sadness").css("background-color", "#FFFFFF"); $("button#happy").css("background-color", "#FFFFFF"); $("button#all").css("background-color", "#FFFFFF"); - $("li#neutral").show(); - $("li#happy").hide(); - $("li#sad").hide(); + $("td#neutral").show(); + $("td#happy").hide(); + $("td#sad").hide(); }); } From fe83651e861055efd453e1b2ef559a51bbc1b2ff Mon Sep 17 00:00:00 2001 From: Hannah Smith Date: Sun, 25 Oct 2015 08:58:27 -0700 Subject: [PATCH 3/3] tbl --- flask/static/css/styles.css | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/flask/static/css/styles.css b/flask/static/css/styles.css index 29b9d0d..a97007a 100644 --- a/flask/static/css/styles.css +++ b/flask/static/css/styles.css @@ -11,6 +11,9 @@ footer { background: url(http://www.pixeden.com/media/k2/galleries/112/003-subtle-light-pattern-background-texture.jpg); margin: 40px 0px; } +table#tweeter strong{ + text-transform: uppercase; +} #bad{ text-align: center; @@ -54,15 +57,12 @@ h3{ z-index: 5; } -#tweeter{ - border:1px solid #000; - font-family:arial; +.tweet{ + border:1px solid #fefefe; height:600px; - width:100%; background: white; } -ul{ - list-style:none; +.tweet{ max-height:598px; margin:0; overflow:auto; @@ -95,7 +95,3 @@ p{ h2{ margin: 10px; } - - - -