Yoji SHIDARA
null+****@clear*****
Tue Aug 21 17:22:04 JST 2012
Yoji SHIDARA 2012-08-21 17:22:04 +0900 (Tue, 21 Aug 2012) New Revision: 3b314c800b3c07ff045b7691ada59378d7fafbd0 https://github.com/nroonga/norema/commit/3b314c800b3c07ff045b7691ada59378d7fafbd0 Log: Use scroll spy Modified files: lib/server.js public/css/norema.css public/js/norema.js views/layout.jade views/search.jade Modified: lib/server.js (+1 -1) =================================================================== --- lib/server.js 2012-08-21 16:46:05 +0900 (1368f79) +++ lib/server.js 2012-08-21 17:22:04 +0900 (855509a) @@ -78,7 +78,7 @@ app.get('/search', function(request, response, next) { var options = { q: request.query.query, start: parseInt((request.query.start || '0'), 10), - size: 100, + size: 20, facet: 'path' }; Modified: public/css/norema.css (+1 -1) =================================================================== --- public/css/norema.css 2012-08-21 16:46:05 +0900 (0d00078) +++ public/css/norema.css 2012-08-21 17:22:04 +0900 (458678d) @@ -1,5 +1,5 @@ body { - margin-top: 60px; + padding-top: 60px; } .search-on-top { Modified: public/js/norema.js (+9 -0) =================================================================== --- public/js/norema.js 2012-08-21 16:46:05 +0900 (a40d50d) +++ public/js/norema.js 2012-08-21 17:22:04 +0900 (a90004f) @@ -1,3 +1,12 @@ $(document).ready(function($) { + var offset = 50; + $('#query').focus(); + + // scroll spy + $('.side-nav li a').click(function(event) { + event.preventDefault(); + $($(this).attr('href'))[0].scrollIntoView(); + scrollBy(0, -offset); + }); }); Modified: views/layout.jade (+1 -1) =================================================================== --- views/layout.jade 2012-08-21 16:46:05 +0900 (98334d5) +++ views/layout.jade 2012-08-21 17:22:04 +0900 (77d2e80) @@ -8,7 +8,7 @@ html script(src="/js/bootstrap.min.js", type="text/javascript") script(src="/js/norema.js", type="text/javascript") - body + body('data-spy'='scroll', 'data-target'='.side-nav', 'data-offset'='60') .navbar.navbar-fixed-top .navbar-inner .container Modified: views/search.jade (+9 -2) =================================================================== --- views/search.jade 2012-08-21 16:46:05 +0900 (06de8d3) +++ views/search.jade 2012-08-21 17:22:04 +0900 (3008ba1) @@ -24,7 +24,7 @@ block content if records.length > 0 include pager each record, index in records - .record + section.record(id=record.id) h2 a(href="http://nodejs.org/docs/latest/api/all.html#all_"+titleToId(record.data.title), target="_blank")= record.data.title p.path @@ -39,7 +39,7 @@ block content include pager .span3 - .side-nav('data-spy'='affix') + .side-nav('data-spy'='affix', style='width: 220px;') if pathFacets.length > 0 .well(style="padding: 8px 0;") ul.nav.nav-list @@ -49,3 +49,10 @@ block content = facet.value | span.badge.badge-info= facet.count + if records.length > 0 + .well(style="padding: 8px 0;") + ul.nav.nav-list + each record, index in records + li + a(href='#'+record.id) + = record.data.title -------------- next part -------------- HTML����������������������������... 다운로드