mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
JavaScript Refactor p1
This commit is contained in:
@@ -9,9 +9,9 @@ using Microsoft.AspNetCore.HttpOverrides;
|
|||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
List<string> configpaths = new List<string>();
|
|
||||||
|
|
||||||
// Add additional configuration
|
// Add additional configuration
|
||||||
|
List<string> configpaths = new List<string>();
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
||||||
var p = builder.Configuration.GetValue<string>("WorkingTreePathWindows") + "settings.json";
|
var p = builder.Configuration.GetValue<string>("WorkingTreePathWindows") + "settings.json";
|
||||||
configpaths.Add(p);
|
configpaths.Add(p);
|
||||||
@@ -38,6 +38,8 @@ builder.Services.AddSingleton<IXMLFileProvider, XMLFileProvider>(_ => XMLFP);
|
|||||||
builder.Services.AddSingleton<WebSocketMiddleware>();
|
builder.Services.AddSingleton<WebSocketMiddleware>();
|
||||||
builder.Services.AddTransient<IReaderService, ReaderService>();
|
builder.Services.AddTransient<IReaderService, ReaderService>();
|
||||||
builder.Services.AddFeatureManagement();
|
builder.Services.AddFeatureManagement();
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Reload config on change
|
// Reload config on change
|
||||||
@@ -48,12 +50,13 @@ ChangeToken.OnChange(
|
|||||||
app.Environment
|
app.Environment
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Websockets for realtime notification of changes
|
||||||
app.UseWebSockets( new WebSocketOptions {
|
app.UseWebSockets( new WebSocketOptions {
|
||||||
KeepAliveInterval = TimeSpan.FromMinutes(180),
|
KeepAliveInterval = TimeSpan.FromMinutes(180),
|
||||||
});
|
});
|
||||||
app.UseMiddleware<WebSocketMiddleware>();
|
app.UseMiddleware<WebSocketMiddleware>();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Production Options
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Gives active classes to links with active URLs
|
const startup_active = function () {
|
||||||
// Marks links as active which target URL starts with the current URL
|
// Gives active classes to links with active URLs
|
||||||
const markactive_startswith = function (element) {
|
// Marks links as active which target URL starts with the current URL
|
||||||
|
const markactive_startswith = function (element) {
|
||||||
var all_links = element.getElementsByTagName("a"),
|
var all_links = element.getElementsByTagName("a"),
|
||||||
i = 0,
|
i = 0,
|
||||||
len = all_links.length,
|
len = all_links.length,
|
||||||
@@ -11,10 +12,10 @@ const markactive_startswith = function (element) {
|
|||||||
all_links[i].className += " active";
|
all_links[i].className += " active";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Marks links active which target URL is exact the same as the current URL
|
// Marks links active which target URL is exact the same as the current URL
|
||||||
const markactive_exact = function (element) {
|
const markactive_exact = function (element) {
|
||||||
var all_links = element.getElementsByTagName("a"),
|
var all_links = element.getElementsByTagName("a"),
|
||||||
i = 0,
|
i = 0,
|
||||||
len = all_links.length,
|
len = all_links.length,
|
||||||
@@ -25,10 +26,10 @@ const markactive_exact = function (element) {
|
|||||||
all_links[i].className += " active";
|
all_links[i].className += " active";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Marks links as active, single links mutch match exactly, dropdown only the beginning
|
// Marks links as active, single links mutch match exactly, dropdown only the beginning
|
||||||
const markactive_menu = function (element) {
|
const markactive_menu = function (element) {
|
||||||
var all_links = element.getElementsByTagName("a"),
|
var all_links = element.getElementsByTagName("a"),
|
||||||
i = 0,
|
i = 0,
|
||||||
len = all_links.length,
|
len = all_links.length,
|
||||||
@@ -58,11 +59,15 @@ const markactive_menu = function (element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (document.getElementById("ha-topnav") !== null)
|
||||||
|
markactive_menu(document.getElementById("ha-topnav"));
|
||||||
|
if (document.getElementById("ha-register-nav") !== null)
|
||||||
|
markactive_exact(document.getElementById("ha-register-nav"));
|
||||||
|
if (this.document.getElementById("ha-adminuploadfields") !== null)
|
||||||
|
markactive_exact(document.getElementById("ha-adminuploadfields"));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (document.getElementById("ha-topnav") !== null)
|
|
||||||
markactive_menu(document.getElementById("ha-topnav"));
|
startup_active();
|
||||||
if (document.getElementById("ha-register-nav") !== null)
|
|
||||||
markactive_exact(document.getElementById("ha-register-nav"));
|
|
||||||
if (this.document.getElementById("ha-adminuploadfields") !== null)
|
|
||||||
markactive_exact(document.getElementById("ha-adminuploadfields"));
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Marks anchors, if anchors are present in the URL
|
// Marks anchors, if anchors are present in the URL
|
||||||
const markanchor = function () {
|
const startup_markanchor = function () {
|
||||||
var currentUrl = document.URL,
|
var currentUrl = document.URL,
|
||||||
urlParts = currentUrl.split('#');
|
urlParts = currentUrl.split('#');
|
||||||
var anchor = (urlParts.length > 1) ? urlParts[1] : null;
|
var anchor = (urlParts.length > 1) ? urlParts[1] : null;
|
||||||
@@ -19,4 +19,4 @@ const markanchor = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
markanchor();
|
startup_markanchor();
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
// // Code specifically for the letter view
|
// // Code specifically for the letter view
|
||||||
let activetab = null;
|
|
||||||
let activetabbtn = null;
|
|
||||||
let activetabbtn2 = null;
|
|
||||||
let tabbtnlist = document.querySelectorAll(".ha-tabbtn");
|
|
||||||
let tablist = document.querySelectorAll(".ha-tab");
|
|
||||||
|
|
||||||
for (let i = 0; i < tabbtnlist.length; i++) {
|
const startup_briefe = function () {
|
||||||
|
let activetab = null;
|
||||||
|
let activetabbtn = null;
|
||||||
|
let activetabbtn2 = null;
|
||||||
|
let tabbtnlist = document.querySelectorAll(".ha-tabbtn");
|
||||||
|
let tablist = document.querySelectorAll(".ha-tab");
|
||||||
|
|
||||||
|
for (let i = 0; i < tabbtnlist.length; i++) {
|
||||||
tablist[i % tablist.length].classList.add("hidden");
|
tablist[i % tablist.length].classList.add("hidden");
|
||||||
tabbtnlist[i].addEventListener("click", () => {
|
tabbtnlist[i].addEventListener("click", () => {
|
||||||
if (activetab != null)
|
if (activetab != null)
|
||||||
@@ -27,7 +29,10 @@ for (let i = 0; i < tabbtnlist.length; i++) {
|
|||||||
// requestAnimationFrame(() => { resetall(); });
|
// requestAnimationFrame(() => { resetall(); });
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tabbtnlist.length > 0)
|
if (tabbtnlist.length > 0)
|
||||||
tabbtnlist[0].click();
|
tabbtnlist[0].click();
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_briefe();
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
document.addEventListener('copy', function(e){
|
|
||||||
|
const startup_clipboard = function () {
|
||||||
|
document.addEventListener('copy', function (e) {
|
||||||
var e = navigator.clipboard.read();
|
var e = navigator.clipboard.read();
|
||||||
|
|
||||||
var text = window.getSelection().toString();
|
var text = window.getSelection().toString();
|
||||||
e.clipboardData.setData('text/plain', text);
|
e.clipboardData.setData('text/plain', text);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
startup_clipboard();
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
function getCookie(name) {
|
const startup_filelistform = function () {
|
||||||
|
function 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) {
|
const USESubmit = async function (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");
|
||||||
@@ -26,14 +27,14 @@ const USESubmit = async function (oFormElement, file = null) {
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch ((e) => {
|
.catch((e) => {
|
||||||
document.getElementById("ha-filelistbutton").classList.remove("loading");
|
document.getElementById("ha-filelistbutton").classList.remove("loading");
|
||||||
document.getElementById("ha-filelistbutton").style.pointerEvents = "auto";
|
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) {
|
const GETSyntaxCheck = async function (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)
|
||||||
@@ -82,32 +83,23 @@ const GETSyntaxCheck = async function (oFormElement, file = null) {
|
|||||||
}
|
}
|
||||||
console.log(e, h, i, a);
|
console.log(e, h, i, a);
|
||||||
});
|
});
|
||||||
// let coll = document.getElementsByClassName("ha-managedfile");
|
|
||||||
// for (i = 0; i < coll.length; i++) {
|
|
||||||
// let e = coll[i];
|
|
||||||
// if (j[e.id] !== null) {
|
|
||||||
// if(j[e.id].errors === null) {
|
|
||||||
// console.log(e.id + " hat keine errors");
|
|
||||||
// } else {
|
|
||||||
// console.log(e.id + " hat errors");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
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");
|
var coll = document.getElementsByClassName("expandable");
|
||||||
|
for (i = 0; i < coll.length; i++) {
|
||||||
for (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");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_filelistform();
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
function encode(e){return e.replace(/[^]/g,function(e){return"&#"+e.charCodeAt(0)+";"})}
|
const startup_index = function () {
|
||||||
|
|
||||||
const ACTIVATEGOTOFILTER = function(filter, button) {
|
function encode(e) { return e.replace(/[^]/g, function (e) { return "&#" + e.charCodeAt(0) + ";" }) }
|
||||||
|
|
||||||
|
const ACTIVATEGOTOFILTER = function (filter, button) {
|
||||||
let f = filter.value;
|
let f = filter.value;
|
||||||
let gotoinfo = document.getElementById("ha-gotoinfo");
|
let gotoinfo = document.getElementById("ha-gotoinfo");
|
||||||
|
|
||||||
@@ -21,9 +23,9 @@ const ACTIVATEGOTOFILTER = function(filter, button) {
|
|||||||
|
|
||||||
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ACTIVATEZHSEARCH = function(volume, page, button) {
|
const ACTIVATEZHSEARCH = function (volume, page, button) {
|
||||||
let vol = volume.options[volume.selectedIndex].value;
|
let vol = volume.options[volume.selectedIndex].value;
|
||||||
let pg = page.value;
|
let pg = page.value;
|
||||||
let gotoinfo = document.getElementById("ha-zhsearchinfo");
|
let gotoinfo = document.getElementById("ha-zhsearchinfo");
|
||||||
@@ -45,47 +47,50 @@ const ACTIVATEZHSEARCH = function(volume, page, button) {
|
|||||||
|
|
||||||
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SUBMITZHSEARCH = function(volume, page) {
|
const SUBMITZHSEARCH = function (volume, page) {
|
||||||
let vol = volume.options[volume.selectedIndex].value;
|
let vol = volume.options[volume.selectedIndex].value;
|
||||||
let pg = page.value;
|
let pg = page.value;
|
||||||
window.location.href = "/HKB/" + vol + "/" + pg;
|
window.location.href = "/HKB/" + vol + "/" + pg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ACTIVATESEARCHFILTER = function(filter, button) {
|
const ACTIVATESEARCHFILTER = function (filter, button) {
|
||||||
let f = filter.value;
|
let f = filter.value;
|
||||||
if (f === "") {
|
if (f === "") {
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go to letter HKB number
|
// Go to letter HKB number
|
||||||
let gotofilter = document.getElementById("ha-gotoletternumber");
|
let gotofilter = document.getElementById("ha-gotoletternumber");
|
||||||
let gotosubmitbtn = document.getElementById("ha-gotoformsubmit");
|
let gotosubmitbtn = document.getElementById("ha-gotoformsubmit");
|
||||||
let gotoform = document.getElementById("ha-gotoform");
|
let gotoform = document.getElementById("ha-gotoform");
|
||||||
ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn);
|
ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn);
|
||||||
gotofilter.addEventListener("input", () => ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn));
|
gotofilter.addEventListener("input", () => ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn));
|
||||||
|
|
||||||
// ZH Volume / Page Lookup
|
// ZH Volume / Page Lookup
|
||||||
let vol = document.getElementById("ha-zhformvolume");
|
let vol = document.getElementById("ha-zhformvolume");
|
||||||
let pg = document.getElementById("ha-zhformpage");
|
let pg = document.getElementById("ha-zhformpage");
|
||||||
let zhsubmitbtn = document.getElementById("ha-zhformsubmit");
|
let zhsubmitbtn = document.getElementById("ha-zhformsubmit");
|
||||||
let zhsearchform = document.getElementById("ha-zhform");
|
let zhsearchform = document.getElementById("ha-zhform");
|
||||||
ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn);
|
ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn);
|
||||||
vol.addEventListener("change", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
|
vol.addEventListener("change", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
|
||||||
pg.addEventListener("input", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
|
pg.addEventListener("input", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
|
||||||
// Need to implement send bc razor tag helpers do not work here
|
// Need to implement send bc razor tag helpers do not work here
|
||||||
zhsearchform.addEventListener("submit", (ev) => {
|
zhsearchform.addEventListener("submit", (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
SUBMITZHSEARCH(vol, pg);
|
SUBMITZHSEARCH(vol, pg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Full-text search
|
// Full-text search
|
||||||
let searchfilter = document.getElementById("ha-searchformtext");
|
let searchfilter = document.getElementById("ha-searchformtext");
|
||||||
let searchsubmitbtn = document.getElementById("ha-searchformsubmit");
|
let searchsubmitbtn = document.getElementById("ha-searchformsubmit");
|
||||||
let searchform = document.getElementById("ha-searchform");
|
let searchform = document.getElementById("ha-searchform");
|
||||||
ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn);
|
ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn);
|
||||||
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
|
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_index();
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
// Script for auto collapsing marginal boxes
|
// Script for auto collapsing marginal boxes
|
||||||
const getLineHeight = function (element) {
|
const startup_marginals = function () {
|
||||||
|
const getLineHeight = function (element) {
|
||||||
var temp = document.createElement(element.nodeName),
|
var temp = document.createElement(element.nodeName),
|
||||||
ret;
|
ret;
|
||||||
temp.setAttribute("class", element.className);
|
temp.setAttribute("class", element.className);
|
||||||
@@ -8,20 +9,20 @@ const getLineHeight = function (element) {
|
|||||||
ret = temp.getBoundingClientRect().height;
|
ret = temp.getBoundingClientRect().height;
|
||||||
temp.parentNode.removeChild(temp);
|
temp.parentNode.removeChild(temp);
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
const collapsebox = function (element, height, lineheight) {
|
const collapsebox = function (element, height, lineheight) {
|
||||||
element.style.maxHeight = height + "px";
|
element.style.maxHeight = height + "px";
|
||||||
element.classList.add("ha-collapsed-box");
|
element.classList.add("ha-collapsed-box");
|
||||||
element.classList.remove("ha-expanded-box");
|
element.classList.remove("ha-expanded-box");
|
||||||
};
|
};
|
||||||
|
|
||||||
const uncollapsebox = function (element) {
|
const uncollapsebox = function (element) {
|
||||||
element.classList.remove("ha-collapsed-box");
|
element.classList.remove("ha-collapsed-box");
|
||||||
element.classList.add("ha-expanded-box");
|
element.classList.add("ha-expanded-box");
|
||||||
};
|
};
|
||||||
|
|
||||||
const addbuttoncaollapsebox = function (element, height, hoverfunction) {
|
const addbuttoncaollapsebox = function (element, height, hoverfunction) {
|
||||||
let btn = document.createElement("div");
|
let btn = document.createElement("div");
|
||||||
btn.classList.add("ha-btn-collapsed-box");
|
btn.classList.add("ha-btn-collapsed-box");
|
||||||
|
|
||||||
@@ -72,9 +73,9 @@ const addbuttoncaollapsebox = function (element, height, hoverfunction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
element.parentNode.insertBefore(btn, element);
|
element.parentNode.insertBefore(btn, element);
|
||||||
};
|
};
|
||||||
|
|
||||||
const overlappingcollapsebox = function (selector, hoverfunction) {
|
const overlappingcollapsebox = function (selector, hoverfunction) {
|
||||||
let boxes = document.querySelectorAll(selector);
|
let boxes = document.querySelectorAll(selector);
|
||||||
let lineheight = 1;
|
let lineheight = 1;
|
||||||
|
|
||||||
@@ -128,9 +129,9 @@ const overlappingcollapsebox = function (selector, hoverfunction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const marginalboxwidthset = function () {
|
const marginalboxwidthset = function () {
|
||||||
let lt = document.getElementById("ha-letterbody");
|
let lt = document.getElementById("ha-letterbody");
|
||||||
if (lt !== null) {
|
if (lt !== null) {
|
||||||
let mg = lt.querySelectorAll(".ha-text .ha-marginalbox");
|
let mg = lt.querySelectorAll(".ha-text .ha-marginalbox");
|
||||||
@@ -144,20 +145,18 @@ const marginalboxwidthset = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const collapseboxes = function () {
|
||||||
|
|
||||||
const collapseboxes = function () {
|
|
||||||
overlappingcollapsebox(".ha-neuzeit .ha-letlinks", true);
|
overlappingcollapsebox(".ha-neuzeit .ha-letlinks", true);
|
||||||
overlappingcollapsebox(".ha-forschung .ha-letlinks", true);
|
overlappingcollapsebox(".ha-forschung .ha-letlinks", true);
|
||||||
overlappingcollapsebox(".ha-commentlist .ha-letlinks", true);
|
overlappingcollapsebox(".ha-commentlist .ha-letlinks", true);
|
||||||
overlappingcollapsebox(".ha-text .ha-marginalbox", true);
|
overlappingcollapsebox(".ha-text .ha-marginalbox", true);
|
||||||
};
|
};
|
||||||
|
|
||||||
var collapsedboxes = [];
|
var collapsedboxes = [];
|
||||||
|
|
||||||
const clearcollapsedboxes = function () {
|
const clearcollapsedboxes = function () {
|
||||||
var elements = document.querySelectorAll(".ha-text .ha-marginalbox");
|
var elements = document.querySelectorAll(".ha-text .ha-marginalbox");
|
||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
element.removeAttribute("style");
|
element.removeAttribute("style");
|
||||||
@@ -172,19 +171,23 @@ const clearcollapsedboxes = function () {
|
|||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
element.remove();
|
element.remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetall = function() {
|
const resetall = function () {
|
||||||
clearcollapsedboxes();
|
clearcollapsedboxes();
|
||||||
marginalboxwidthset();
|
marginalboxwidthset();
|
||||||
collapseboxes();
|
collapseboxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
marginalboxwidthset();
|
|
||||||
collapseboxes();
|
|
||||||
|
|
||||||
var doit;
|
marginalboxwidthset();
|
||||||
this.window.addEventListener("resize", function () {
|
collapseboxes();
|
||||||
|
|
||||||
|
var doit;
|
||||||
|
this.window.addEventListener("resize", function () {
|
||||||
this.clearTimeout(doit);
|
this.clearTimeout(doit);
|
||||||
doit = this.setTimeout(resetall, 17);
|
doit = this.setTimeout(resetall, 17);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_marginals();
|
||||||
|
|||||||
@@ -1,31 +1,35 @@
|
|||||||
// Code for showing and hiding the mobile menu
|
// Code for showing and hiding the mobile menu
|
||||||
const openmenu = function () {
|
const startup_mobilemenu = function () {
|
||||||
|
const openmenu = function () {
|
||||||
var x = document.getElementById("ha-topnav");
|
var x = document.getElementById("ha-topnav");
|
||||||
if (x !== null) x.className += " ha-topnav-collapsed";
|
if (x !== null) x.className += " ha-topnav-collapsed";
|
||||||
let oldbutton = document.getElementById("openmenubutton");
|
let oldbutton = document.getElementById("openmenubutton");
|
||||||
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
||||||
let newbutton = document.getElementById("closemenubutton");
|
let newbutton = document.getElementById("closemenubutton");
|
||||||
if (newbutton !== null) newbutton.setAttribute("class", "");
|
if (newbutton !== null) newbutton.setAttribute("class", "");
|
||||||
};
|
};
|
||||||
|
|
||||||
const closemenu = function () {
|
const closemenu = function () {
|
||||||
var x = document.getElementById("ha-topnav");
|
var x = document.getElementById("ha-topnav");
|
||||||
if (x !== null) x.className = "ha-topnav";
|
if (x !== null) x.className = "ha-topnav";
|
||||||
let oldbutton = document.getElementById("closemenubutton");
|
let oldbutton = document.getElementById("closemenubutton");
|
||||||
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
||||||
let newbutton = document.getElementById("openmenubutton");
|
let newbutton = document.getElementById("openmenubutton");
|
||||||
if (newbutton !== null) newbutton.setAttribute("class", "");
|
if (newbutton !== null) newbutton.setAttribute("class", "");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Menu: Show / Hide Buttons for mobile View
|
// Menu: Show / Hide Buttons for mobile View
|
||||||
if (
|
if (
|
||||||
document.getElementById("openmenubutton") !== null &&
|
document.getElementById("openmenubutton") !== null &&
|
||||||
document.getElementById("closemenubutton") !== null
|
document.getElementById("closemenubutton") !== null
|
||||||
) {
|
) {
|
||||||
document
|
document
|
||||||
.getElementById("openmenubutton")
|
.getElementById("openmenubutton")
|
||||||
.addEventListener("click", openmenu);
|
.addEventListener("click", openmenu);
|
||||||
document
|
document
|
||||||
.getElementById("closemenubutton")
|
.getElementById("closemenubutton")
|
||||||
.addEventListener("click", closemenu);
|
.addEventListener("click", closemenu);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_mobilemenu();
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const LOCALPUBLISHSubmit = async function (oFormElement) {
|
const startup_publishform = function () {
|
||||||
|
|
||||||
|
const LOCALPUBLISHSubmit = async function (oFormElement) {
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
document.getElementById("ha-publishfilelabel").style.pointerEvents = "none";
|
document.getElementById("ha-publishfilelabel").style.pointerEvents = "none";
|
||||||
document.getElementById("ha-lds-ellipsis-publish").style.display = "inline-block";
|
document.getElementById("ha-lds-ellipsis-publish").style.display = "inline-block";
|
||||||
@@ -24,14 +26,16 @@ const LOCALPUBLISHSubmit = async function (oFormElement) {
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch ((e) => {
|
.catch((e) => {
|
||||||
document.getElementById("ha-publishfilelabel").style.pointerEvents = "auto";
|
document.getElementById("ha-publishfilelabel").style.pointerEvents = "auto";
|
||||||
document.getElementById("ha-lds-ellipsis-publish").style.display = "none";
|
document.getElementById("ha-lds-ellipsis-publish").style.display = "none";
|
||||||
document.getElementById("publish-result").value = "Keine Antwort. Bitte Seite neu laden!";
|
document.getElementById("publish-result").value = "Keine Antwort. Bitte Seite neu laden!";
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var publishelement = document.getElementById("ha-publishform");
|
var publishelement = document.getElementById("ha-publishform");
|
||||||
var publishbutton = document.getElementById("ha-publishfilelabel");
|
var publishbutton = document.getElementById("ha-publishfilelabel");
|
||||||
publishbutton.addEventListener("click", () => LOCALPUBLISHSubmit(publishelement));
|
publishbutton.addEventListener("click", () => LOCALPUBLISHSubmit(publishelement));
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_publishform();
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
// Script for showing and acting upon the "scroll to top button"
|
const startup_scrollbutton = function () {
|
||||||
const scrollFunction = function () {
|
|
||||||
|
// Script for showing and acting upon the "scroll to top button"
|
||||||
|
const scrollFunction = function () {
|
||||||
button = document.getElementById("ha-scrollbutton");
|
button = document.getElementById("ha-scrollbutton");
|
||||||
if (button !== null) {
|
if (button !== null) {
|
||||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
|
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
|
||||||
@@ -12,10 +14,10 @@ const scrollFunction = function () {
|
|||||||
button.style.opacity = "0";
|
button.style.opacity = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll button
|
// Scroll button
|
||||||
if (document.getElementById("ha-scrollbutton") !== null) {
|
if (document.getElementById("ha-scrollbutton") !== null) {
|
||||||
scrollFunction();
|
scrollFunction();
|
||||||
document.getElementById("ha-scrollbutton").addEventListener("click", () => {
|
document.getElementById("ha-scrollbutton").addEventListener("click", () => {
|
||||||
document.body.scrollTop = 0; // For Safari
|
document.body.scrollTop = 0; // For Safari
|
||||||
@@ -23,4 +25,7 @@ if (document.getElementById("ha-scrollbutton") !== null) {
|
|||||||
})
|
})
|
||||||
// TODO: workaround, bc window does not recieve scroll events anymore
|
// TODO: workaround, bc window does not recieve scroll events anymore
|
||||||
setInterval(() => scrollFunction(), 1500);
|
setInterval(() => scrollFunction(), 1500);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_scrollbutton();
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
const ACTIVATESEARCHFILTER = function(filter, button) {
|
const startup_search = function () {
|
||||||
|
|
||||||
|
const ACTIVATESEARCHFILTER = function (filter, button) {
|
||||||
let f = filter.value;
|
let f = filter.value;
|
||||||
if (f === "") {
|
if (f === "") {
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let searchfilter = document.getElementById("ha-searchformtext");
|
||||||
|
let searchsubmitbtn = document.getElementById("ha-searchformsubmit");
|
||||||
|
let searchform = document.getElementById("ha-searchform");
|
||||||
|
ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn);
|
||||||
|
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
|
||||||
}
|
}
|
||||||
|
|
||||||
let searchfilter = document.getElementById("ha-searchformtext");
|
startup_search();
|
||||||
let searchsubmitbtn = document.getElementById("ha-searchformsubmit");
|
|
||||||
let searchform = document.getElementById("ha-searchform");
|
|
||||||
ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn);
|
|
||||||
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
|
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
// Functions for switching theme
|
// Functions for switching theme
|
||||||
const go_to_dark = function () {
|
const startup_theme = function () {
|
||||||
|
|
||||||
|
const go_to_dark = function () {
|
||||||
localStorage.setItem("theme", "ha-toggledark");
|
localStorage.setItem("theme", "ha-toggledark");
|
||||||
document.documentElement.classList.add("dark");
|
document.documentElement.classList.add("dark");
|
||||||
};
|
};
|
||||||
|
|
||||||
const go_to_bright = function () {
|
const go_to_bright = function () {
|
||||||
document.documentElement.classList.remove("dark");
|
document.documentElement.classList.remove("dark");
|
||||||
localStorage.setItem("theme", "ha-togglebright");
|
localStorage.setItem("theme", "ha-togglebright");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Functions for reading theme settings
|
// Functions for reading theme settings
|
||||||
const get_theme_settings = function (standard) {
|
const get_theme_settings = function (standard) {
|
||||||
var theme = localStorage.getItem("theme");
|
var theme = localStorage.getItem("theme");
|
||||||
if (theme === null) theme = standard;
|
if (theme === null) theme = standard;
|
||||||
let toggleSwitch = document.getElementById(theme).click();
|
let toggleSwitch = document.getElementById(theme).click();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
document.getElementById("ha-togglebright") !== null &&
|
document.getElementById("ha-togglebright") !== null &&
|
||||||
this.document.getElementById("ha-toggledark") !== null
|
this.document.getElementById("ha-toggledark") !== null
|
||||||
) {
|
) {
|
||||||
document
|
document
|
||||||
.getElementById("ha-togglebright")
|
.getElementById("ha-togglebright")
|
||||||
.addEventListener("click", go_to_bright);
|
.addEventListener("click", go_to_bright);
|
||||||
document
|
document
|
||||||
.getElementById("ha-toggledark")
|
.getElementById("ha-toggledark")
|
||||||
.addEventListener("click", go_to_dark);
|
.addEventListener("click", go_to_dark);
|
||||||
}
|
}
|
||||||
get_theme_settings("ha-togglebright");
|
get_theme_settings("ha-togglebright");
|
||||||
|
};
|
||||||
|
|
||||||
|
startup_theme();
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
const dropHandler = function (formelement, ev, dropzone) {
|
|
||||||
ev.preventDefault();
|
|
||||||
if (ev.dataTransfer.items) {
|
|
||||||
if (ev.dataTransfer.items[0].kind === 'file') {
|
|
||||||
var file = ev.dataTransfer.items[0].getAsFile();
|
|
||||||
UPLOADSubmit(formelement, file);
|
|
||||||
} else {
|
|
||||||
var file = ev.dataTransfer.files[0];
|
|
||||||
UPLOADSubmit(formelement, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const dragOverHandler = function (ev, dropzone) {
|
|
||||||
ev.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
const dragLeaveHander = function (ev, dropzone) {
|
|
||||||
ev.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
const dragEnterHandler = function (ev, dropzone) {
|
|
||||||
ev.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
const UPLOADSubmit = async function (oFormElement, file = null) {
|
|
||||||
var fd = new FormData();
|
|
||||||
if (file !== null) fd.append("file", file);
|
|
||||||
else fd = new FormData(oFormElement);
|
|
||||||
document.getElementById("dropzone").style.pointerEvents = "none";
|
|
||||||
document.getElementById("ha-lds-ellipsis-upload").style.display = "inline-block";
|
|
||||||
document.getElementById("ha-uploadmessage").style.opacity = "0";
|
|
||||||
await fetch(oFormElement.action, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'RequestVerificationToken': getCookie('RequestVerificationToken')
|
|
||||||
},
|
|
||||||
body: fd
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(json => {
|
|
||||||
if ("Error" in json) {
|
|
||||||
document.getElementById("dropzone").style.pointerEvents = "auto";
|
|
||||||
document.getElementById("ha-lds-ellipsis-upload").style.display = "none";
|
|
||||||
document.getElementById("ha-uploadmessage").style.opacity = "1";
|
|
||||||
oFormElement.elements.namedItem("upload-result").value = json.Error;
|
|
||||||
} else {
|
|
||||||
document.getElementById("dropzone").style.pointerEvents = "auto";
|
|
||||||
document.getElementById("ha-lds-ellipsis-upload").style.display = "none";
|
|
||||||
oFormElement.elements.namedItem("upload-result").value = "Erfolg!";
|
|
||||||
if ("Prefix" in json[0]) {
|
|
||||||
document.getElementById("dropzone").style.pointerEvents = "auto";
|
|
||||||
document.getElementById("ha-lds-ellipsis-upload").style.display = "none";
|
|
||||||
window.location.replace("/Admin/Upload/" + json[0].Prefix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch ((e) => {
|
|
||||||
document.getElementById("dropzone").style.pointerEvents = "auto";
|
|
||||||
document.getElementById("ha-lds-ellipsis-upload").style.display = "none";
|
|
||||||
document.getElementById("ha-uploadmessage").style.opacity = "1";
|
|
||||||
oFormElement.elements.namedItem("upload-result").value = "Keine Antwort. Bitte Seite neu laden!";
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var submitelement = document.getElementById("file");
|
|
||||||
var formelement = document.getElementById("uploadForm");
|
|
||||||
var dropzone = document.getElementById("dropzone");
|
|
||||||
submitelement.addEventListener("change", () => UPLOADSubmit(formelement));
|
|
||||||
dropzone.addEventListener("drop", (ev) => dropHandler(formelement, ev, dropzone));
|
|
||||||
dropzone.addEventListener("dragover", (ev) => dragOverHandler(ev, dropzone));
|
|
||||||
dropzone.addEventListener("dragleave", (ev) => dragLeaveHander(ev, dropzone));
|
|
||||||
dropzone.addEventListener("dragenter", (ev) => dragEnterHandler(ev, dropzone));
|
|
||||||
@@ -1,42 +1,44 @@
|
|||||||
var stateSC = null;
|
// Functions for change notifications and automatic reload via websockets
|
||||||
var stateValidation = null;
|
const startup_websocket = function () {
|
||||||
var stateReload = null;
|
function htmlEscape(str) {
|
||||||
var stateCommit = null;
|
|
||||||
var statePing = false;
|
|
||||||
var firstMessage = true;
|
|
||||||
var commsLog = document.getElementById("commsLog");
|
|
||||||
var commsNot = document.getElementById("comm-notifications");
|
|
||||||
var socket;
|
|
||||||
|
|
||||||
var scheme = document.location.protocol === "https:" ? "wss" : "ws";
|
|
||||||
var port = document.location.port ? (":" + document.location.port) : "";
|
|
||||||
var wsPingInterval;
|
|
||||||
var connectionUrl = scheme + "://" + document.location.hostname + port + "/WS" ;
|
|
||||||
|
|
||||||
function htmlEscape(str) {
|
|
||||||
return str.toString()
|
return str.toString()
|
||||||
.replace(/&/g, '&')
|
.replace(/&/g, '&')
|
||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
.replace(/'/g, ''')
|
.replace(/'/g, ''')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
socket = new WebSocket(connectionUrl);
|
var stateSC = null;
|
||||||
socket.onopen = function (event) {
|
var stateValidation = null;
|
||||||
|
var stateReload = null;
|
||||||
|
var stateCommit = null;
|
||||||
|
var statePing = false;
|
||||||
|
var firstMessage = true;
|
||||||
|
var commsLog = document.getElementById("commsLog");
|
||||||
|
var commsNot = document.getElementById("comm-notifications");
|
||||||
|
var socket;
|
||||||
|
|
||||||
|
var scheme = document.location.protocol === "https:" ? "wss" : "ws";
|
||||||
|
var port = document.location.port ? (":" + document.location.port) : "";
|
||||||
|
var wsPingInterval;
|
||||||
|
var connectionUrl = scheme + "://" + document.location.hostname + port + "/WS";
|
||||||
|
|
||||||
|
socket = new WebSocket(connectionUrl);
|
||||||
|
socket.onopen = function (event) {
|
||||||
socket.send("Hello");
|
socket.send("Hello");
|
||||||
wsPingInterval = setInterval(() => {
|
wsPingInterval = setInterval(() => {
|
||||||
socket.send("Ping");
|
socket.send("Ping");
|
||||||
}, 30000);
|
}, 30000);
|
||||||
updateMessage();
|
updateMessage();
|
||||||
};
|
};
|
||||||
socket.onclose = function (event) {
|
socket.onclose = function (event) {
|
||||||
clearInterval(wsPingInterval);
|
clearInterval(wsPingInterval);
|
||||||
updateMessage();
|
updateMessage();
|
||||||
};
|
};
|
||||||
socket.onerror = updateMessage;
|
socket.onerror = updateMessage;
|
||||||
socket.onmessage = function (event) {
|
socket.onmessage = function (event) {
|
||||||
var msg = JSON.parse(event.data);
|
var msg = JSON.parse(event.data);
|
||||||
if (msg.ValidationState != null) {
|
if (msg.ValidationState != null) {
|
||||||
stateValidation = msg.ValidationState;
|
stateValidation = msg.ValidationState;
|
||||||
@@ -87,9 +89,9 @@ socket.onmessage = function (event) {
|
|||||||
commsLog.innerHTML = htmlEscape(event.data);
|
commsLog.innerHTML = htmlEscape(event.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateMessage() {
|
function updateMessage() {
|
||||||
function disable() {
|
function disable() {
|
||||||
commsNot.classList.remove("red");
|
commsNot.classList.remove("red");
|
||||||
commsNot.classList.remove("loading");
|
commsNot.classList.remove("loading");
|
||||||
@@ -118,7 +120,7 @@ function updateMessage() {
|
|||||||
case WebSocket.OPEN:
|
case WebSocket.OPEN:
|
||||||
commsLog.innerHTML = "";
|
commsLog.innerHTML = "";
|
||||||
// TODO: decide on state what the message is
|
// TODO: decide on state what the message is
|
||||||
if (stateValidation == 0 ) {
|
if (stateValidation == 0) {
|
||||||
commsLog.innerHTML = 'Der angezeigte Stand ist nicht aktuell. ' +
|
commsLog.innerHTML = 'Der angezeigte Stand ist nicht aktuell. ' +
|
||||||
'<a href="/Admin">Fehler beheben</a>';
|
'<a href="/Admin">Fehler beheben</a>';
|
||||||
if (!firstMessage) commsNot.classList.add("imp");
|
if (!firstMessage) commsNot.classList.add("imp");
|
||||||
@@ -126,7 +128,7 @@ function updateMessage() {
|
|||||||
commsLog.innerHTML = "Der Server arbeitet...";
|
commsLog.innerHTML = "Der Server arbeitet...";
|
||||||
} else {
|
} else {
|
||||||
if (stateCommit != null) {
|
if (stateCommit != null) {
|
||||||
commsLog.innerHTML = "<a href='https://github.com/Theodor-Springmann-Stiftung/hamann-xml/commit/" + stateCommit.Commit.substring(0,7) + "'>commit " +
|
commsLog.innerHTML = "<a href='https://github.com/Theodor-Springmann-Stiftung/hamann-xml/commit/" + stateCommit.Commit.substring(0, 7) + "'>commit " +
|
||||||
stateCommit.Commit.substring(0, 7) +
|
stateCommit.Commit.substring(0, 7) +
|
||||||
" geladen</a>"
|
" geladen</a>"
|
||||||
} else {
|
} else {
|
||||||
@@ -142,24 +144,7 @@ function updateMessage() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
// closeButton.onclick = function () {
|
|
||||||
// if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
||||||
// alert("socket not connected");
|
|
||||||
// }
|
|
||||||
// socket.close(1000, "Closing from client");
|
|
||||||
// };
|
|
||||||
|
|
||||||
// sendButton.onclick = function () {
|
|
||||||
// if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
||||||
// alert("socket not connected");
|
|
||||||
// }
|
|
||||||
// var data = sendMessage.value;
|
|
||||||
// socket.send(data);
|
|
||||||
// commsLog.innerHTML += '<tr>' +
|
|
||||||
// '<td class="commslog-client">Client</td>' +
|
|
||||||
// '<td class="commslog-server">Server</td>' +
|
|
||||||
// '<td class="commslog-data">' + htmlEscape(data) + '</td></tr>';
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
startup_websocket();
|
||||||
Reference in New Issue
Block a user