From 21067ef5fddc54fb2baf4ca8b07f0b94561cc1d2 Mon Sep 17 00:00:00 2001 From: Severyn Kozak Date: Wed, 4 Jun 2014 13:13:45 -0400 Subject: [PATCH] Complete server querying. Add: static/js/index.js -Complete `queryServer()`. static/sass/(index, _mixins).sass -Add `opaque()` mixin. --- static/js/index.js | 20 +++++++++----------- static/sass/_mixins.sass | 5 +++++ static/sass/index.sass | 16 +++++++++------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 3c21087..245437d 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -104,7 +104,6 @@ var searchResultsPage = 1; $(window).keypress(function(key){ for(var hotkey in hotkeyActions){ var keyChar = String.fromCharCode(key.keyCode); - console.log(keyChar); if(keyChar == hotkey) hotkeyActions[keyChar](); } @@ -377,17 +376,16 @@ function queryServer(){ "q" : searchBar.value, "p" : searchResultsPage++ }); - console.log(queryUrl); - var result = $.getJSON(queryUrl, function(result){ - $.each(result, function(key, value){ - if(key == "error") - errorMessage(value); - else - console.log("Success."); - }); - }); - // return []; + var resultDivs = []; + $.getJSON(queryUrl, function(result){ + if("error" in result) + errorMessage(result["error"]); + else + for(var codelet = 0; codelet < result["results"].length; codelet++) + resultDivs.push(result["results"][codelet]); + }); + for(var result = 0; result < 20; result++){ var newDiv = createResult(testCodelet); resultDivs.push(newDiv) diff --git a/static/sass/_mixins.sass b/static/sass/_mixins.sass index 379fb2d..10dc4b9 100644 --- a/static/sass/_mixins.sass +++ b/static/sass/_mixins.sass @@ -10,6 +10,11 @@ -o-#{$property}: $value #{$property}: $value +// Add portable opacity style. +@mixin opaque($opacity) + @include vendor(opacity, $opacity) + filter: alpha(opacity=$opacity) + .t1 @include vendor(transition, all 0.1s ease-out) diff --git a/static/sass/index.sass b/static/sass/index.sass index c9eb314..f1a5cba 100644 --- a/static/sass/index.sass +++ b/static/sass/index.sass @@ -297,26 +297,28 @@ div#results color: orange div.result + @extend .t3 + width: $resultWidth height: 200px margin-bottom: 100% - @include vendor(transition, opacity 0.2s ease-in-out) - @include vendor(opacity, 0.7) - table border-collapse: collapse height: inherit tr + @extend .t3 + @include opaque(0.8) + height: inherit &.cascade @extend .t1 margin-bottom: 15% - &.display-all - @include vendor(opacity, 1.0) + &.display-all table tr + @include opaque(1.0) div#display-info font-size: 1.3em @@ -330,13 +332,13 @@ div#display-info text-transform: capitalize td#code + @include vendor(transition, width 0.2s ease-in-out) + width: $codeWidth height: inherit padding: 0px border: 1px solid #bbb - @include vendor(transition, width 0.2s ease-in-out) - #tablecontainer overflow: hidden width: 100%