From 9ee649ed7627a7531c09a3b84c56465218caeebf Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun 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 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'data/script.js') 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'); }); -- cgit v1.2.3