23
23
< meta name ="author " content ="enigmaeth, @enigmaeth ">
24
24
< script src ="{{ url_for('static', filename='bower_components/jquery/dist/jquery.js') }} "> </ script >
25
25
< script src ="{{ url_for('static', filename='bower_components/prismjs/prism.js') }} "> </ script >
26
+ < script src ="{{ url_for('static', filename='bower_components/bootstrap/dist/js/bootstrap.min.js') }} "> </ script >
26
27
< link rel ="icon " type ="image/png " sizes ="16x16 " href ="{{ url_for('static', filename='images/favicon.ico') }} ">
27
28
< title > query-server · FOSSASIA</ title >
28
29
</ head >
@@ -63,21 +64,34 @@ <h1><code>query-server</code></h1>
63
64
</ div >
64
65
</ div >
65
66
< br />
66
- < div class ="col-md-10 col-xs-12 col-sm-10 " style ="padding:0; margin: 0 auto; ">
67
- < div class ="btn-toolbar ">
68
- {% for engine in engines_list %}
69
- < button id ="{{engine}} " type ="submit " value ={{ engine }} class ="btn btn-lg search btn-outline ">
70
- {% if engine in ['ask', 'baidu', 'bing', 'yahoo'] %}
71
- < img src ="{{ url_for('static', filename='images/' + engine + '_icon.ico') }} " width ="30px " alt ="{{ engine }} Icon ">
72
- {% else %}
73
- < img src ="{{ url_for('static', filename='images/' + engine + '_icon.png') }} " width ="30px " alt ="{{ engine }} Icon ">
74
- {% endif %}
75
- {{ engine }}
76
- </ button >
77
- {% endfor %}
78
- </ div >
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 >
79
93
</ div >
80
- < div class ="col-xs-2 ">
94
+ < div class ="col-sm-4 col- xs-4 ">
81
95
< div class ="form-group " style ="display:inline-block; margin: 0 auto; min-width:50%; ">
82
96
< label for ="resp "> Max:</ label >
83
97
< select class ="form-control " id ="resp ">
@@ -94,6 +108,9 @@ <h1><code>query-server</code></h1>
94
108
</ select >
95
109
</ div >
96
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
+ </ div >
97
114
</ div >
98
115
</ form >
99
116
</ div >
@@ -141,15 +158,26 @@ <h1><code>query-server</code></h1>
141
158
</ div >
142
159
</ footer >
143
160
< script >
161
+ function update_button ( engine ) {
162
+ var html = ""
163
+ if ( engine == "bing" || engine == "baidu" ||
164
+ engine == "ask" || engine == "yahoo" )
165
+ html = "<img src='static/images/" + engine + "_icon.ico' width='25px'>" ;
166
+ else
167
+ html = "<img src='static/images/" + engine + "_icon.png' width='25px'>" ;
168
+ html += " " + engine ;
169
+ $ ( "#drop_down_text" ) . html ( html ) ;
170
+ $ ( "#engine" ) . val ( engine ) ;
171
+ }
144
172
$ ( function ( ) {
145
173
$ ( '#yandex' ) . prop ( 'disabled' , true ) ;
146
174
$ ( '#yandex' ) . attr ( 'title' , 'Yandex search has been temporarily disabled.' ) ;
147
- $ ( '.btn-toolbar > button.btn ' ) . click ( function ( e ) {
175
+ $ ( '#submitter ' ) . click ( function ( e ) {
148
176
e . preventDefault ( ) ;
149
177
if ( $ ( '#query' ) . val ( ) ) {
150
178
$ ( '#load' ) . show ( ) ;
151
179
$ ( '#feed' ) . hide ( ) ;
152
- var sengine = $ ( this ) . val ( ) ;
180
+ var sengine = $ ( "#engine" ) . val ( ) ;
153
181
var squery = $ ( '#query' ) . val ( ) ;
154
182
var sformat = $ ( ' #format label.active input' ) . val ( ) ;
155
183
var count = $ ( '#resp' ) . val ( ) ;
0 commit comments