-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbluebird.html
187 lines (186 loc) · 5.92 KB
/
bluebird.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<html>
<head>
<title>Blue Bird: Simple Twitter Sentiment Analysis</title>
<script type="text/javascript" src="static/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="static/jquery.qtip-1.0.0-rc3.min.js">
</script>
<style type="text/css">
div.wrapper {
width: 600px;
margin: 10px auto;
}
label { font-weight: bold; }
input[type=input] { width: 480px; }
input[type=submit] { float: right }
textarea {
float: right;
width: 480px;
height: 100px;
}
select {
float: right;
width: 480px;
}
#top {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
background-color: #4099FF;
border-bottom: 5px solid #989898;
}
a { color: white; font-weight: bold }
.advanced {
float: right;
margin: 1px;
}
#options {
margin-top: 10px;
}
.float {
float: left;
width: 600px;
margin-top: 10px;
}
.floatRight { float: right; }
.hidden { display: none; }
img.result {
height: 100%;
display: block;
margin: auto auto;
}
#downloads {
position: fixed;
bottom: 0px;
right: 0px;
background-color: #989898;
padding-left: 10px;
font-weight: bold;
padding: 10px;
text-align: center;
color: white
}
.help {
float: left;
background-color: white;
color: #4099FF;
font-weight: bold;
padding: 0px 6px;
cursor: help;
margin-right: 5px;
margin-left: -20px;
}
</style>
<script type="text/javascript">
function toggleAdvanced() {
$('#options').slideToggle('slow', function() {
$('img.result').css('margin-top', $('#top').height()+'px');
});
}
$(document).ready(function() {
$('#q-help').qtip({
content: 'A comma seperated list of terms to search twitter for and produce a stacked histogram of the simple sentiment score for these searches.',
style: "blue",
show: 'mouseover',
hide: 'mouseout'
});
$('#labels-help').qtip({
content: 'A comma seperated list of labels. The label displays in the graph in place of the search term entered above. They must be in the same order, the first one displays in the graph instead of the first term, the second in place of the second, etc.',
style: "blue",
show: 'mouseover',
hide: 'mouseout'
});
$('#pos_words-help').qtip({
content: 'A comma seperated list of words that indicate positive sentiment. These words are in addition to the existing list.',
style: "blue",
show: 'mouseover',
hide: 'mouseout'
});
$('#neg_words-help').qtip({
content: 'A comma seperated list of words that indicate negative sentiment. These words are in addition to the existing list.',
style: "blue",
show: 'mouseover',
hide: 'mouseout'
});
$('#service-help').qtip({
content: 'The service to gather to data from, by default the tweepy twitter API.',
style: "blue",
show: 'mouseover',
hide: 'mouseout'
});
});
function download(width, height) {
document.sentimentForm.width.value = width;
document.sentimentForm.height.value = height;
document.sentimentForm.action.value = "download";
document.sentimentForm.submit();
}
</script>
</head>
<body>
<div id="top">
<div id="query" class="wrapper">
<form method="get" id="sentimentForm" name="sentimentForm" action=".">
<input type="input" name="q" value="{{ q }}" />
<div class="help" id="q-help">?</div>
<input type="submit" name="analyze" value="Analyze" /><br/>
Use commas to compare multiple searches. (max 8)
<p class="advanced">
<a href="javascript:toggleAdvanced()">
Show additional options.
</a>
</p>
<div id="options" \\
%if not show_advanced:
class="hidden"\\
%end
>
<div class="float">
<label for="labels">Labels:</label>
<div class="help" id="labels-help">?</div>
<input type="input" name="labels" value="{{ labels }}"
class="floatRight"/>
</div>
<div class="float">
<label for="pos.words">Positive words:</label>
<div class="help" id="pos_words-help">?</div>
<textarea name="pos.words">{{ pos_words }}</textarea>
</div>
<div class="float">
<label for="neg.words">Negative words:</label>
<div class="help" id="neg_words-help">?</div>
<textarea name="neg.words">{{ neg_words }}</textarea>
</div>
<div class="float">
<label for="service">Service:</label>
<div class="help" id="service-help">?</div>
<select name="service">
%for service in SERVICES:
<option value="{{ service[0] }}">{{ service[0] }}</option>
%end
</select>
</div>
<input type="hidden" name="width" value="6" />
<input type="hidden" name="height" value="6" />
<input type="hidden" name="action" value="view" />
<center>
<a href="javascript:toggleAdvanced() ">Hide</a>
</center>
</div>
</form>
</div>
</div>
<img src="{{ graph }}" class="result" />
<div id="downloads">
DOWNLOADS
<div>
<!-- <a href="javascript:download(2, 2)">Small</a> | -->
<a href="javascript:download(4, 4)">Medium</a> |
<a href="javascript:download(6, 6)">Large</a>
</div>
</div>
<script type="text/javascript">
$('img.result').css('margin-top', $('#top').height()+'px')
</script>
</body>
</html>