BUGFIX: fehlende edits

This commit is contained in:
Simon Martens
2024-04-26 18:21:32 +02:00
parent 7f0ca822c3
commit aaf76244da
7 changed files with 496 additions and 518 deletions

View File

@@ -11,17 +11,20 @@ namespace HaDocument.Reactors {
private Dictionary<string, string[]> _intermediateReasons = new Dictionary<string, string[]>(); private Dictionary<string, string[]> _intermediateReasons = new Dictionary<string, string[]>();
private bool _normalizeWhitespace = false; private bool _normalizeWhitespace = false;
// State // State for <etitreason>
private string Index = ""; private string Index = "";
// State for <letterText>
private string letter = ""; private string letter = "";
private string page = ""; private string page = "";
private string line = ""; private string line = "";
private Stack<string> index; private Stack<string> index;
private ElementStringBinder _element = null; private ElementStringBinder _element = null;
internal EditreasonReactor(IReader reader, IntermediateLibrary lib, bool normalizeWhitespace) : base (reader, lib) { internal EditreasonReactor(IReader reader, IntermediateLibrary lib, bool normalizeWhitespace) : base(reader, lib) {
CreatedInstances = lib.Editreasons; CreatedInstances = lib.Editreasons;
index = new Stack<string>(); index = new Stack<string>();
_normalizeWhitespace = normalizeWhitespace; _normalizeWhitespace = normalizeWhitespace;

View File

@@ -40,7 +40,7 @@ public class Briefecontroller : Controller {
var text = lib.Letters.ContainsKey(id) ? lib.Letters[id] : null; var text = lib.Letters.ContainsKey(id) ? lib.Letters[id] : null;
var marginals = lib.Marginals.ContainsKey(id) ? lib.Marginals[id] : null; var marginals = lib.Marginals.ContainsKey(id) ? lib.Marginals[id] : null;
var tradition = lib.Traditions.ContainsKey(id) ? lib.Traditions[id] : null; var tradition = lib.Traditions.ContainsKey(id) ? lib.Traditions[id] : null;
var editreasons = lib.Editreasons.ContainsKey(id) ? lib.EditreasonsByLetter[id] : null; // TODO: Order var editreasons = lib.EditreasonsByLetter.Contains(id) ? lib.EditreasonsByLetter[id] : null;
var hands = lib.Hands.ContainsKey(id) ? lib.Hands[id] : null; var hands = lib.Hands.ContainsKey(id) ? lib.Hands[id] : null;
var nextmeta = meta != lib.MetasByDate.Last() ? lib.MetasByDate.ItemRef(lib.MetasByDate.IndexOf(meta) + 1) : null; var nextmeta = meta != lib.MetasByDate.Last() ? lib.MetasByDate.ItemRef(lib.MetasByDate.IndexOf(meta) + 1) : null;
var prevmeta = meta != lib.MetasByDate.First() ? lib.MetasByDate.ItemRef(lib.MetasByDate.IndexOf(meta) - 1) : null; var prevmeta = meta != lib.MetasByDate.First() ? lib.MetasByDate.ItemRef(lib.MetasByDate.IndexOf(meta) - 1) : null;
@@ -76,14 +76,16 @@ public class Briefecontroller : Controller {
t.Title = name; t.Title = name;
if (!String.IsNullOrWhiteSpace(t.ParsedText)) { if (!String.IsNullOrWhiteSpace(t.ParsedText)) {
if (texts == null) texts = new List<(string, List<Text>)>(); if (texts == null) texts = new List<(string, List<Text>)>();
if(!texts.Where(x => x.Category == category).Any()) if (!texts.Where(x => x.Category == category).Any())
texts.Add((category, new List<Text>() { t })); texts.Add((category, new List<Text>() { t }));
else else
texts.Where(x => x.Category == category).First().Item2.Add(t); texts.Where(x => x.Category == category).First().Item2.Add(t);
} else { }
else {
model.MetaData.HasText = false; model.MetaData.HasText = false;
} }
} else { }
else {
model.MetaData.HasText = false; model.MetaData.HasText = false;
} }
@@ -100,7 +102,7 @@ public class Briefecontroller : Controller {
t.ParsedMarginals = state.ParsedMarginals; t.ParsedMarginals = state.ParsedMarginals;
t.ParsedText = state.sb.ToString(); t.ParsedText = state.sb.ToString();
if (texts == null) texts = new List<(string, List<Text>)>(); if (texts == null) texts = new List<(string, List<Text>)>();
if(!texts.Where(x => x.Category == app.Category).Any()) if (!texts.Where(x => x.Category == app.Category).Any())
texts.Add((app.Category, new List<Text>() { t })); texts.Add((app.Category, new List<Text>() { t }));
else else
texts.Where(x => x.Category == app.Category).First().Item2.Add(t); texts.Where(x => x.Category == app.Category).First().Item2.Add(t);
@@ -159,7 +161,8 @@ public class Briefecontroller : Controller {
HTMLHelpers.StringHelpers.GetEnumerationString(receivers.Select(x => x.Name)) HTMLHelpers.StringHelpers.GetEnumerationString(receivers.Select(x => x.Name))
)); ));
} }
} else { }
else {
if (senders.Any(x => receivers.Contains(x))) { if (senders.Any(x => receivers.Contains(x))) {
for (var i = 0; i < receivers.Count || i < senders.Count; i++) { for (var i = 0; i < receivers.Count || i < senders.Count; i++) {
res.Add(( res.Add((
@@ -185,7 +188,7 @@ public class Briefecontroller : Controller {
if (str == strlist.Last()) if (str == strlist.Last())
res += " und " + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a")); res += " und " + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a"));
else else
res += ", " + (str.Index == "1" ? "" :HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a")); res += ", " + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a"));
else else
res += (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a")); res += (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateElement("a", "", "/HKB/Person/" + str.Index)) + str.Name + (str.Index == "1" ? "" : HTMLHelpers.TagHelpers.CreateEndElement("a"));
} }

View File

@@ -1,15 +1,16 @@
@model XMLStateViewModel; @model XMLStateViewModel;
@{ @{
ViewData["Title"] = "Syntax-Check & Dateien"; ViewData["Title"] = "Syntax-Check & Dateien";
ViewData["SEODescription"] = "Johann Georg Hamann: Kommentierte Briefausgabe, Hg. v. Leonard Keidel und Janina Reibold. Durchsuchbare Online-Ausgabe der Briefe von und an Johann Georg Hamann."; ViewData["SEODescription"] = @"Johann Georg Hamann: Kommentierte Briefausgabe, Hg. v. Leonard Keidel und Janina Reibold.
ViewData["showCredits"] = "false"; Durchsuchbare Online-Ausgabe der Briefe von und an Johann Georg Hamann.";
ViewData["showCredits"] = "false";
} }
@* TODO: Headers <div class="ha-xmlstateheader"> @* TODO: Headers <div class="ha-xmlstateheader">
<h1>XML-Daten</h1> <h1>XML-Daten</h1>
</div> *@ </div> *@
@if (Model.ManagedFiles != null && Model.ManagedFiles.Any()) { @if (Model.ManagedFiles != null && Model.ManagedFiles.Any()) {
<div class="ha-managedfiles"> <div class="ha-managedfiles">
<div class="ha-repo"> <div class="ha-repo">
<div class="ha-repodata"> <div class="ha-repodata">
<div><a href="https://github.com/Theodor-Springmann-Stiftung/hamann-xml">Repository &rarr;</a></div> <div><a href="https://github.com/Theodor-Springmann-Stiftung/hamann-xml">Repository &rarr;</a></div>
@@ -33,7 +34,10 @@
<div>@f.FileName</div> <div>@f.FileName</div>
<div>@f.GetLastModified()</div> <div>@f.GetLastModified()</div>
<div class="ha-filestatusicon"> <div class="ha-filestatusicon">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>check-bold</title><path fill="currentColor" d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<title>check-bold</title>
<path fill="currentColor" d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" />
</svg>
</div> </div>
</div> </div>
} else if (Model.SyntaxCheck.ContainsKey(f.FileName)) { } else if (Model.SyntaxCheck.ContainsKey(f.FileName)) {
@@ -41,7 +45,12 @@
<div>@f.FileName</div> <div>@f.FileName</div>
<div>@f.GetLastModified()</div> <div>@f.GetLastModified()</div>
<div class="ha-filestatusicon"> <div class="ha-filestatusicon">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>alert-decagram-outline</title><path d="M23,12L20.56,14.78L20.9,18.46L17.29,19.28L15.4,22.46L12,21L8.6,22.47L6.71,19.29L3.1,18.47L3.44,14.78L1,12L3.44,9.21L3.1,5.53L6.71,4.72L8.6,1.54L12,3L15.4,1.54L17.29,4.72L20.9,5.54L20.56,9.22L23,12M20.33,12L18.5,9.89L18.74,7.1L16,6.5L14.58,4.07L12,5.18L9.42,4.07L8,6.5L5.26,7.09L5.5,9.88L3.67,12L5.5,14.1L5.26,16.9L8,17.5L9.42,19.93L12,18.81L14.58,19.92L16,17.5L18.74,16.89L18.5,14.1L20.33,12M11,15H13V17H11V15M11,7H13V13H11V7" /></svg> </div> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<title>alert-decagram-outline</title>
<path
d="M23,12L20.56,14.78L20.9,18.46L17.29,19.28L15.4,22.46L12,21L8.6,22.47L6.71,19.29L3.1,18.47L3.44,14.78L1,12L3.44,9.21L3.1,5.53L6.71,4.72L8.6,1.54L12,3L15.4,1.54L17.29,4.72L20.9,5.54L20.56,9.22L23,12M20.33,12L18.5,9.89L18.74,7.1L16,6.5L14.58,4.07L12,5.18L9.42,4.07L8,6.5L5.26,7.09L5.5,9.88L3.67,12L5.5,14.1L5.26,16.9L8,17.5L9.42,19.93L12,18.81L14.58,19.92L16,17.5L18.74,16.89L18.5,14.1L20.33,12M11,15H13V17H11V15M11,7H13V13H11V7" />
</svg>
</div>
</div> </div>
<div class="ha-managedfileannotations"> <div class="ha-managedfileannotations">
<table> <table>
@@ -64,7 +73,11 @@
<div>@f.FileName</div> <div>@f.FileName</div>
<div>@f.GetLastModified()</div> <div>@f.GetLastModified()</div>
<div class="ha-filestatusicon"> <div class="ha-filestatusicon">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>close-thick</title><path d="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z" /></svg> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<title>close-thick</title>
<path
d="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z" />
</svg>
</div> </div>
</div> </div>
<div class="ha-managedfileannotations"> <div class="ha-managedfileannotations">
@@ -86,7 +99,10 @@
<div>@f.FileName</div> <div>@f.FileName</div>
<div>@f.GetLastModified()</div> <div>@f.GetLastModified()</div>
<div class="ha-filestatusicon"> <div class="ha-filestatusicon">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>check-bold</title><path fill="currentColor" d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<title>check-bold</title>
<path fill="currentColor" d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" />
</svg>
</div> </div>
</div> </div>
} else { } else {
@@ -94,7 +110,11 @@
<div>@f.FileName</div> <div>@f.FileName</div>
<div>@f.GetLastModified()</div> <div>@f.GetLastModified()</div>
<div class="ha-filestatusicon"> <div class="ha-filestatusicon">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>close-thick</title><path d="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z" /></svg> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
<title>close-thick</title>
<path
d="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z" />
</svg>
</div> </div>
</div> </div>
} }
@@ -106,31 +126,35 @@
</div> </div>
<feature name="SyntaxCheck"> <feature name="SyntaxCheck">
@if (Model.ValidState) { @if (Model.ValidState) {
<form class="ha-selectfilesform" asp-controller="API" asp-action="GetSyntaxCheck" onsubmit="GETSyntaxCheck(this);return false;" method="get" hx-boost="false"> <form class="ha-selectfilesform" asp-controller="API" asp-action="GetSyntaxCheck"
<button type="submit" class="ha-scbutton" id="ha-scbutton" > onsubmit="window.statehelper.GETSyntaxCheck(this);return false;" method="get" hx-boost="false">
<button type="submit" class="ha-scbutton" id="ha-scbutton">
Verweise & IDs prüfen Verweise & IDs prüfen
</button> </button>
</form> </form>
} }
</feature> </feature>
} }
</div> </div>
} else { } else {
<div class="ha-managedfilesnotfound"> <div class="ha-managedfilesnotfound">
Keine Dateien im Repository gefunden! Keine Dateien im Repository gefunden!
</div> </div>
} }
<feature name="LocalPublishService"> <feature name="LocalPublishService">
<div class="ha-filelistfieldset"> <div class="ha-filelistfieldset">
<div class="ha-filelistlegend">Auswahl verfügbarer Dateien</div> <div class="ha-filelistlegend">Auswahl verfügbarer Dateien</div>
@if(Model.HamannFiles != null && Model.HamannFiles.Any()) { @if(Model.HamannFiles != null && Model.HamannFiles.Any()) {
<form class="ha-selectfilesform" id="selecthamannfilesform" asp-controller="API" asp-action="SetInProduction" method="post" onsubmit="USESubmit(this);return false;" enctype="application/x-www-form-urlencoded"> <form class="ha-selectfilesform" id="selecthamannfilesform" asp-controller="API" asp-action="SetInProduction"
method="post" onsubmit="window.statehelper.POSTUsedFile(this);return false;"
enctype="application/x-www-form-urlencoded" hx-boost="false">
<div class="ha-filelistlist"> <div class="ha-filelistlist">
@if (!Model.ValidState) { @if (!Model.ValidState) {
<div class="ha-filelistfile"> <div class="ha-filelistfile">
<input type="radio" disabled><div class="ha-filelistname"> Aktuelle Datei kann nicht geladen werden.</div> <input type="radio" disabled>
<div class="ha-filelistname"> Aktuelle Datei kann nicht geladen werden.</div>
<div class="ha-filelistusedproduction"> <div class="ha-filelistusedproduction">
<div class="ha-filelistproduction hue-rotate-180">Fehler</div> <div class="ha-filelistproduction hue-rotate-180">Fehler</div>
</div> </div>
@@ -139,7 +163,8 @@
@foreach (var file in Model.HamannFiles) { @foreach (var file in Model.HamannFiles) {
<div class="ha-filelistfile"> <div class="ha-filelistfile">
@if (Model.ActiveFile != null) { @if (Model.ActiveFile != null) {
<input type="radio" id="@file.Name" name="file" value="@file.Name" @(file.Name == @Model.ActiveFile!.Name ? "checked='checked'" : "")> <input type="radio" id="@file.Name" name="file" value="@file.Name" @(file.Name==@Model.ActiveFile!.Name
? "checked='checked'" : "" )>
} else { } else {
<input type="radio" id="@file.Name" name="file" value="@file.Name"> <input type="radio" id="@file.Name" name="file" value="@file.Name">
} }
@@ -155,8 +180,8 @@
</div> </div>
} }
</div> </div>
<output id ="ha-filelistoutput"></output> <output id="ha-filelistoutput"></output>
<button type="submit" class="ha-filelistbutton" id="ha-filelistbutton" > <button type="submit" class="ha-filelistbutton" id="ha-filelistbutton">
Laden Laden
<div class="ha-lds-ellipsis-load" id="ha-lds-ellipsis-load"></div> <div class="ha-lds-ellipsis-load" id="ha-lds-ellipsis-load"></div>
</button> </button>
@@ -166,9 +191,9 @@
<div>Keine Dateien gefunden! Es wird eine fallback-Datei verwendet!</div> <div>Keine Dateien gefunden! Es wird eine fallback-Datei verwendet!</div>
} }
</div> </div>
</feature> </feature>
<script type="module"> <script type="module">
import { startup_filelistform } from "/dist/scripts.js"; import {XMLStateHelper} from "/dist/scripts.js";
startup_filelistform(); window.statehelper = new XMLStateHelper();
</script> </script>

View File

@@ -1,11 +1,11 @@
@model BriefeViewModel; @model BriefeViewModel;
@{ @{
@* var minwidth = ""; @* var minwidth = "";
if (Model.MinWidth) if (Model.MinWidth)
minwidth = "ha-minwidth"; minwidth = "ha-minwidth";
var minwidthtrads = ""; var minwidthtrads = "";
if (Model.MinWidthTrad) if (Model.MinWidthTrad)
minwidthtrads = "ha-minwidth"; *@ minwidthtrads = "ha-minwidth"; *@
} }
<div class="ha-letterheader"> <div class="ha-letterheader">
@@ -50,15 +50,17 @@
@if (Model.PDFFilePath != null) @if (Model.PDFFilePath != null)
{ {
<a class="ml-1" href="@Model.PDFFilePath"> <a class="ml-1" href="@Model.PDFFilePath" hx-boost="false">
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black ">Brief @Model.MetaData.Meta.ID</div> <div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black ">Brief
@Model.MetaData.Meta.ID</div>
</a> </a>
} }
@if (Model.YearPDFFilePath != null) @if (Model.YearPDFFilePath != null)
{ {
<a class="ml-1 mr-2" href="@Model.YearPDFFilePath"> <a class="ml-1 mr-2" href="@Model.YearPDFFilePath" hx-boost="false">
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black">Jahr @Model.MetaData.Meta.Sort.Year</div> <div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black">Jahr
@Model.MetaData.Meta.Sort.Year</div>
</a> </a>
} }
@@ -100,7 +102,8 @@
{ {
var mw = (text.MinWidth) ? "ha-minwidth" : ""; var mw = (text.MinWidth) ? "ha-minwidth" : "";
<div class="ha-appcontainer ha-appcontainer-@text.Number @mw"> <div class="ha-appcontainer ha-appcontainer-@text.Number @mw">
@if (app.Item2.Count > 1 && !String.IsNullOrWhiteSpace(text.ParsedText) && !String.IsNullOrWhiteSpace(text.Title)) @if (app.Item2.Count > 1 && !String.IsNullOrWhiteSpace(text.ParsedText) &&
!String.IsNullOrWhiteSpace(text.Title))
{ {
<h3>@text.Title</h3> <h3>@text.Title</h3>
} }
@@ -143,7 +146,8 @@
{ {
<tr class="ha-handentry"> <tr class="ha-handentry">
<td> <td>
<div class="ha-handfrom">@hand.ParsedStart</div>@if (!String.IsNullOrEmpty(hand.ParsedEnd)) <div class="ha-handfrom">@hand.ParsedStart</div>@if
(!String.IsNullOrEmpty(hand.ParsedEnd))
{ {
<div class="ha-handto">@hand.ParsedEnd</div> <div class="ha-handto">@hand.ParsedEnd</div>
} }
@@ -157,6 +161,7 @@
</div> </div>
} }
@if (Model.ParsedEdits != null) @if (Model.ParsedEdits != null)
{ {
<div class="ha-edits ha-appcontainer"> <div class="ha-edits ha-appcontainer">
@@ -173,7 +178,8 @@
{ {
<tr> <tr>
<td class="ha-editfromto"> <td class="ha-editfromto">
<div class="ha-editfrom">@edit.ParsedStart</div>@if (!String.IsNullOrEmpty(edit.ParsedEnd)) <div class="ha-editfrom">@edit.ParsedStart</div>@if
(!String.IsNullOrEmpty(edit.ParsedEnd))
{ {
<div class="ha-editto">@edit.ParsedEnd</div> <div class="ha-editto">@edit.ParsedEnd</div>
} }
@@ -200,6 +206,6 @@
} }
</div> </div>
<script type="module"> <script type="module">
import { startup_briefe } from "/dist/scripts.js"; import {startup_briefe} from "/dist/scripts.js";
startup_briefe(); startup_briefe();
</script> </script>

View File

@@ -8,7 +8,6 @@
"name": "haweb", "name": "haweb",
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "devDependencies": {
"@laynezh/vite-plugin-lib-assets": "^0.5.14",
"autoprefixer": "^10.4.7", "autoprefixer": "^10.4.7",
"cssnano": "^5.1.11", "cssnano": "^5.1.11",
"mark.js": "^8.11.1", "mark.js": "^8.11.1",
@@ -387,17 +386,6 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/@laynezh/vite-plugin-lib-assets": {
"version": "0.5.14",
"resolved": "https://registry.npmjs.org/@laynezh/vite-plugin-lib-assets/-/vite-plugin-lib-assets-0.5.14.tgz",
"integrity": "sha512-6GDawvUde8BixyDx/MD6kXrgXyH9ETlVZJ7czRK15ojoDzki1orWKvDhOhmdEra/SUxleUDMmBqAI5m8uGtuMQ==",
"dev": true,
"dependencies": {
"escape-string-regexp": "^4.0.0",
"loader-utils": "^3.2.1",
"mrmime": "^1.0.1"
}
},
"node_modules/@nodelib/fs.scandir": { "node_modules/@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -1233,18 +1221,6 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/fast-glob": { "node_modules/fast-glob": {
"version": "3.2.11", "version": "3.2.11",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
@@ -1493,15 +1469,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/loader-utils": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz",
"integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==",
"dev": true,
"engines": {
"node": ">= 12.13.0"
}
},
"node_modules/lodash.memoize": { "node_modules/lodash.memoize": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@@ -1554,15 +1521,6 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true "dev": true
}, },
"node_modules/mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
"integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
@@ -2903,17 +2861,6 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"@laynezh/vite-plugin-lib-assets": {
"version": "0.5.14",
"resolved": "https://registry.npmjs.org/@laynezh/vite-plugin-lib-assets/-/vite-plugin-lib-assets-0.5.14.tgz",
"integrity": "sha512-6GDawvUde8BixyDx/MD6kXrgXyH9ETlVZJ7czRK15ojoDzki1orWKvDhOhmdEra/SUxleUDMmBqAI5m8uGtuMQ==",
"dev": true,
"requires": {
"escape-string-regexp": "^4.0.0",
"loader-utils": "^3.2.1",
"mrmime": "^1.0.1"
}
},
"@nodelib/fs.scandir": { "@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -3471,12 +3418,6 @@
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"dev": true "dev": true
}, },
"escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true
},
"fast-glob": { "fast-glob": {
"version": "3.2.11", "version": "3.2.11",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
@@ -3655,12 +3596,6 @@
"integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==", "integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==",
"dev": true "dev": true
}, },
"loader-utils": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz",
"integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==",
"dev": true
},
"lodash.memoize": { "lodash.memoize": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@@ -3707,12 +3642,6 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true "dev": true
}, },
"mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
"integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==",
"dev": true
},
"nanoid": { "nanoid": {
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",

View File

@@ -1,45 +1,61 @@
const startup_filelistform = function () { class XMLStateHelper {
function getCookie(name) { constructor() {
var coll = document.getElementsByClassName("expandable");
for (let i = 0; i < coll.length; i++) {
let element = coll[i];
coll[i].addEventListener("click", () => {
element.classList.toggle("expanded");
});
}
}
getCookie(name) {
var value = "; " + document.cookie; var value = "; " + document.cookie;
var parts = value.split("; " + name + "="); var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift(); if (parts.length == 2) return parts.pop().split(";").shift();
} }
const USESubmit = async function (oFormElement, file = null) { async POSTUsedFile(oFormElement, file = null) {
let fd = new FormData(oFormElement); let fd = new FormData(oFormElement);
document.getElementById("ha-filelistbutton").style.pointerEvents = "none"; document.getElementById("ha-filelistbutton").style.pointerEvents = "none";
document.getElementById("ha-filelistbutton").classList.add("loading"); document.getElementById("ha-filelistbutton").classList.add("loading");
await fetch(oFormElement.action, { await fetch(oFormElement.action, {
method: 'POST', method: "POST",
headers: { headers: {
'RequestVerificationToken': getCookie('RequestVerificationToken') RequestVerificationToken: this.getCookie("RequestVerificationToken"),
}, },
body: fd body: fd,
}) })
.then(response => response.json()) .then((response) => response.json())
.then(json => { .then((json) => {
document.getElementById("ha-filelistbutton").classList.remove("loading"); document
document.getElementById("ha-filelistbutton").style.pointerEvents = "auto"; .getElementById("ha-filelistbutton")
.classList.remove("loading");
document.getElementById("ha-filelistbutton").style.pointerEvents =
"auto";
if ("Error" in json) { if ("Error" in json) {
document.getElementById("ha-filelistoutput").textContent = json.Error; document.getElementById("ha-filelistoutput").textContent =
} json.Erroru;
else { } else {
location.reload(); location.reload();
} }
}) })
.catch((e) => { .catch((e) => {
document.getElementById("ha-filelistbutton").classList.remove("loading"); document
document.getElementById("ha-filelistbutton").style.pointerEvents = "auto"; .getElementById("ha-filelistbutton")
.classList.remove("loading");
document.getElementById("ha-filelistbutton").style.pointerEvents =
"auto";
document.getElementById("ha-filelistoutput").textContent = e; document.getElementById("ha-filelistoutput").textContent = e;
}) });
} }
const GETSyntaxCheck = async function (oFormElement, file = null) { async GETSyntaxCheck(oFormElement, file = null) {
document.getElementById("ha-scbutton").style.pointerEvents = "none"; document.getElementById("ha-scbutton").style.pointerEvents = "none";
document.getElementById("ha-scbutton").classList.toggle("loading"); document.getElementById("ha-scbutton").classList.toggle("loading");
await fetch(oFormElement.action) await fetch(oFormElement.action)
.then(response => response.json()) .then((response) => response.json())
.then(j => { .then((j) => {
Object.entries(j).forEach(([key, value]) => { Object.entries(j).forEach(([key, value]) => {
var e = document.getElementById(key); var e = document.getElementById(key);
if (e !== null && !e.classList.contains("red")) { if (e !== null && !e.classList.contains("red")) {
@@ -51,7 +67,10 @@ const startup_filelistform = function () {
} else { } else {
var icon = i.querySelector("svg"); var icon = i.querySelector("svg");
icon.remove(); icon.remove();
i.insertAdjacentHTML("afterbegin", '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>alert-decagram-outline</title><path d="M23,12L20.56,14.78L20.9,18.46L17.29,19.28L15.4,22.46L12,21L8.6,22.47L6.71,19.29L3.1,18.47L3.44,14.78L1,12L3.44,9.21L3.1,5.53L6.71,4.72L8.6,1.54L12,3L15.4,1.54L17.29,4.72L20.9,5.54L20.56,9.22L23,12M20.33,12L18.5,9.89L18.74,7.1L16,6.5L14.58,4.07L12,5.18L9.42,4.07L8,6.5L5.26,7.09L5.5,9.88L3.67,12L5.5,14.1L5.26,16.9L8,17.5L9.42,19.93L12,18.81L14.58,19.92L16,17.5L18.74,16.89L18.5,14.1L20.33,12M11,15H13V17H11V15M11,7H13V13H11V7" /></svg>'); i.insertAdjacentHTML(
"afterbegin",
'<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><title>alert-decagram-outline</title><path d="M23,12L20.56,14.78L20.9,18.46L17.29,19.28L15.4,22.46L12,21L8.6,22.47L6.71,19.29L3.1,18.47L3.44,14.78L1,12L3.44,9.21L3.1,5.53L6.71,4.72L8.6,1.54L12,3L15.4,1.54L17.29,4.72L20.9,5.54L20.56,9.22L23,12M20.33,12L18.5,9.89L18.74,7.1L16,6.5L14.58,4.07L12,5.18L9.42,4.07L8,6.5L5.26,7.09L5.5,9.88L3.67,12L5.5,14.1L5.26,16.9L8,17.5L9.42,19.93L12,18.81L14.58,19.92L16,17.5L18.74,16.89L18.5,14.1L20.33,12M11,15H13V17H11V15M11,7H13V13H11V7" /></svg>',
);
h.classList.add("expandable"); h.classList.add("expandable");
h.classList.add("orange"); h.classList.add("orange");
h.addEventListener("click", () => { h.addEventListener("click", () => {
@@ -77,29 +96,21 @@ const startup_filelistform = function () {
tdm.append(error.message); tdm.append(error.message);
tr.append(tdl, tdc, tdm); tr.append(tdl, tdc, tdm);
t.append(tr); t.append(tr);
}) });
a.append(t); a.append(t);
} }
} }
console.log(e, h, i, a); console.log(e, h, i, a);
}); });
document.getElementById("ha-scbutton").classList.toggle("hidden"); document.getElementById("ha-scbutton").classList.toggle("hidden");
}) })
.catch((e) => { .catch((e) => {
console.log(e); console.log(e);
document.getElementById("ha-scbutton").classList.toggle("loading"); document.getElementById("ha-scbutton").classList.toggle("loading");
document.getElementById("ha-scbutton").style.pointerEvents = "auto"; document.getElementById("ha-scbutton").style.pointerEvents = "auto";
})
}
var coll = document.getElementsByClassName("expandable");
for (let i = 0; i < coll.length; i++) {
let element = coll[i]
coll[i].addEventListener("click", () => {
element.classList.toggle("expanded");
}); });
} }
}; }
export { XMLStateHelper };
export { startup_filelistform };

View File

@@ -6,7 +6,7 @@ import { startup_markanchor } from "./anchor.mjs";
import { startup_mobilemenu } from "./mobilemenu.mjs"; 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 { XMLStateHelper } from "./filelistform.mjs";
import { startup_index } from "./index.mjs"; import { startup_index } from "./index.mjs";
import { startup_briefe } from "./briefe.mjs"; import { startup_briefe } from "./briefe.mjs";
import { startup_websocket } from "./websocket.mjs"; import { startup_websocket } from "./websocket.mjs";
@@ -20,14 +20,14 @@ const startup_default = function () {
startup_mobilemenu(); startup_mobilemenu();
startup_markanchor(); startup_markanchor();
startup_clipboard(); startup_clipboard();
} };
export { export {
startup_search, startup_search,
startup_websocket, startup_websocket,
startup_briefe, startup_briefe,
startup_index, startup_index,
startup_filelistform, XMLStateHelper,
startup_default, startup_default,
startup_clipboard, startup_clipboard,
startup_mobilemenu, startup_mobilemenu,
@@ -35,5 +35,6 @@ export {
startup_menu, startup_menu,
startup_scrollbutton, startup_scrollbutton,
startup_marginals, startup_marginals,
startup_theme startup_theme,
}; };