aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-18 02:52:47 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-18 02:52:47 -0400
commit641b85ad7b69d9dc5e853b99da51d1a10aefc095 (patch)
tree2e61e53594757ad1e99ca40468d95662c1eb1e45
parentb84f178467e347e1d6d977e84259c713c06001f5 (diff)
fix reloading plugin pages
-rw-r--r--MediaBrowser.WebDashboard/Api/PackageCreator.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index 753946ac4..726205671 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -315,16 +315,15 @@ namespace MediaBrowser.WebDashboard.Api
html = html.Replace("<head>", "<head>" + GetMetaTags(mode) + GetCommonCss(mode, appVersion));
- // Inject sripts before any embedded scripts
+ // Disable embedded scripts from plugins. We'll run them later once resources have loaded
if (html.IndexOf("<script", StringComparison.OrdinalIgnoreCase) != -1)
{
- html = ReplaceFirst(html, "<script", GetCommonJavascript(mode, appVersion, false) + "<script");
- }
- else
- {
- html = html.Replace("</body>", GetCommonJavascript(mode, appVersion, true) + "</body>");
+ html = html.Replace("<script", "<!--<script");
+ html = html.Replace("</script>", "</script>-->");
}
+ html = html.Replace("</body>", GetCommonJavascript(mode, appVersion) + "</body>");
+
var bytes = Encoding.UTF8.GetBytes(html);
return new MemoryStream(bytes);
@@ -446,9 +445,8 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary>
/// <param name="mode">The mode.</param>
/// <param name="version">The version.</param>
- /// <param name="async">if set to <c>true</c> [asynchronous].</param>
/// <returns>System.String.</returns>
- private string GetCommonJavascript(string mode, string version, bool async)
+ private string GetCommonJavascript(string mode, string version)
{
var builder = new StringBuilder();
@@ -482,11 +480,7 @@ namespace MediaBrowser.WebDashboard.Api
{
if (s.IndexOf("require", StringComparison.OrdinalIgnoreCase) == -1)
{
- if (async)
- {
- return string.Format("<script src=\"{0}\" async></script>", s);
- }
- return string.Format("<script src=\"{0}\"></script>", s);
+ return string.Format("<script src=\"{0}\" async></script>", s);
}
return string.Format("<script src=\"{0}\"></script>", s);