From a375a4356a60558b6dd8a53b1d714c0d977e7b2f Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Sat, 4 Apr 2020 12:50:20 +0100 Subject: [PATCH] Set up bundling and move blog JS to JS file. --- Website/Views/Blog/Entry.cshtml | 4 +--- Website/Views/Blog/Page.cshtml | 4 +--- Website/Views/Shared/_Layout.cshtml | 1 + Website/bundleconfig.json | 3 ++- .../Shared/_BlogImageJs.cshtml => wwwroot/js/blog.js} | 5 ++--- Website/wwwroot/js/javascript.js | 9 ++++++++- 6 files changed, 15 insertions(+), 11 deletions(-) rename Website/{Views/Shared/_BlogImageJs.cshtml => wwwroot/js/blog.js} (95%) diff --git a/Website/Views/Blog/Entry.cshtml b/Website/Views/Blog/Entry.cshtml index b270fd4..e91283b 100644 --- a/Website/Views/Blog/Entry.cshtml +++ b/Website/Views/Blog/Entry.cshtml @@ -8,6 +8,4 @@ @Html.Raw(Model.ContentHtml) -Posted on @Model.Timestamp - - \ No newline at end of file +Posted on @Model.Timestamp \ No newline at end of file diff --git a/Website/Views/Blog/Page.cshtml b/Website/Views/Blog/Page.cshtml index 403fe5f..0df550f 100644 --- a/Website/Views/Blog/Page.cshtml +++ b/Website/Views/Blog/Page.cshtml @@ -20,6 +20,4 @@ @if (Model.Page < Model.MaxPages) { Next } - - - \ No newline at end of file + \ No newline at end of file diff --git a/Website/Views/Shared/_Layout.cshtml b/Website/Views/Shared/_Layout.cshtml index 7e6b9a9..b4f687d 100644 --- a/Website/Views/Shared/_Layout.cshtml +++ b/Website/Views/Shared/_Layout.cshtml @@ -5,6 +5,7 @@ @ViewData["Title"] | Robware +
diff --git a/Website/bundleconfig.json b/Website/bundleconfig.json index 2a9fcca..eda41f7 100644 --- a/Website/bundleconfig.json +++ b/Website/bundleconfig.json @@ -2,7 +2,8 @@ { "outputFileName": "wwwroot/js/javascript.min.js", "inputFiles": [ - "wwwroot/js/javascript.js" + "wwwroot/js/javascript.js", + "wwwroot/js/blog.js" ], "minify": { "enabled": true, diff --git a/Website/Views/Shared/_BlogImageJs.cshtml b/Website/wwwroot/js/blog.js similarity index 95% rename from Website/Views/Shared/_BlogImageJs.cshtml rename to Website/wwwroot/js/blog.js index 795e4f8..5b6cc19 100644 --- a/Website/Views/Shared/_BlogImageJs.cshtml +++ b/Website/wwwroot/js/blog.js @@ -1,4 +1,4 @@ - \ No newline at end of file +}); \ No newline at end of file diff --git a/Website/wwwroot/js/javascript.js b/Website/wwwroot/js/javascript.js index 360afc5..90d48ad 100644 --- a/Website/wwwroot/js/javascript.js +++ b/Website/wwwroot/js/javascript.js @@ -57,4 +57,11 @@ Number.prototype.toString=function(input, shouldRound){ return this.oldToString(input); return round(this, input); -}; \ No newline at end of file +}; + +function documentReady(callback) { + if (document.readyState === "complete" || document.readyState === "interactive") + setTimeout(callback, 1); + else + document.addEventListener("DOMContentLoaded", callback); +} \ No newline at end of file