Add: static/(css, js)/lib -Add directories to contain third-party library files (eg, `jquery.min.js`). templates/index.html, static/js/index.js -Move `typeahead` initialization from `index.html` to `index.js`. static/sass/index.sass -Refactor `twitter-typeahead` specifier hierarchy.tags/v1.0^2
@@ -1,4 +1,5 @@ | |||||
static/css | |||||
static/css/* | |||||
!static/css/lib/* | |||||
*.swp | *.swp | ||||
.sass-cache | .sass-cache | ||||
@@ -23,7 +24,6 @@ var | |||||
sdist | sdist | ||||
develop-eggs | develop-eggs | ||||
.installed.cfg | .installed.cfg | ||||
lib | |||||
lib64 | lib64 | ||||
__pycache__ | __pycache__ | ||||
@@ -1,8 +1,33 @@ | |||||
/* | /* | ||||
* @file Manages all query entry, `index.html` server querying, and results | |||||
* diplay. | |||||
* @file Manages all library initialization, query entry, server | |||||
* querying, and results diplay for `index.html`. | |||||
*/ | */ | ||||
$(function() { | |||||
$("#date-last-modified").datepicker(); | |||||
$("#date-created").datepicker(); | |||||
}); | |||||
var languages = new Bloodhound({ | |||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value"), | |||||
queryTokenizer: Bloodhound.tokenizers.whitespace, | |||||
local: $.map(TYPEAHEAD_LANGUAGES, function(state){ | |||||
return {value : state}; | |||||
}) | |||||
}); | |||||
languages.initialize(); | |||||
$("#languages.typeahead").typeahead({ | |||||
hint: true, | |||||
highlight: true, | |||||
minLength: 1 | |||||
}, | |||||
{ | |||||
name: "languages", | |||||
displayKey: 'value', | |||||
source: languages.ttAdapter() | |||||
}); | |||||
FINISH_TYPING_INTERVAL = 650; | FINISH_TYPING_INTERVAL = 650; | ||||
searchBar = $("form#search-bar input[type='text']")[0]; | searchBar = $("form#search-bar input[type='text']")[0]; | ||||
resultsDiv = $("div#results")[0]; | resultsDiv = $("div#results")[0]; | ||||
@@ -11,31 +11,31 @@ | |||||
.twitter-typeahead | .twitter-typeahead | ||||
width: 100% | width: 100% | ||||
.tt-hint | |||||
color: $baseColor2 | |||||
.tt-hint | |||||
color: $baseColor2 | |||||
.tt-dropdown-menu | |||||
width: 100% | |||||
padding: 4px 0 | |||||
background-color: white | |||||
border: 1px solid $baseColor2 | |||||
.tt-dropdown-menu | |||||
width: 100% | |||||
padding: 4px 0 | |||||
background-color: white | |||||
border: 1px solid $baseColor2 | |||||
.tt-suggestion | |||||
padding: 4px | |||||
.tt-suggestion | |||||
padding: 4px | |||||
p | |||||
margin: 0 | |||||
p | |||||
margin: 0 | |||||
strong | |||||
color: $baseColor1 | |||||
strong | |||||
color: $baseColor1 | |||||
&.tt-cursor | |||||
@extend .t1 | |||||
&.tt-cursor | |||||
@extend .t1 | |||||
background-color: $baseColor1 | |||||
background-color: $baseColor1 | |||||
* | |||||
color: white | |||||
* | |||||
color: white | |||||
div#search-field | div#search-field | ||||
@extend .t2 | @extend .t2 | ||||
@@ -81,7 +81,13 @@ div#search-field | |||||
background-color: white | background-color: white | ||||
border: 1px solid $baseColor2 | border: 1px solid $baseColor2 | ||||
margin: 0px | margin: 0px | ||||
max-height: 0.1px | |||||
overflow: auto | overflow: auto | ||||
padding: 0px | |||||
&.visible | |||||
max-height: 100% | |||||
padding-bottom: 30px | |||||
>div | >div | ||||
@include vendor(box-sizing, border-box) | @include vendor(box-sizing, border-box) | ||||
@@ -110,7 +116,7 @@ div#search-field | |||||
border-color: $baseColor3 | border-color: $baseColor3 | ||||
font-size: 1em | font-size: 1em | ||||
padding: 2px | |||||
padding: 4px | |||||
width: 100% | width: 100% | ||||
&:hover | &:hover | ||||
@@ -5,12 +5,16 @@ | |||||
= endblock | = endblock | ||||
= block head | = block head | ||||
{{ assets.tag("jqueryui.custom.min.css") }} | |||||
{{ assets.tag("jquery.min.js") }} | |||||
{{ assets.tag("jquery-ui.min.js") }} | |||||
{{ assets.tag("typeahead.bundle.min.js") }} | |||||
{{ assets.tag("lib/jqueryui.custom.min.css") }} | |||||
{{ assets.tag("lib/jquery.min.js") }} | |||||
{{ assets.tag("lib/jquery-ui.min.js") }} | |||||
{{ assets.tag("lib/typeahead.bundle.min.js") }} | |||||
{{ assets.tag("index.css") }} | {{ assets.tag("index.css") }} | ||||
<script> | |||||
TYPEAHEAD_LANGUAGES = {{ typeahead_languages | safe }}; | |||||
</script> | |||||
= endblock | = endblock | ||||
= block body | = block body | ||||
@@ -60,7 +64,7 @@ | |||||
<ul> | <ul> | ||||
<li> | <li> | ||||
<label for="symbols">Symbols</label> | <label for="symbols">Symbols</label> | ||||
<input type="text" name="symbols" id="symbols"><br> | |||||
<input class="typeahead" type="text" name="symbols" id="symbols"><br> | |||||
</li> | </li> | ||||
<li> | <li> | ||||
@@ -87,31 +91,4 @@ | |||||
<div id="results"></div> | <div id="results"></div> | ||||
{{ assets.tag("index.js") }} | {{ assets.tag("index.js") }} | ||||
<script> | |||||
TYPEAHEAD_LANGUAGES = {{ typeahead_languages | safe }}; | |||||
$(function() { | |||||
$("#date-last-modified").datepicker(); | |||||
$("#date-created").datepicker(); | |||||
}); | |||||
var languages = new Bloodhound({ | |||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value"), | |||||
queryTokenizer: Bloodhound.tokenizers.whitespace, | |||||
local: $.map(TYPEAHEAD_LANGUAGES, function(state){ | |||||
return {value : state}; | |||||
}) | |||||
}); | |||||
languages.initialize(); | |||||
$(".typeahead").typeahead({ | |||||
hint: true, | |||||
highlight: true, | |||||
minLength: 1 | |||||
}, | |||||
{ | |||||
name: "languages", | |||||
displayKey: 'value', | |||||
source: languages.ttAdapter() | |||||
}); | |||||
</script> | |||||
= endblock | = endblock |