Skip to content

Commit f392993

Browse files
added search box
related to rossengeorgiev#35
1 parent 95f786e commit f392993

File tree

3 files changed

+77
-5
lines changed

3 files changed

+77
-5
lines changed

css/main.css

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ header {
180180
line-height: normal;
181181
margin-top: 6px;
182182
position: absolute;
183-
left: 30px;
183+
left: 225px;
184184
height: 40px;
185-
text-align: right;
185+
text-align: left;
186186
cursor: pointer;
187187
}
188188
header > div {
@@ -210,6 +210,29 @@ header > div {
210210
overflow: hidden;
211211
}
212212

213+
header .search {
214+
float: left;
215+
width: 190px;
216+
margin-top: 10px;
217+
}
218+
219+
header .search form {
220+
position: relative;
221+
}
222+
header .search form input {
223+
position: absolute;
224+
border-radius: 100px;
225+
}
226+
header .search form input[type='text'] {
227+
left: 0;
228+
padding-left: 10px;
229+
padding-right: 35px;
230+
width: 143px;
231+
}
232+
header .search form input[type='submit'] {
233+
right: 0;
234+
}
235+
213236
.nav {
214237
list-style: none outside none;
215238
margin: 0;
@@ -224,7 +247,7 @@ header > div {
224247

225248
#locate-me {
226249
position: absolute;
227-
left: 0px;
250+
left: 195px;
228251
top: 12px;
229252
font-size: 25px;
230253
height: 25px;
@@ -599,6 +622,33 @@ header > div {
599622
display: none;
600623
}
601624

625+
@media only screen and (max-width: 600px) {
626+
#app_name {
627+
left: 150px;
628+
}
629+
#locate-me {
630+
left: 120px;
631+
}
632+
header .search {
633+
width: 110px;
634+
}
635+
header .search form input[type='text'] {
636+
width: 63px;
637+
}
638+
}
639+
640+
@media only screen and (max-width: 500px) {
641+
#app_name {
642+
left: 30px;
643+
}
644+
#locate-me {
645+
left: 0px;
646+
}
647+
header .search {
648+
display: none;
649+
}
650+
}
651+
602652
@media only screen and (min-width: 361px) {
603653
.portrait { display: none; }
604654
.landscape { display: block; }
@@ -693,7 +743,7 @@ header > div {
693743
}
694744
#main .data dl > dt {
695745
color: #000;
696-
line-height: 11px;
746+
l120ne-height: 11px;
697747
margin-top: 15px;
698748
font-weight: bold;
699749
font-size: 14px;

index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535

3636
<header style="display: none">
3737
<div class="container">
38+
<div class="search">
39+
<form>
40+
<input type='text' value="" />
41+
<input type='submit' value="S" />
42+
</form>
43+
</div>
3844
<ol class="nav">
3945
<li class="home"><i class="icon-habhub"></i></li>
4046
<li class="chasecar" style="display: none"><i class="icon-car"></i></li>
@@ -52,7 +58,7 @@
5258
<li class="about last"><i class="icon-question"></i></li>
5359
</ol>
5460
<span id="locate-me" style="display: none"><i class="icon-target"></i></span>
55-
<span id="app_name"><b>mobile<br/>tracker</b></span>
61+
<span id="app_name"><b>no<br/>location</b></span>
5662
</div>
5763
</header>
5864

js/app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ function load_hash(no_refresh) {
125125
break;
126126
case "q":
127127
def.query = v;
128+
$("header .search input[type='text']").val(v);
128129
break;
129130
case "nyan":
130131
def[k] = !!parseInt(v);
@@ -1003,4 +1004,19 @@ $(window).ready(function() {
10031004
map.overlayMapTypes.setAt("0", weatherOverlay);
10041005
}
10051006
});
1007+
1008+
$("header .search form").on('submit', function(e) {
1009+
e.preventDefault();
1010+
1011+
var text = $("header .search input[type='text']").val();
1012+
1013+
if(text === wvar.query) return;
1014+
1015+
wvar.query = text;
1016+
stopFollow();
1017+
zoomed_in = false;
1018+
wvar.zoom = true;
1019+
1020+
clean_refresh(wvar.mode, true);
1021+
});
10061022
});

0 commit comments

Comments
 (0)