Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/husmith/hacktown
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ LaGrow committed Oct 25, 2015
2 parents de0ac75 + 3018982 commit ef4f9ee
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 36 deletions.
12 changes: 6 additions & 6 deletions flask/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
63 changes: 33 additions & 30 deletions flask/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ <h1>Twitter Topic Topography</h1>
<div class="row">
<div class="col-md-12" style="padding:0">
<div class ="col-md-4 col-md-push-8" style="padding:0">
<div id="tweeter">
<ul>
<div class="tweet">
<table class = "table" id="tweeter">
<tbody>
</tbody>
</table>
</div>

</ul>
</div>
</div>
<div class="col-md-8 col-md-pull-4" style="padding:0">
<div id='map'></div>
Expand Down Expand Up @@ -138,9 +140,9 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
/*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);
});

Expand Down Expand Up @@ -182,7 +184,7 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
'rgba(255, 40, 20, 1)',
'rgba(255, 0, 0, 1)'
]

var neutral_gradient = [
'rgba(255, 255, 255, 0)',
'rgba(0, 234, 255, 1)',
Expand All @@ -194,7 +196,7 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
]

$("select#ideas").change(function() {

$.ajax({
url: $SCRIPT_ROOT + '/munging',
type: 'GET',
Expand Down Expand Up @@ -222,14 +224,14 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
}
});


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
},
Expand All @@ -245,23 +247,24 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
weight: item.wgt * -100
};
sad_array.push(weightedLoc);
$('#tweeter ul').append('<li id="sad"><h2>' + item.name + '</h2><p>' + item.text + '<p></li>');

$('#tweeter').find('tbody').append('<tr><td id="sad"><strong>' + item.name + '</strong><p>' + item.text + '<p></td></tr>');
} else if (item.wgt > 0) {
var weightedLoc = {
location: coordinates,
weight: item.wgt * 100
};
happy_array.push(weightedLoc);
$('#tweeter ul').append('<li id="happy"><h2>' + item.name + '</h2><p>' + item.text + '<p></li>');
$('#tweeter').find('tbody').append('<tr><td id="happy"><strong>' + item.name + '</strong><p>' + item.text + '<p></td></tr>');
} else if (item.wgt == 0) {
var weightedLoc = {
location: coordinates,
weight: 0
};
neutral_array.push(weightedLoc);
$('#tweeter ul').append('<li id="neutral"><h2>' + item.name + '</h2><p>' + item.text + '<p></li>');
$('#tweeter').find('tbody').append('<tr><td id="neutral"><strong>' + item.name + '</strong><p>' + item.text + '<p></td></tr>');
}

});


Expand All @@ -273,7 +276,7 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
if(typeof happy_heatmap !== 'undefined' ){
happy_heatmap.setMap(null);
}

if(typeof neutral_heatmap !== 'undefined' ){
neutral_heatmap.setMap(null);
}
Expand All @@ -282,7 +285,7 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
$("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,
Expand All @@ -298,7 +301,7 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
gradient: happy_gradient,
opacity: .5
});

neutral_heatmap = new google.maps.visualization.HeatmapLayer({
data: neutral_array,
map: map,
Expand Down Expand Up @@ -329,9 +332,9 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
$("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' ){
Expand All @@ -347,9 +350,9 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
$("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' ){
Expand All @@ -365,9 +368,9 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
$("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' ){
Expand All @@ -383,9 +386,9 @@ <h5 class="text-center">Cody Hatfield, Philp Kriegel, Hannah Smith, Molly Steelh
$("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();
});
}

Expand Down

0 comments on commit ef4f9ee

Please sign in to comment.