From ede590b2cbaa8cbf1e24d6b5a09885e957f8fc15 Mon Sep 17 00:00:00 2001 From: blaines Date: Sat, 16 Oct 2010 01:46:04 -0500 Subject: [PATCH 1/2] Added quicksand, and a bit of progressive enhancement to slider (css3 transition) --- .gitignore | 1 + public/css/main.css | 21 ++++++++++++--------- public/js/app.js | 19 +++++++++---------- views/index.erb | 6 ++++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 56010bb..994d707 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ public/data/*.json tmp/* .DS_Store ._* +.rvmrc \ No newline at end of file diff --git a/public/css/main.css b/public/css/main.css index 276daad..2f935d8 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -1,4 +1,4 @@ -BODY { +body { font-family: verdana, "helvetica neue", helvetica, sans-serif; font-size: 10pt; color: #000; @@ -9,21 +9,24 @@ BODY { #page { min-width: 760px; max-width: 1050px; padding: 0px 36px; margin: 20px auto; } -A { color: #000; text-decoration: none; } -A:visited { color: #666; } +a { color: #000; text-decoration: none; } +a:visited { color: #666; } -H1 { font-size: 2.5em; margin-bottom: 0; } +h1 { font-size: 2.5em; margin-bottom: 0; } -P.subhead { margin-top: 0; margin-bottom: 30px; line-height: 1.5em; } +p.subhead { margin-top: 0; margin-bottom: 30px; line-height: 1.5em; } #slidercontainer { height: 52px; font-size: 0.8em; margin: 0px 24px; padding-top: 8px } +#handle_slider { -webkit-transition: all .75s ease-in-out; } + #items { font-family: verdana, sans-serif; } #items ol { margin-left: 0px; list-style-position: outside; padding-left: 2.2em; } -#items li { margin-bottom: 8px; } -#items li.new { background-color: #fed } - -.sub { font-size: 7pt } +#items li { list-style: none; } +/* +#items li .container.new { background-color: #fed } Removed due to js animation issues +*/ +.sub { font-size: 7pt; margin-bottom: 8px; } .site { font-size: 8pt } .sub, .sub A, .site { color: #666; } diff --git a/public/js/app.js b/public/js/app.js index 35473ec..03bbacd 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -3,13 +3,13 @@ function updateItems(e, ui) { // a poor man's updating status indicator - $('#items').css('background-color', '#f6f6ef'); + // $('#items').css('background-color', '#f6f6ef'); (Idea: Display overlay and fade) $.getJSON('/data/' + $('select#slider').val() + '.json',function(json){ if (json) { $('#items').css('background-color', 'inherit'); - var display = '
    '; + var display = ""; $.each(json,function(i,item){ // If the item is a local link on HN, prepend the HN URL @@ -17,24 +17,23 @@ function updateItems(e, ui) { item.href = 'http://news.ycombinator.com/' + item.href; } - var klasses = ''; + var klasses = ' '; // Once enough days have been crawled with the updated crawler, just use is_new.. checking the hour count is a temporary hack if ((item.hours_ago < 2) || item.is_new) { - klasses = 'new'; + klasses = klasses + 'new'; }; - - display += '
  1. ' + item.title + ''; + + display += '
  2. ' + item.title + ''; if (item.site) { display += ' (' + item.site + ')'; } - display += '
    ' + item.score + ' points by ' + item.user + ' ' + item.hours_ago + ' hours ago | ' + item.comments + ' comments
  3. '; + display += '
    ' + item.score + ' points by ' + item.user + ' ' + item.hours_ago + ' hours ago | ' + item.comments + ' comments
    '; }); - display += '
'; - - $('#items').html(display); + $('#data').html(display); + $('#items').quicksand($("#data > li")); }; }); } diff --git a/views/index.erb b/views/index.erb index 0e32752..f6be5d5 100644 --- a/views/index.erb +++ b/views/index.erb @@ -7,7 +7,8 @@ - + + @@ -32,7 +33,8 @@ -
+
    +