1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-31 07:52:37 +01:00

Local search updates.

This commit is contained in:
kay.one 2011-11-26 22:31:13 -08:00
parent 1aa295b2ca
commit 7c529b03b4
5 changed files with 49 additions and 31 deletions

View File

@ -378,6 +378,7 @@
<Content Include="Scripts\NzbDrone\addSeries.js" />
<Content Include="Scripts\NzbDrone\AutoComplete.js" />
<Content Include="Scripts\NzbDrone\episodeSearch.js" />
<Content Include="Scripts\NzbDrone\LocalSearch.js" />
<Content Include="Scripts\NzbDrone\Notification.js" />
<Content Include="Scripts\NzbDrone\seriesDetails.js" />
<Content Include="Scripts\NzbDrone\settingsForm.js" />

View File

@ -8,12 +8,8 @@
$(document).bind('keydown', 'ctrl+shift+f', function () {
$('#localSeriesLookup').focus();
});
$(document).bind('keyup', 's', function () {
$('#localSeriesLookup').focus();
});
});
//
$('.folderLookup:not(.ui-autocomplete-input), .seriesLookup:not(.ui-autocomplete-input), .localSeriesLookup:not(.ui-autocomplete-input)').live('focus', function (event) {
bindAutoCompletes();
});
@ -21,7 +17,6 @@ $('.folderLookup:not(.ui-autocomplete-input), .seriesLookup:not(.ui-autocomplete
function bindAutoCompletes() {
bindFolderAutoComplete(".folderLookup");
bindSeriesAutoComplete(".seriesLookup");
bindLocalSeriesAutoComplete("#localSeriesLookup");
}
function bindFolderAutoComplete(selector) {
@ -68,25 +63,3 @@ function bindSeriesAutoComplete(selector) {
};
});
}
function bindLocalSeriesAutoComplete(selector) {
$(selector).each(function (index, element) {
$(element).watermark('Search...');
$(element).autocomplete({
source: "/Series/LocalSearch",
minLength: 1,
delay: 100,
autoFocus:true,
select: function (event, ui) {
window.location = "../Series/Details?seriesId=" + ui.item.Id;
}
})
.data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.Title + "</strong><br>" + "</a>")
.appendTo(ul);
};
});
}

View File

@ -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 $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.Title + "<br>" + "</a>")
.appendTo(ul);
};
});
});

View File

@ -2,9 +2,13 @@
@section TitleContent{
Add Series
}
@section Scripts
{
<script type="text/javascript" src="../../Scripts/NzbDrone/addSeries.js"></script>
}
@section MainContent{
<h2>Add New Series</h2>
<h2>
Add New Series</h2>
<div id="addNewSeries">
@{ Html.RenderAction("AddNew", "AddSeries"); }
</div>

View File

@ -48,7 +48,6 @@
<span id="msgText">background notification</span>
</div>
@(Html.Telerik().ScriptRegistrar().jQuery(true))
@* <script type="text/javascript" src="../../Scripts/jquery-1.7.1.min.js"></script>*@
<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.16.min.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.js"></script>
@ -60,7 +59,7 @@
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
<script type="text/javascript" src="../../Scripts/NzbDrone/episodeSearch.js"></script>
<script type="text/javascript" src="../../Scripts/NzbDrone/AutoComplete.js"></script>
<script type="text/javascript" src="../../Scripts/NzbDrone/addSeries.js"></script>
<script type="text/javascript" src="../../Scripts/NzbDrone/LocalSearch.js"></script>
<script type="text/javascript" src="../../Scripts/NzbDrone/Notification.js"></script>
@RenderSection("Scripts", required: false)
@if (EnviromentProvider.IsProduction)