Skip to content

Commit

Permalink
Search & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Jun 4, 2019
1 parent 822c710 commit 083d392
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 15 deletions.
2 changes: 1 addition & 1 deletion data.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(atomics
:link "https://shinmera.github.io/atomics"
:description "Thin wrapper over atomic operators such as Compare and Swap (CAS)."
:support (:allegro :ccl :ecl :lispworks (:sbcl :notes "foo")))
:support (:allegro :ccl :ecl :lispworks :sbcl))

(definitions
:link "https://shinmera.github.io/definitions"
Expand Down
13 changes: 5 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta charset="utf-8"/>
<meta charset="utf-8">
<title>Common Lisp Portability Library Status</title>
<link rel="stylesheet" href="style.css"/>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main>
<header>
<input type="text" class="filter" placeholder="Find..." autofocus=""/>
<input type="text" class="filter" placeholder="Find..." autofocus="">
<ul class="support-listing header">
<li class="support abcl" title="ABCL">
<span class="name">ABCL</span>
Expand Down Expand Up @@ -176,8 +176,6 @@ <h2 class="name"><a href="https://shinmera.github.io/atomics">ATOMICS</a></h2>
<span class="implementation name">SBCL</span>
<span class="completeness">1.0</span>

<a class="note" href="#atomics-note-sbcl">*</a>

</li>

<li class="support scl" title="SCL" style="background: rgb(255,0,0)" data-completeness="0.0">
Expand Down Expand Up @@ -228,8 +226,6 @@ <h2 class="name"><a href="https://shinmera.github.io/atomics">ATOMICS</a></h2>




<li class="note" id="atomics-note-sbcl"><span class="implementation name">SBCL</span>foo</li>



Expand Down Expand Up @@ -1622,5 +1618,6 @@ <h2 class="name"><a href="https://common-lisp.net/project/usocket/">USOCKET</a><
<footer>
Made by <a href="https://shinmera.com">Nicolas Hafner</a> and <a href="https://github.com/shinmera/portability">contributors</a>.
</footer>
<script type="text/javascript" src="search.js"></script>
</body>
</html>
9 changes: 4 additions & 5 deletions make.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@
(with-open-file (stream output :direction :output
:element-type 'character
:if-exists :supersede)
(let ((plump:*tag-dispatchers* plump:*xml-tags*))
(plump:serialize (clip:process (plump:parse (pathname template))
:implementations *known-implementations*
:libraries libraries)
stream))))
(plump:serialize (clip:process (plump:parse (pathname template))
:implementations *known-implementations*
:libraries libraries)
stream)))

(defun make ()
(compile-index (read-data)))
44 changes: 44 additions & 0 deletions search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class Search{
constructor(root){
var self = this;
self.filter = root.querySelector("input.filter");
self.list = root.querySelector(".libraries");
self.relevant = [ ".name", ".description" ];

self.filter.addEventListener("input", function(){
self.filterResults(self.filter.value);
});
}

isCandidate(text, tokens){
var lower = text.toLowerCase();
for(var i=0; i<tokens.length; ++i){
if(lower.indexOf(tokens[i]) != -1)
return true;
};
return false;
}

filterResults(filter){
if(filter == ""){
for(var i=0; i<this.list.children.length; ++i){
child.style.display = "block";
}
return;
}

var tokens = filter.split(/[,. ]+/);
for(var i=0; i<this.list.children.length; ++i){
var child = this.list.children[i];
var text = "";
this.relevant.forEach(function(item){
text += child.querySelector(item).innerText;
});
child.style.display = (this.isCandidate(text, tokens))? "block" : "none";
}
}
}

window.addEventListener("DOMContentLoaded", function(){
search = new Search(document.querySelector("main"));
});
3 changes: 2 additions & 1 deletion template.ctml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta charset="utf-8"/>
<title>Common Lisp Portability Library Status</title>
Expand Down Expand Up @@ -44,5 +44,6 @@
<footer>
Made by <a href="https://shinmera.com">Nicolas Hafner</a> and <a href="https://github.com/shinmera/portability">contributors</a>.
</footer>
<script type="text/javascript" src="search.js"></script>
</body>
</html>

0 comments on commit 083d392

Please sign in to comment.