css: search done

git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@55 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
Claudio Maggioni 2018-11-08 08:21:27 +00:00
parent 5729f4976a
commit 8ce0dc1f8d
9 changed files with 77 additions and 61 deletions

View File

@ -3,7 +3,10 @@
<a href="/index.html"><img src="/assets/style/logo_white.png" height="50"></a>
</div>
<div class="fill-space"></div>
<div class="search-box"><input type="text" id="search-bar"><label for="search-bar"><img src="/assets/style/search_icon.png"></label></div>
<div class="search-box"><input type="text" id="search-bar"><label for="search-bar"><img src="/assets/style/search_icon.png"></label>
<ul id="search-results">
</ul>
</div>
<nav class="nav-menu">
<div>Learn
<ul>

View File

@ -9,5 +9,27 @@
{{ content }}
</main>
{% include footer.html %}
<script src="https://cdn.rawgit.com/christian-fei/Simple-Jekyll-Search/master/dest/simple-jekyll-search.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var searchBar = document.getElementById('search-bar');
var results = document.getElementById('search-results');
var sjs = SimpleJekyllSearch({
searchInput: searchBar,
resultsContainer: results,
json: '/search.json',
searchResultTemplate:
'<a href="{url}"><h3>{title}</h3><h4>{category}</h4></a>',
success: function(sr) {
results.setAttribute("class", sr.length <= 1 ? "" : "show");
}
});
searchBar.addEventListener('keypress', function () {
sjs.search();
});
});
</script>
</body>
</html>

View File

@ -15,6 +15,31 @@
padding: .5em;
}
.nav-menu div ul, .search-box ul {
/* TODO: if possible, insert a padding-top to move the submenu down such that
the text of the first element starts at the bottom border of the .menuDesktop */
display: none;
position: absolute;
list-style: none;
margin-left: -10px;
background-color: #131313;
z-index: 1;
li {
color: #FFFFFF;
margin: 10px;
}
li:hover {
color: #66aa66;
}
}
.search-box ul.show {
display: block;
}
.nav-menu {
margin-right: 100px;
margin-left: 10px;
@ -33,27 +58,7 @@
text-decoration: none;
color: inherit;
}
ul {
/* TODO: if possible, insert a padding-top to move the submenu down such that
the text of the first element starts at the bottom border of the .menuDesktop */
display: none;
position: absolute;
list-style: none;
margin-left: -10px;
background-color: #131313;
z-index: 1;
li {
color: #FFFFFF;
margin: 10px;
}
li:hover {
color: #66aa66;
}
}
ul:hover {
display: block;
}

View File

@ -1,39 +0,0 @@
---
layout: page
title: Blog
permalink: /blog/
---
<div class="home">
<p>And maybe, maybe, maybe... I guess that would be considered a UFO. A big cotton ball in the sky. Just think about these things in your mind and drop em' on canvas.</p>
<p>We'll take a little bit of Van Dyke Brown. If you've been in Alaska less than a year you're a Cheechako. We touch the canvas, the canvas takes what it wants. Isn't that fantastic that you can create an almighty tree that fast?</p>
<p>La- da- da- da- dah. Just be happy. You gotta think like a tree. You're meant to have fun in life.</p>
<p>
{% highlight bash linenos %}
[Unit]
Description=systemd Unit to automatically start a Bluetooth keyboard
Documentation=https://wiki.archlinux.org/index.php/Bluetooth_Keyboard
Requires=dbus-org.bluez.service
After=dbus-org.bluez.service
ConditionPathExists=/etc/btkbd.conf
ConditionPathExists=/usr/bin/hcitool
ConditionPathExists=/usr/bin/hciconfig
[Service]
Type=oneshot
EnvironmentFile=/etc/btkbd.conf
ExecStart=/usr/bin/hciconfig ${HCIDEVICE} up
# ignore errors on connect, spurious problems with bt?
# so start next command with -
ExecStart=-/usr/bin/hcitool cc ${BTKBDMAC}
[Install]
WantedBy=multi-user.target
{% endhighlight %}
</p>
</div>

View File

@ -1,5 +1,6 @@
---
layout: main
category: nosearch
author: A bunch of people
title: Home page
---

View File

@ -1,4 +1,5 @@
---
category: nosearch
---
@import "global";
@import "header";

View File

@ -1,5 +1,7 @@
---
layout: page
category: Basic commands
tags: directory change navigate
author: Joey Bevilacqua
title: CD
previous-page: pages/cmd/basic/ls.html

View File

@ -1,5 +1,7 @@
---
layout: page
category: Basic commands
tags: directory list
author: Claudio Maggioni
title: LS
next-page: pages/cmd/basic/cd.html

19
site/search.json Normal file
View File

@ -0,0 +1,19 @@
---
layout: null
category: nosearch
author: Claudio Maggioni
---
[
{% for page in site.pages %}
{% if page.category != "nosearch" %}
{
"title" : "{{ page.title | escape }}",
"category" : "{{ page.category }}",
"tags" : "{{ page.tags | join: ', ' }}",
"url" : "{{ page.baseurl }}{{ page.url }}",
"date" : "{{ page.date }}"
},
{% endif %}
{% endfor %}
null
]