This commit is contained in:
Simon Martens
2024-01-25 18:20:18 +01:00
parent 065246acdc
commit 050784025c
25 changed files with 93 additions and 163 deletions

View File

@@ -167,4 +167,8 @@
} }
</div> </div>
</feature> </feature>
<script defer src="/js/filelistform.js" asp-append-version="true"></script>
<script type="module">
import { startup_filelistform } from "/dist/scripts.js";
startup_filelistform();
</script>

View File

@@ -199,4 +199,7 @@
</div> </div>
} }
</div> </div>
<script defer src="/js/briefe.js" asp-append-version="true"></script> <script type="module">
import { startup_briefe } from "/dist/scripts.js";
startup_briefe();
</script>

View File

@@ -152,9 +152,11 @@
} }
</div> </div>
<script> <script type="module">
var AvailableLetters = new Set(@Html.Raw(Json.Serialize(Model.AvailableLetters))) import { startup_index } from "/dist/scripts.js";
var AvailablePages = @Html.Raw(Json.Serialize(Model.AvailablePages)) startup_index(
new Set(@Html.Raw(Json.Serialize(Model.AvailableLetters))),
@Html.Raw(Json.Serialize(Model.AvailablePages))
);
</script> </script>
<script defer src="/js/index.js" asp-append-version="true"></script>

View File

@@ -24,7 +24,6 @@
: "ha-bibel"; : "ha-bibel";
} }
<script defer src="/js/search.js" asp-append-version="true"></script>
<div class="ha-register"> <div class="ha-register">
<div class="@commentClass"> <div class="@commentClass">
@@ -87,3 +86,9 @@
</div> </div>
</div> </div>
</div> </div>
<script type="module">
import { startup_search } from "/dist/scripts.js";
startup_search();
</script>

View File

@@ -5,7 +5,6 @@
ViewData["showCredits"] = "false"; ViewData["showCredits"] = "false";
ViewData["Mark"] = Model.ActiveSearch; ViewData["Mark"] = Model.ActiveSearch;
} }
<script defer src="/js/search.js" asp-append-version="true"></script>
<div class="ha-search"> <div class="ha-search">
<div class="ha-searchhead"> <div class="ha-searchhead">
@@ -155,3 +154,8 @@
} }
</div> </div>
</div> </div>
<script type="module">
import { startup_search } from "/dist/scripts.js";
startup_search();
</script>

View File

@@ -20,5 +20,6 @@
@await Html.PartialAsync("/Views/Shared/_Notifications.cshtml") @await Html.PartialAsync("/Views/Shared/_Notifications.cshtml")
</feature> </feature>
@await RenderSectionAsync("JavaScript", false) @await RenderSectionAsync("JavaScript", false)
@await Html.PartialAsync("/Views/Shared/_Scripts.cshtml")
</body> </body>
</html> </html>

View File

@@ -17,5 +17,6 @@
</div> </div>
@await Html.PartialAsync("/Views/Shared/_ScrollButton.cshtml") @await Html.PartialAsync("/Views/Shared/_ScrollButton.cshtml")
@await RenderSectionAsync("JavaScript", false) @await RenderSectionAsync("JavaScript", false)
@await Html.PartialAsync("/Views/Shared/_Scripts.cshtml")
</body> </body>
</html> </html>

View File

@@ -20,25 +20,7 @@
@* Styles *@ @* Styles *@
<link rel="stylesheet" href="/dist/style.css" asp-append-version="true" /> <link rel="stylesheet" href="/dist/style.css" asp-append-version="true" />
<script type="module"> @* Scripts *@
import { startup_clipboard, startup_markanchor, startup_mobilemenu, startup_scrollbutton, startup_marginals, startup_theme, startup_menu } from "/dist/scripts.js"; <script src="/js/mark.min.js" asp-append-version="true"></script>
startup_marginals(); <script src="/js/htmx.min.js" asp-append-version="true"></script>
startup_theme(); <script rel="preload" type="module" src="/dist/scripts.js" asp-append-version="true"></script>
startup_scrollbutton();
startup_menu();
startup_mobilemenu();
startup_markanchor();
startup_clipboard();
</script>
<script type="module">
import "/js/mark.min.js";
document.addEventListener("DOMContentLoaded", (event) => {
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
});
</script>

View File

@@ -28,5 +28,6 @@
</div> </div>
@await Html.PartialAsync("/Views/Shared/_ScrollButton.cshtml") @await Html.PartialAsync("/Views/Shared/_ScrollButton.cshtml")
@await RenderSectionAsync("JavaScript", false) @await RenderSectionAsync("JavaScript", false)
@await Html.PartialAsync("/Views/Shared/_Scripts.cshtml")
</body> </body>
</html> </html>

