From 9ee649ed7627a7531c09a3b84c56465218caeebf Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <lars@6xq.net>
Date: Tue, 28 Apr 2015 13:22:01 +0200
Subject: Rich-view by default

Get rid of table and popup layout.
---
 data/script.js | 49 ++++++++++++++++++-------------------------------
 data/style.css | 49 ++++++-------------------------------------------
 2 files changed, 24 insertions(+), 74 deletions(-)

(limited to 'data')

diff --git a/data/script.js b/data/script.js
index 50c06ac..94175b1 100644
--- a/data/script.js
+++ b/data/script.js
@@ -1,35 +1,22 @@
 $(document).ready (function () {
-	$('#algo').DataTable ({
-		paging: false,
-		"columnDefs": [],
-	});
-	$('#algo tr').click (function () {
-		var data = $(this).data ('proto');
-		$('#popup h2').text (data.name);
-		$('#popup .longname').text (data.longname);
-
-		$('#popup .title').text (data.title);
-		$('#popup .year').text (data.year);
-		$('#popup .doi').text ('doi:' + data.doi);
-		$('#popup .doi').attr ('href', 'http://doi.org/' + data.doi);
-		$('#popup .scholar').attr ('href', 'http://scholar.google.com/scholar?q=' + encodeURIComponent (data.title));
-
-		$('#popup .description').text (data.description);
-
-		$('#popup').fadeIn ('normal');
-		$('#background').fadeIn ('normal');
-	});
-	/* hide popup window */
-	function hide () {
-		$('#popup').fadeOut ('normal');
-		$('#background').fadeOut ('normal');
+	function sortproto (by) {
+		var protolist = $('#protocols');
+		var items = protolist.children ('.protocol');
+		items.detach ().sort (function (nodeA, nodeB) {
+			var a = $(nodeA).data (by);
+			var b = $(nodeB).data (by);
+			if (a > b) {
+				return 1;
+			} else if (a < b) {
+				return -1;
+			} else {
+				return 0;
+			}
+		});
+		protolist.append (items);
 	}
-	$('#background').click (function () {
-		hide ();
-	});
-	$(document).keyup (function (e) {
-		if (e.keyCode == 27) {
-			hide ();
-		}
+	$('#sort').change (function () {
+		sortproto ($(this).val ());
 	});
+	sortproto ('name');
 });
diff --git a/data/style.css b/data/style.css
index 41b5a9e..cc65ba2 100644
--- a/data/style.css
+++ b/data/style.css
@@ -1,47 +1,10 @@
-td.features ul {
-	list-style-type: none;
-	margin: 0;
-	padding: 0;
+#protosort {
+	text-align: right;
 }
 
-#popup {
-	display: none;
-	position: fixed;
-	background-color: #fff;
-	top: 25%;
-	left: 25%;
-	width: 50%;
-	padding: 2em;
+.protocol dt {
+	font-weight: lighter;
 }
-
-#background {
-	display: none;
-	position: fixed;
-	top: 0;
-	left: 0;
-	width: 100%;
-	height: 100%;
-	background-color: #000;
-	opacity: 0.5;
-}
-
-.ref {
-	list-style-type: none;
-	margin: 0;
-	padding: 0;
-}
-
-.ref li {
-	display: inline;
-	margin: 0;
-	padding: 0;
+.protocol dt:after {
+	content: ":";
 }
-
-.ref li:after {
-	content: ", ";
-}
-
-.ref .title {
-	font-style: italic;
-}
-
-- 
cgit v1.2.3