From a7baac97476e436a9e5db1b0b14aa060744c6e34 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 15 Dec 2011 23:18:54 -0800 Subject: [PATCH] Undeleted localSearch and deleted episodeSearch - sleep is required apparently. --- NzbDrone.Web/NzbDrone.Web.csproj | 2 +- .../Scripts/NzbDrone/episodeSearch.js | 12 ------ NzbDrone.Web/Scripts/NzbDrone/localSearch.js | 41 +++++++++++++++++++ .../Views/Shared/_ReferenceLayout.cshtml | 2 +- 4 files changed, 43 insertions(+), 14 deletions(-) delete mode 100644 NzbDrone.Web/Scripts/NzbDrone/episodeSearch.js create mode 100644 NzbDrone.Web/Scripts/NzbDrone/localSearch.js diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 93d313e5e..bd8438864 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -384,7 +384,7 @@ - + diff --git a/NzbDrone.Web/Scripts/NzbDrone/episodeSearch.js b/NzbDrone.Web/Scripts/NzbDrone/episodeSearch.js deleted file mode 100644 index 213c43249..000000000 --- a/NzbDrone.Web/Scripts/NzbDrone/episodeSearch.js +++ /dev/null @@ -1,12 +0,0 @@ -var searchUrl = '../Episode/Search'; - -function searchForEpisode(id) { - $.ajax({ - type: "POST", - url: searchUrl, - data: jQuery.param({ episodeId: id }), - error: function (req, status, error) { - alert("Sorry! We could search for " + id + " at this time. " + error); - } - }); -} \ No newline at end of file diff --git a/NzbDrone.Web/Scripts/NzbDrone/localSearch.js b/NzbDrone.Web/Scripts/NzbDrone/localSearch.js new file mode 100644 index 000000000..b511366d9 --- /dev/null +++ b/NzbDrone.Web/Scripts/NzbDrone/localSearch.js @@ -0,0 +1,41 @@ +jQuery(document).ready(function () { + $.ajaxSetup({ + cache: false + }); + + var selector = '#localSeriesLookup'; + + $(document).bind('keydown', 'ctrl+shift+f', function () { + $(selector).focus(); + }); + + $(document).bind('keyup', 's', function () { + $(selector).focus(); + }); + + + $(selector).each(function (index, element) { + $(element).blur(function () { + $(element).val(""); + }); + + $(element).watermark('Search...'); + + $(element).autocomplete({ + source: "/Series/LocalSearch", + minLength: 1, + delay: 200, + autoFocus: true, + select: function (event, ui) { + window.location = "../Series/Details?seriesId=" + ui.item.Id; + } + }) + +.data("autocomplete")._renderItem = function (ul, item) { + return $("
  • ") +.data("item.autocomplete", item) +.append("" + item.Title + "
    " + "
    ") +.appendTo(ul); +}; + }); +}); \ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml b/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml index 19b97062a..0660cffd8 100644 --- a/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml +++ b/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml @@ -30,7 +30,7 @@ @Html.IncludeScript("jquery.watermark.min.js") @Html.IncludeScript("jquery.hotkeys.js") @Html.IncludeScript("doTimeout.js") - @Html.IncludeScript("NzbDrone/episodeSearch.js") + @Html.IncludeScript("NzbDrone/localSearch.js") @Html.IncludeScript("NzbDrone/AutoComplete.js") @Html.IncludeScript("NzbDrone/Notification.js") @Html.IncludeScript("NzbDrone/AutoBind.js")