View File

@@ -1,24 +0,0 @@
@* Global Scripts -- These are not inside .cshtml to not loose deferred execution posibility *@
<script defer src="/js/marginals.js" asp-append-version="true"></script>
<script defer src="/js/theme.js" asp-append-version="true"></script>
<script defer src="/js/active.js" asp-append-version="true"></script>
<script defer src="/js/anchor.js" asp-append-version="true"></script>
<script defer src="/js/mobilemenu.js" asp-append-version="true"></script>
<script defer src="/js/scrollbutton.js" asp-append-version="true"></script>
<script defer src="/js/clipboard.js" asp-append-version="true"></script>
<script src="/js/mark.min.js" asp-append-version="true"></script>
@* This uses Razor Syntax so it is inlined into this razor file *@
<script>
document.addEventListener("DOMContentLoaded", (event) => {
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
});
</script>

View File

@@ -7,4 +7,8 @@
</div> </div>
</div> </div>
</div> </div>
<script defer src="/js/websocket.js" asp-append-version="true"></script>
<script type="module">
import { startup_websocket } from "/dist/scripts.js";
startup_websocket();
</script>

View File

@@ -1,35 +0,0 @@
@model XMLStateViewModel;
<script defer src="/js/publishform.js" asp-append-version="true"></script>
@* @if (Model. != null && Model..Any()) {
<div class="ha-publishfilelisttitle">Aktuell geladene Dateien</div>
<table class="ha-publishfilelistlist">
@foreach (var (category, files) in Model..OrderBy(x => x.Key))
{
<tr>
<td>@Model.AvailableRoots.Where(x => x.Prefix == category).First().Type:</td>
<td>
@foreach (var item in files)
{
if (item != files.Last()) {
<span>@item.FileName,</span>
}
else {
<span>@item.FileName</span>
}
}
</td>
</tr>
}
</table>
<form class="ha-publishform" id="ha-publishform" asp-controller="API" asp-action="LocalPublish" method="post" enctype="multipart/form-data">
<label class="ha-publishfilelabel" id="ha-publishfilelabel">
<div class="ha-publishtext">Dateien Veröffentlichen</div>
<div class="ha-lds-ellipsis-publish" id="ha-lds-ellipsis-publish"><div></div><div></div><div></div><div></div></div>
</label>
<div class="ha-publishmessage" id="ha-publishmessage">
<output form="uploadForm" name="publish-result" id="publish-result"></output>
</div>
</form>
} *@

View File

@@ -0,0 +1,14 @@
<script type="module">
import { startup_default } from "/dist/scripts.js"
startup_default();
</script>
<script type="module">
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
</script>

View File

@@ -1,15 +0,0 @@
@model XMLStateViewModel;
<script defer src="/js/uploadform.js" asp-append-version="true"></script>
<form class="ha-uploadform" id="uploadForm" asp-controller="API" asp-action="Upload" method="post" enctype="multipart/form-data">
<label class="ha-uploadfilelabel" id="dropzone">
<input class="hidden" id="file" type="file" accept=".xml" name="file" />
<div class="ha-uploadtext">Upload</div>
<div class="ha-lds-ellipsis" id="ha-lds-ellipsis-upload"><div></div><div></div><div></div><div></div></div>
</label>
<div class="ha-uploadmessage" id="ha-uploadmessage">
Fehler!<br/>
<output form="uploadForm" name="upload-result"></output>
</div>
</form>

View File

@@ -1,2 +0,0 @@
rm .\bin\Release\net6.0\linux-x64\publish\appsettings.json
scp -r -i C:\Users\simon\.ssh\id_tss .\bin\Release\net6.0\linux-x64\publish\* admin@astra.tss-hd.de:~/publish/

View File

@@ -1,9 +1,7 @@
module.exports = { module.exports = {
plugins: [ plugins: [
require('postcss-import'),
require('tailwindcss'), require('tailwindcss'),
// Production: // Production:
require('autoprefixer'), require('autoprefixer'),
require('cssnano')({ preset: 'default' })
], ],
} }

View File

@@ -35,4 +35,4 @@ const startup_briefe = function () {
tabbtnlist[0].click(); tabbtnlist[0].click();
}; };
startup_briefe(); export { startup_briefe };

View File

