Updated localsearch UI.

This commit is contained in:
kay.one 2011-11-26 10:27:44 -08:00
commit 3bcbc713f3
7 changed files with 31 additions and 167 deletions

View file

@ -4,6 +4,13 @@
});
bindAutoCompletes();
$(document).bind('keydown', 'ctrl+shift+f', function () {
$('#localSeriesLookup').focus();
});
$(document).bind('keyup', 's', function () {
$('#localSeriesLookup').focus();
});
});
//
@ -14,11 +21,10 @@ $('.folderLookup:not(.ui-autocomplete-input), .seriesLookup:not(.ui-autocomplete
function bindAutoCompletes() {
bindFolderAutoComplete(".folderLookup");
bindSeriesAutoComplete(".seriesLookup");
bindLocalSeriesAutoComplete(".localSeriesLookup");
bindLocalSeriesAutoComplete("#localSeriesLookup");
}
function bindFolderAutoComplete(selector) {
$(selector).each(function (index, element) {
$(element).autocomplete({
//source: "/Directory/GetDirectories",
@ -66,10 +72,12 @@ function bindSeriesAutoComplete(selector) {
function bindLocalSeriesAutoComplete(selector) {
$(selector).each(function (index, element) {
$(element).watermark('Search...');
$(element).autocomplete({
source: "/Series/LocalSearch",
minLength: 3,
delay: 500,
minLength: 1,
delay: 100,
autoFocus:true,
select: function (event, ui) {
window.location = "../Series/Details?seriesId=" + ui.item.Id;
}

View file

@ -1,46 +0,0 @@
$(document).ready(function () {
$(".sliderButton").live('click', function () {
sliderToggle(this);
});
});
function sliderToggle(sliderButton) {
//Get sliderContent
var sliderContent = $(sliderButton).siblings('.sliderContent');
//Open the slider
sliderContent.slideToggle('slow');
//Change the slider Image
$(sliderButton).children('.sliderImage').toggleClass('sliderOpened sliderClosed');
//Clear the search box
$(sliderContent).children('.localSeriesLookup').val('');
//Focus in the search box
$(sliderContent).children('.localSeriesLookup').focus();
//Hide the sliders
hideSliders(sliderContent);
//Prevent the Address Bar from changing
return false;
}
function hideSliders(newlyOpenedSlider) {
$('.sliderContent').each(function (index, value) {
var newlyOpenedSliderId = $(newlyOpenedSlider).parent('.top-slider').attr('id');
var id = $(this).parent('.top-slider').attr('id');
//If the ID's of the top-sliders don't match then hide it
if (id != newlyOpenedSliderId)
$(this).slideUp();
});
}
//Hide slider when text box loses focus
$('.localSeriesLookup').live('blur', function () {
$('.sliderContent').each(function (index, value) {
$(this).slideUp();
});
});