From d89b129afe1dcef10aa73ba875c86901af6d81f0 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 24 Aug 2016 12:26:50 +0100 Subject: [PATCH 1/3] Remove the datetime picker css from the main assets block and only load it on the pages it needs. #493 --- PlexRequests.UI/Helpers/BaseUrlHelper.cs | 12 ++++++++++-- PlexRequests.UI/Views/Admin/LandingPage.cshtml | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/PlexRequests.UI/Helpers/BaseUrlHelper.cs b/PlexRequests.UI/Helpers/BaseUrlHelper.cs index 625d71380..a30984ae4 100644 --- a/PlexRequests.UI/Helpers/BaseUrlHelper.cs +++ b/PlexRequests.UI/Helpers/BaseUrlHelper.cs @@ -84,7 +84,6 @@ namespace PlexRequests.UI.Helpers $"", $"", $"", - $"", $"", }; @@ -99,7 +98,6 @@ namespace PlexRequests.UI.Helpers $"", $"", $"", - $"", $"" }; @@ -118,6 +116,16 @@ namespace PlexRequests.UI.Helpers return helper.Raw(sb.ToString()); } + public static IHtmlString LoadDateTimePickerAsset(this HtmlHelpers helper) + { + var startUrl = GetBaseUrl(); + + var sb = new StringBuilder(); + sb.AppendLine($""); + sb.AppendLine($""); + + return helper.Raw(sb.ToString()); + } public static IHtmlString LoadAngularAssets(this HtmlHelpers helper) { var sb = new StringBuilder(); diff --git a/PlexRequests.UI/Views/Admin/LandingPage.cshtml b/PlexRequests.UI/Views/Admin/LandingPage.cshtml index 9f6dcec6f..38d3cc6fa 100644 --- a/PlexRequests.UI/Views/Admin/LandingPage.cshtml +++ b/PlexRequests.UI/Views/Admin/LandingPage.cshtml @@ -1,7 +1,7 @@ @using PlexRequests.UI.Helpers @Html.Partial("_Sidebar") @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase - +@Html.LoadDateTimePickerAsset()
From 9a31a515143600f08c95b5858913659eed369680 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 24 Aug 2016 12:34:39 +0100 Subject: [PATCH 2/3] Changed the way we use the setTimeout function. Should fix #403 #491 #492 --- PlexRequests.UI/Content/search.js | 12 +++++++++--- PlexRequests.UI/Content/site.js | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/PlexRequests.UI/Content/search.js b/PlexRequests.UI/Content/search.js index 37b41a95e..bf5eea9db 100644 --- a/PlexRequests.UI/Content/search.js +++ b/PlexRequests.UI/Content/search.js @@ -56,7 +56,9 @@ $(function () { if (searchTimer) { clearTimeout(searchTimer); } - searchTimer = setTimeout(movieSearch, 800); + searchTimer = setTimeout(function () { + movieSearch(); + }.bind(this), 800); }); @@ -75,7 +77,9 @@ $(function () { if (searchTimer) { clearTimeout(searchTimer); } - searchTimer = setTimeout(tvSearch, 400); + searchTimer = setTimeout(function() { + tvSearch(); + }.bind(this), 800); }); // Click TV dropdown option @@ -116,7 +120,9 @@ $(function () { if (searchTimer) { clearTimeout(searchTimer); } - searchTimer = setTimeout(musicSearch, 400); + searchTimer = setTimeout(function () { + musicSearch(); + }.bind(this), 800); }); diff --git a/PlexRequests.UI/Content/site.js b/PlexRequests.UI/Content/site.js index 85cae41f8..70639cf3e 100644 --- a/PlexRequests.UI/Content/site.js +++ b/PlexRequests.UI/Content/site.js @@ -8,6 +8,21 @@ return s; } +Function.prototype.bind = function (parent) { + var f = this; + var args = []; + + for (var a = 1; a < arguments.length; a++) { + args[args.length] = arguments[a]; + } + + var temp = function () { + return f.apply(parent, args); + } + + return (temp); +} + $(function() { $('[data-toggle="tooltip"]').tooltip(); }); From 6c9093d0c9d57ea5e59277953c8d07d604d9a8a3 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 24 Aug 2016 17:16:10 +0100 Subject: [PATCH 3/3] Append the application version to the end of our JS/CSS files --- PlexRequests.UI/Helpers/BaseUrlHelper.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PlexRequests.UI/Helpers/BaseUrlHelper.cs b/PlexRequests.UI/Helpers/BaseUrlHelper.cs index a30984ae4..ee821f7ac 100644 --- a/PlexRequests.UI/Helpers/BaseUrlHelper.cs +++ b/PlexRequests.UI/Helpers/BaseUrlHelper.cs @@ -82,8 +82,8 @@ namespace PlexRequests.UI.Helpers $"", $"", $"", - $"", - $"", + $"", + $"", $"", }; @@ -94,7 +94,7 @@ namespace PlexRequests.UI.Helpers $"", $"", $"", - $"", + $"", $"", $"", $"", @@ -143,7 +143,7 @@ namespace PlexRequests.UI.Helpers var startUrl = $"{content}/Content"; sb.AppendLine($""); // Load angular first - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -155,7 +155,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -167,7 +167,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -179,7 +179,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -191,7 +191,7 @@ namespace PlexRequests.UI.Helpers var content = GetContentUrl(assetLocation); - sb.AppendLine($""); + sb.AppendLine($""); return helper.Raw(sb.ToString()); } @@ -201,7 +201,7 @@ namespace PlexRequests.UI.Helpers var assetLocation = GetBaseUrl(); var content = GetContentUrl(assetLocation); - var asset = $""; + var asset = $""; return helper.Raw(asset); } @@ -230,7 +230,7 @@ namespace PlexRequests.UI.Helpers var assetLocation = GetBaseUrl(); var content = GetContentUrl(assetLocation); - var asset = $""; + var asset = $""; return helper.Raw(asset); }