@@ -94,7 +94,7 @@ const startup_filelistform = function () {
} }
var coll = document.getElementsByClassName("expandable"); var coll = document.getElementsByClassName("expandable");
for (i = 0; i < coll.length; i++) { for (let i = 0; i < coll.length; i++) {
let element = coll[i] let element = coll[i]
coll[i].addEventListener("click", () => { coll[i].addEventListener("click", () => {
element.classList.toggle("expanded"); element.classList.toggle("expanded");
@@ -102,4 +102,4 @@ const startup_filelistform = function () {
} }
}; };
startup_filelistform(); export { startup_filelistform };

View File

@@ -1,5 +1,4 @@
const startup_index = function () { const startup_index = function (AvailableLetters, AvailablePages) {
function encode(e) { return e.replace(/[^]/g, function (e) { return "&#" + e.charCodeAt(0) + ";" }) } function encode(e) { return e.replace(/[^]/g, function (e) { return "&#" + e.charCodeAt(0) + ";" }) }
const ACTIVATEGOTOFILTER = function (filter, button) { const ACTIVATEGOTOFILTER = function (filter, button) {
@@ -93,4 +92,4 @@ const startup_index = function () {
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn)); searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
}; };
startup_index(); export { startup_index };

View File

@@ -1,10 +1,39 @@
import "../css/site.css"; import "../css/site.css";
import { startup_marginals } from "./marginals.mjs"; import { startup_marginals } from "./marginals.mjs";
import { startup_theme } from "./theme.mjs"; import { startup_theme } from "./theme.mjs";
import { startup_menu } from "./menu.js"; import { startup_menu } from "./menu.mjs";
import { startup_markanchor } from "./anchor.mjs"; import { startup_markanchor } from "./anchor.mjs";
import { startup_mobilemenu } from "./mobilemenu.js"; import { startup_mobilemenu } from "./mobilemenu.mjs";
import { startup_scrollbutton } from "./scrollbutton.mjs"; import { startup_scrollbutton } from "./scrollbutton.mjs";
import { startup_clipboard } from "./clipboard.mjs"; import { startup_clipboard } from "./clipboard.mjs";
import { startup_filelistform } from "./filelistform.mjs";
import { startup_index } from "./index.mjs";
import { startup_briefe } from "./briefe.mjs";
import { startup_websocket } from "./websocket.mjs";
import { startup_search } from "./search.mjs";
export { startup_clipboard, startup_mobilemenu, startup_markanchor, startup_menu, startup_scrollbutton, startup_marginals, startup_theme }; const startup_default = function () {
startup_marginals();
startup_theme();
startup_scrollbutton();
startup_menu();
startup_mobilemenu();
startup_markanchor();
startup_clipboard();
}
export {
startup_search,
startup_websocket,
startup_briefe,
startup_index,
startup_filelistform,
startup_default,
startup_clipboard,
startup_mobilemenu,
startup_markanchor,
startup_menu,
startup_scrollbutton,
startup_marginals,
startup_theme
};

View File

@@ -1,41 +0,0 @@
const startup_publishform = function () {
const LOCALPUBLISHSubmit = async function (oFormElement) {
var fd = new FormData();
document.getElementById("ha-publishfilelabel").style.pointerEvents = "none";
document.getElementById("ha-lds-ellipsis-publish").style.display = "inline-block";
document.getElementById("ha-publishmessage").style.opacity = "0";
await fetch(oFormElement.action, {
method: 'POST',
headers: {
'RequestVerificationToken': getCookie('RequestVerificationToken')
}
})
.then(response => response.json())
.then(json => {
if ("Error" in json) {
document.getElementById("ha-publishfilelabel").style.pointerEvents = "auto";
document.getElementById("ha-lds-ellipsis-publish").style.display = "none";
document.getElementById("ha-publishmessage").style.opacity = "1";
document.getElementById("publish-result").value = json.Error;
} else {
document.getElementById("ha-publishfilelabel").style.pointerEvents = "auto";
document.getElementById("ha-lds-ellipsis-publish").style.display = "none";
document.getElementById("ha-publishmessage").style.opacity = "1";
document.getElementById("publish-result").value = "Erfolg!";
location.reload();
}
})
.catch((e) => {
document.getElementById("ha-publishfilelabel").style.pointerEvents = "auto";
document.getElementById("ha-lds-ellipsis-publish").style.display = "none";
document.getElementById("publish-result").value = "Keine Antwort. Bitte Seite neu laden!";
})
}
var publishelement = document.getElementById("ha-publishform");
var publishbutton = document.getElementById("ha-publishfilelabel");
publishbutton.addEventListener("click", () => LOCALPUBLISHSubmit(publishelement));
};
startup_publishform();

View File

@@ -16,4 +16,4 @@ const startup_search = function () {
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn)); searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
} }
startup_search(); export { startup_search };

View File

@@ -147,4 +147,4 @@ const startup_websocket = function () {
} }
}; };
startup_websocket(); export { startup_websocket };