Skip to content

Commit 8411d3d

Browse files
committedJan 7, 2013
implement hotosm#19 with dummy json file
1 parent 6907538 commit 8411d3d

File tree

5 files changed

+2393
-2409
lines changed

5 files changed

+2393
-2409
lines changed
 

‎_layouts/front.html

+14-32
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,7 @@ <h4>Common questions</h4>
4545
</div>
4646
</div>
4747
{% include banner.html %}
48-
<script>
49-
// using widget factory
50-
$.widget( "custom.addChapterSection", $.ui.autocomplete, {
51-
_renderMenu: function( ul, items ) {
52-
var that = this,
53-
currentSection = "",
54-
currentChapter = "",
55-
$.each( items, function( index, item ) {
56-
// this creates a list item for the chapter
57-
if (item.chapter != currentChapter) {
58-
ul.append( "<li class='ui-autocomplete-chapter'>" + item.chapter + "</li>" );
59-
currentChapter = item.chapter;
60-
// under that chapter, create a list item for the section
61-
if ( item.section != currentSection ) {
62-
ul.append( "<li class='ui-autocomplete-section'>" + item.section + "</li>" );
63-
currentSection = item.section;
64-
}
65-
}
66-
that._renderItemData( ul, item );
67-
});
68-
}
69-
});
70-
</script>
48+
7149
<script>
7250
// format the search bar
7351
var input = $(".searchbox input[type=text]"),
@@ -85,15 +63,19 @@ <h4>Common questions</h4>
8563
input.removeClass("default-value"); // for darker text
8664
}
8765
});
88-
// autocomplete for search
89-
$( "#search-field" ).addChapeterSection({
90-
autoFocus: true,
91-
delay: 0,
92-
source: function(){
93-
$.getJSON('{{site.baseurl}}/{{page.lang}}.json',function(data) {
94-
console.log(data);
95-
});
96-
}
66+
67+
$.getJSON("{{site.baseurl}}/{{page.lang}}.json",function(data){
68+
var destination;
69+
70+
$( "#search-field" ).autocomplete({
71+
autoFocus: true,
72+
delay: 0,
73+
source: data,
74+
select: function(event, o) {
75+
destination = '{{site.baseurl}}/' + o.item.url;
76+
window.location = destination;
77+
}
78+
});
9779
});
9880

9981
</script>

‎en.json

+5-14
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,21 @@
22
{
33
"label":"Adding Your First Points",
44
"section":"",
5-
"chapter":"beginner",
6-
"url":"en/beginner/walking-papers/adding-your-first-points"
5+
"url":"en/beginner/walking-papers/#adding-your-first-points"
76
},
87
{
98
"label":"Add Bing Imagery",
109
"section":"Change JOSM settings",
11-
"chapter":"beginner",
12-
"url":"add-bing-imagery"
10+
"url":"en/beginner/start-josm/#add-bing-imagery"
1311
},
1412
{
1513
"label":"Add presets",
1614
"section":"Change JOSM settings",
17-
"chapter":"beginner",
18-
"url":"add-presets"
15+
"url":"en/beginner/start-josm/#add-presets"
1916
},
2017
{
2118
"label":"Add Walking Papers Plugin",
2219
"section":"Change JOSM settings",
23-
"chapter":"beginner",
24-
"url":"add-walking-papers-plugin"
25-
},
26-
{
27-
"label":"Add Presets",
28-
"section":"Learn Basic Drawing with JOSM",
29-
"chapter":"beginner",
30-
"url":"add-presets"
20+
"url":"en/beginner/start-josm/#add-walking-papers-plugin"
3121
}
22+
]

‎images/dot-hover.png

182 Bytes
Loading

‎style.css

+24-13
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,19 @@ body {
248248

249249
/* contribute banner */
250250
.banner {
251-
background:url(./images/dot.png) white;
252-
font-weight:bold;
253-
text-align:center;
251+
background:url(./images/dot.png) repeat white;
254252
}
255253
.banner:hover {
256-
color:#404040;
254+
background:url(./images/dot-hover.png) repeat white;
257255
}
258256
.banner span {
259257
display:block;
258+
font-weight:bold;
259+
text-align:center;
260260
padding:12px;
261-
transition: all 200ms linear;
262-
-moz-transition: all 200ms linear;
263-
-webkit-transition: all 200ms linear;
264-
-o-transition: all 200ms linear;
265261
}
266262
.banner span:hover {
263+
background:#fff;
267264
background:rgba(255,255,255,0.6);
268265
color:#fc3f51;
269266
}
@@ -320,13 +317,27 @@ body {
320317
}
321318

322319
/* search drop-down */
323-
.ui-autocomplete-category {
324-
font-weight: bold;
325-
padding: .2em .4em;
326-
margin: .8em 0 .2em;
327-
line-height: 1.5;
320+
.ui-helper-hidden-accessible {
321+
display:none;
322+
}
323+
.ui-menu {
324+
border:2px solid #fff;
325+
width:20%;
326+
background:#fff;
327+
cursor:pointer;
328328
}
329+
.ui-menu-item{
330+
padding:10px;
331+
font-family:'Source Sans Pro',sans-serif ;
332+
}
333+
.ui-menu-item:hover, .ui-menu-item:focus {
334+
background:#79bc5f;
335+
}
336+
.ui-menu-item a:hover, .ui-menu-item a:focus {
337+
color:#404040;
338+
}
329339

340+
/* faq */
330341
.faqbox h4 {margin-bottom:46px;}
331342
.faq li {
332343
margin:4px 0;

‎vendor/jquery-ui-1.9.2.custom.js

+2,350-2,350
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.