diff --git a/PlexRequests.UI/Content/search.js b/PlexRequests.UI/Content/search.js
index 610f1399d..b4ae49fcf 100644
--- a/PlexRequests.UI/Content/search.js
+++ b/PlexRequests.UI/Content/search.js
@@ -30,7 +30,6 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
- $('#movieSearchButton').attr("class", "fa fa-spinner fa-spin");
searchTimer = setTimeout(movieSearch, 400);
});
@@ -50,7 +49,6 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
- $('#tvSearchButton').attr("class", "fa fa-spinner fa-spin");
searchTimer = setTimeout(tvSearch, 400);
});
@@ -90,7 +88,6 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
- $('#musicSearchButton').attr("class", "fa fa-spinner fa-spin");
searchTimer = setTimeout(musicSearch, 400);
});
@@ -175,7 +172,7 @@ $(function () {
function movieSearch() {
var query = $("#movieSearchContent").val();
- getMovies("/search/movie/" + query);
+ query ? getMovies("/search/movie/" + query) : resetMovies();
}
function moviesComingSoon() {
@@ -187,9 +184,9 @@ $(function () {
}
function getMovies(url) {
- $("#movieList").html("");
-
+ resetMovies();
+ $('#movieSearchButton').attr("class", "fa fa-spinner fa-spin");
$.ajax(url).success(function (results) {
if (results.length > 0) {
results.forEach(function (result) {
@@ -206,14 +203,19 @@ $(function () {
});
};
+ function resetMovies() {
+ $("#movieList").html("");
+ }
+
function tvSearch() {
var query = $("#tvSearchContent").val();
- getTvShows("/search/tv/" + query);
+ query ? getTvShows("/search/tv/" + query) : resetTvShows();
}
function getTvShows(url) {
- $("#tvList").html("");
+ resetTvShows();
+ $('#tvSearchButton').attr("class", "fa fa-spinner fa-spin");
$.ajax(url).success(function (results) {
if (results.length > 0) {
results.forEach(function (result) {
@@ -229,14 +231,19 @@ $(function () {
});
};
+ function resetTvShows() {
+ $("#tvList").html("");
+ }
+
function musicSearch() {
var query = $("#musicSearchContent").val();
- getMusic("/search/music/" + query);
+ query ? getMusic("/search/music/" + query) : resetMusic();
}
function getMusic(url) {
- $("#musicList").html("");
+ resetMusic();
+ $('#musicSearchButton').attr("class", "fa fa-spinner fa-spin");
$.ajax(url).success(function (results) {
if (results.length > 0) {
results.forEach(function (result) {
@@ -254,6 +261,10 @@ $(function () {
});
};
+ function resetMusic() {
+ $("#musicList").html("");
+ }
+
function getCoverArt(artistId) {
$.ajax("/search/music/coverart/" + artistId).success(function (result) {
if (result) {
diff --git a/PlexRequests.UI/Views/Search/Index.cshtml b/PlexRequests.UI/Views/Search/Index.cshtml
index 3f89e1c14..8d2726b44 100644
--- a/PlexRequests.UI/Views/Search/Index.cshtml
+++ b/PlexRequests.UI/Views/Search/Index.cshtml
@@ -128,7 +128,7 @@
{{else}}
{{#if_eq requested true}}
-
+
{{else}}
{{#if_eq type "movie"}}