@@ -64,52 +64,70 @@ <h1><code>query-server</code></h1>
64
64
</ div >
65
65
</ div >
66
66
< br />
67
- < div class ="col-sm-4 col-xs-6 " style ="padding:0; margin: 0 auto; ">
68
- < div class ="dropdown ">
69
- < label > Engine:</ label > < br />
70
- < button class ="btn btn-primary dropdown-toggle " type ="button " data-toggle ="dropdown ">
71
- < span id ="drop_down_text ">
72
- < img src ='static/images/google_icon.png ' width ='25px '> google
73
- </ span >
74
-
75
- < span class ="caret "> </ span >
76
- </ button >
77
- < input type ="hidden " id ="engine " value ="google ">
78
- < ul class ="dropdown-menu ">
79
- {% for engine in engines_list %}
80
- < li onClick ="update_button('{{ engine }}') " id ="{{engine}} ">
81
- < a style ="cursor:pointer ">
82
- {% if engine in ['ask', 'baidu', 'bing', 'yahoo'] %}
83
- < img src ="{{ url_for('static', filename='images/' + engine + '_icon.ico') }} " width ="15px ">
84
- {% else %}
85
- < img src ="{{ url_for('static', filename='images/' + engine + '_icon.png') }} " width ="15px ">
86
- {% endif %}
87
- {{ engine }}
88
- </ a >
89
- </ li >
90
- {% endfor %}
91
- </ ul >
92
- </ div >
93
- </ div >
94
- < div class ="col-sm-4 col-xs-4 ">
95
- < div class ="form-group " style ="display:inline-block; margin: 0 auto; min-width:50%; ">
96
- < label for ="resp "> Max:</ label >
97
- < select class ="form-control " id ="resp ">
98
- < option > 10</ option >
99
- < option > 20</ option >
100
- < option > 30</ option >
101
- < option > 40</ option >
102
- < option > 50</ option >
103
- < option > 60</ option >
104
- < option > 70</ option >
105
- < option > 80</ option >
106
- < option > 90</ option >
107
- < option > 100</ option >
108
- </ select >
67
+
68
+ < div class ="row ">
69
+ < div class ="col-sm-3 col-xs-6 " style ="padding:0; margin: 0 auto; ">
70
+ < div class ="dropdown ">
71
+ < label > Engine:</ label > < br />
72
+ < button class ="btn btn-primary dropdown-toggle " type ="button " data-toggle ="dropdown ">
73
+ < span id ="drop_down_text ">
74
+ < img src ='static/images/google_icon.png ' width ='25px '> google
75
+ </ span >
76
+
77
+ < span class ="caret "> </ span >
78
+ </ button >
79
+ < input type ="hidden " id ="engine " value ="google ">
80
+ < ul class ="dropdown-menu ">
81
+ {% for engine in engines_list %}
82
+ < li onClick ="update_button('{{ engine }}') " id ="{{engine}} ">
83
+ < a style ="cursor:pointer ">
84
+ {% if engine in ['ask', 'baidu', 'bing', 'yahoo'] %}
85
+ < img src ="{{ url_for('static', filename='images/' + engine + '_icon.ico') }} " width ="15px ">
86
+ {% else %}
87
+ < img src ="{{ url_for('static', filename='images/' + engine + '_icon.png') }} " width ="15px ">
88
+ {% endif %}
89
+ {{ engine }}
90
+ </ a >
91
+ </ li >
92
+ {% endfor %}
93
+ </ ul >
94
+ </ div >
95
+ </ div >
96
+ < div class ="col-sm-5 col-xs-6 ">
97
+ < label > Type:</ label > < br />
98
+ < div id ="type " class ="btn-group btn-group-vertical " style ="display:inline-flex;padding:0; margin: 0 auto; " data-toggle ="buttons ">
99
+ < label class =" active typeButton " style ="padding:10px; "> General< br />
100
+ < input type ="radio " name = "stype " value ="" autocomplete ="off " checked >
101
+ </ label >
102
+ < label class =" typeButton " style ="padding:10px; "> Images< br />
103
+ < input type ="radio " name = "stype " value ="isch " autocomplete ="off ">
104
+ </ label >
105
+ < label class =" typeButton " style ="padding:10px; ">
106
+ Video< br />
107
+ < input type ="radio " name = "stype " value ="vid " autocomplete ="off ">
108
+ </ label >
109
+ </ div >
110
+ </ div >
111
+ < div class ="col-sm-2 col-xs-6 ">
112
+ < div class ="form-group " style ="display:inline-block; margin: 0 ; min-width:50%; ">
113
+ < label for ="resp "> Max:</ label >
114
+ < select class ="form-control " id ="resp ">
115
+ < option > 10</ option >
116
+ < option > 20</ option >
117
+ < option > 30</ option >
118
+ < option > 40</ option >
119
+ < option > 50</ option >
120
+ < option > 60</ option >
121
+ < option > 70</ option >
122
+ < option > 80</ option >
123
+ < option > 90</ option >
124
+ < option > 100</ option >
125
+ </ select >
126
+ </ div >
127
+ </ div >
128
+ < div class ="col-sm-2 col-xs-6 " style ="margin-top:20px; ">
129
+ < input type ="submit " value ="Submit " id ="submitter " class ="btn btn-primary "/>
109
130
</ div >
110
- </ div >
111
- < div class ="col-sm-4 col-xs-s6 " style ="margin-top:20px; ">
112
- < input type ="submit " value ="Submit " id ="submitter " class ="btn btn-primary "/>
113
131
</ div >
114
132
</ div >
115
133
</ form >
@@ -177,10 +195,10 @@ <h1><code>query-server</code></h1>
177
195
$ ( '#feed' ) . hide ( ) ;
178
196
var sengine = $ ( "#engine" ) . val ( ) ;
179
197
var squery = $ ( '#query' ) . val ( ) ;
198
+ var stype = $ ( "input[name=stype]:checked" ) . val ( )
180
199
var sformat = $ ( ' #format label.active input' ) . val ( ) ;
181
200
var count = $ ( '#resp' ) . val ( ) ;
182
- var urlloc = window . location . href . split ( / \? | # / ) [ 0 ] + "api/v1/search/" + sengine +
183
- "?query=" + squery + "&format=" + sformat + "&num=" + count ;
201
+ var urlloc = window . location . href . split ( / \? | # / ) [ 0 ] + "api/v1/search/" + sengine + "?query=" + squery + "&type=" + stype + "&format=" + sformat + "&num=" + count ;
184
202
$ . ajax ( {
185
203
url : urlloc ,
186
204
type : 'GET' ,
@@ -209,10 +227,21 @@ <h1><code>query-server</code></h1>
209
227
$ ( '.formatButton' ) . click ( function ( e ) {
210
228
e . preventDefault ( ) ;
211
229
if ( ! $ ( this ) . hasClass ( 'active' ) ) {
212
- $ ( ".active" ) . removeClass ( "active" ) ;
230
+ $ ( ".formatButton .active" ) . removeClass ( "active" ) ;
231
+ $ ( this ) . addClass ( 'active' )
232
+ }
233
+ } ) ;
234
+
235
+ /*
236
+ $('.typeButton').click(function (e) {
237
+ e.preventDefault();
238
+ if (!$(this).hasClass('active')) {
239
+ $(".typeButton .active").removeClass("active");
213
240
$(this).addClass('active')
214
241
}
215
242
});
243
+ */
244
+
216
245
217
246
$ ( window ) . keydown ( function ( event ) {
218
247
if ( event . keyCode == 13 ) {
0 commit comments