]> git.quilime.com - visual-archive.git/commitdiff
Added filter. Oh yeah.
authorGabriel Dunne <gdunne@quilime.com>
Sat, 23 Mar 2013 06:37:46 +0000 (23:37 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Sat, 23 Mar 2013 06:37:46 +0000 (23:37 -0700)
public/css/style.css
public/data/prelinger_extended-search.json [new symlink]
public/index.html [deleted file]
public/js/script.js
routes/index.js
routes/thumbs.js
views/index.ejs

index 392ecc88d857f384dda46378fa25cf447b1ccf69..9fc7adfeb95047b737cb21720b00dc15ef08fb61 100644 (file)
@@ -52,3 +52,8 @@ ul.thumbs li img {
     display:inline-block;
     margin:5px;
 }
+#filter {
+    position:fixed;
+    top:5px;
+    right:5px;
+}
diff --git a/public/data/prelinger_extended-search.json b/public/data/prelinger_extended-search.json
new file mode 120000 (symlink)
index 0000000..ef73d94
--- /dev/null
@@ -0,0 +1 @@
+../../prelinger_extended-search.json
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
deleted file mode 100644 (file)
index e9ab17f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html>
-
-<head>
-    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
-
-    <script>
-
-        $(document).ready(function() {
-
-            $.getJSON('perlinger_identifiers.json', function(data) {
-
-              var items = [];
-              var count = 10;
-
-              $.each(data.identifiers, function(key, val) {
-                count--;
-                if (count < 0) return;
-                items.push([
-                    '<li id="' + val + '">',
-                    '<a href="http://archive.org/movies/thumbnails.php?identifier=' + val + '">' + val + '</a>',
-                    '</li>'
-                    ].join(""));
-              });
-
-              $('<ul/>', {
-                'class': 'thumbs',
-                html : items.join('')
-              }).appendTo('body');
-          });
-
-        });
-
-    </script>
-
-</head>
-
-<body>
-</body>
-
-</html>
index caeff81fd4b2563043ef84e175f77660e7d17753..5627d5c1fd341901204668f6663620d9fc89b3b7 100644 (file)
@@ -1,7 +1,30 @@
+var extended_json = {};
 
 $(document).ready(function() {
 
+  $('#filter').hide();
+  $('#filter').keyup(function() {
+    var query = this.value.toLowerCase();
+    var d = jQuery.grep(extended_json.clips, function(clip, i) {
+      if (clip.id.toLowerCase().indexOf(query) >= 0 ||
+         (clip.description && clip.description.toLowerCase().indexOf(query) >= 0))
+        return true;
+      if (clip.subject)
+        for (var j = 0; j < clip.subject.length; j++)
+          if (clip.subject[j].toLowerCase().indexOf(query) >= 0)
+            return true;
+      return false;
+    });
+    $('.thumbs li').hide();
+    for (var i = 0; i < d.length; i++) {
+      $('.thumbs li#' + d[i].id).show();
+    }
+  });
 
+  $.getJSON('data/prelinger_extended-search.json', function(data) {
+    $('#filter').show();
+    extended_json = data;
+  });
 
   $('#scrim').click(function() {
     $('#subcontent').fadeOut(100, function() {
index ae87363117593d48c27089f88a4af718f92ca95d..fed6d85ca064c96966e45c5468cdedcdda384e04 100644 (file)
@@ -1,5 +1,5 @@
 var fs        = require("fs")
-,   prelinger = require('../prelinger_extended-search.json');
+,   prelinger = require('../prelinger.json');
 
 var LIMIT = false;
 
@@ -14,5 +14,5 @@ exports.index = function(req, res) {
       clips.push(clip);
     }
   }
-  res.render('index', { title: 'Archive.org/Prelinger Explorer', clips : clips });
+  res.render('index', { title: 'Visual Archive', clips : clips });
 };
index bcd45ea8e662b81d5b842f66b9bc55f7e74d47a3..80198db1a222c7312082fd908211a6871039e7fc 100644 (file)
@@ -9,7 +9,7 @@ exports.list = function(req, res) {
     done: function (errors, window) {
       var $ = window.$;
       var thumbs = [];
-      var as =$("div.box div a");
+      var as = $("div.box div a");
       for (var i = 0; i < as.length; i++) {
         thumbs.push({
           "url" : "http://archive.org" + $(as[i]).attr('href'),
index 3fc44579ed0784d44bb4cbae66d2f18c6928818d..470b0af63f74b01ee4c4a3bbf5c510f3082569a4 100644 (file)
@@ -7,6 +7,7 @@
     <script src="js/script.js"></script>
   </head>
   <body>
+    <input type="text" id="filter" />
     <ul class="thumbs">
       <% for(var i = 0; i < clips.length; i++) { %>
         <li id="<%= clips[i].id %>" data-thumbs-url="<%= clips[i].thumbnails_url %>">