Skip to content

Commit 0eabe4b

Browse files
committed
Add feature: live search for side nav TOC
+ replace Google Search with List.js live search + drop 'Philosopher' font ...not sure if you would like to keep 'Philosopher' font on the hero "Codeception" text
1 parent c7eba18 commit 0eabe4b

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

_layouts/bootstrap.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
2424
<script src="/js/jquery.toc.min.js" type="text/javascript" charset="utf-8"></script>
2525
<script src="/js/contributors.js" type="text/javascript" charset="utf-8"></script>
26+
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script>
2627

2728
<!-- Other -->
2829
<link title="Codeception Blog" type="application/rss+xml" rel="alternate" href="/rss.xml">

_layouts/doc.html

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
</div>
1717
<div class="col-sm-4 col-lg-4">
1818

19-
<div id="toc" class="nav"></div>
19+
<div id="searchable">
20+
<input type="search" class="search" placeholder="live search...">
21+
<br>
22+
<!-- toc.js generated nav... -->
23+
<div id="toc" class="nav"></div>
24+
</div> <!-- /#searchable -->
2025

2126
<script type="text/javascript">
2227
$(document).ready(function () {
@@ -25,24 +30,22 @@
2530
'prefix': 'toc',
2631
'container': '#page',
2732
//custom function for anchor name
33+
'anchorName': function(i, heading, prefix) {
2834
return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, '');
2935
},
3036
});
31-
});
32-
</script>
3337

34-
<div class="well">
35-
<script>
36-
(function() {
37-
var cx = '009959493015473517972:mxjflnekt-y';
38-
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
39-
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
40-
'//www.google.com/cse/cse.js?cx=' + cx;
41-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
42-
})();
43-
</script>
44-
<gcse:search></gcse:search>
45-
</div>
38+
// List.js
39+
$('#toc > ul').addClass('list');
40+
$('#toc ul.list li a').addClass('searchitem');
41+
var options = {
42+
valueNames: [ 'searchitem' ]
43+
};
44+
var userList = new List('searchable', options);
45+
// end List.js
46+
47+
}); // docrdy
48+
</script>
4649

4750
</div>
4851
</div>

css/codeception.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ body .hero-unit {
3838
}
3939

4040
body h1, body h2, body h3, body h3 {
41-
font-family: "Philosopher", "Open Sans", "Lucida Grande","Helvetica Neue",Helvetica,Arial,sans-serif;
41+
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
4242
color: #45414B;
4343
}
4444

@@ -299,3 +299,14 @@ ul.navbar-nav {
299299
overflow: visible!important;
300300
}
301301
}
302+
#searchable > .search {
303+
width: 100%;
304+
height: 45px;
305+
color: #333;
306+
text-indent: 16px;
307+
border-radius: 24px;
308+
border: 1px solid #ddd;
309+
box-shadow: inset 0 1px 1px hsla(0, 0%, 0%, 0.075);
310+
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
311+
outline: none;
312+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy