Optimized interop client side

This commit is contained in:
Marcel Baumgartner 2023-04-16 00:16:58 +02:00
parent eaf32d60f5
commit 2e83b1d828
21 changed files with 360 additions and 598 deletions

View file

@ -11,13 +11,8 @@ public class ClipboardService
JsRuntime = jsRuntime;
}
public async Task CopyToClipboard(string data)
{
await JsRuntime.InvokeVoidAsync("copyTextToClipboard", data);
}
public async Task Copy(string data)
{
await JsRuntime.InvokeVoidAsync("copyTextToClipboard", data);
await JsRuntime.InvokeVoidAsync("moonlight.clipboard.copy", data);
}
}

View file

@ -13,36 +13,36 @@ public class ToastService
public async Task Info(string message)
{
await JsRuntime.InvokeVoidAsync("showInfoToast", message);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.info", message);
}
public async Task Error(string message)
{
await JsRuntime.InvokeVoidAsync("showErrorToast", message);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.error", message);
}
public async Task Warning(string message)
{
await JsRuntime.InvokeVoidAsync("showWarningToast", message);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.warning", message);
}
public async Task Success(string message)
{
await JsRuntime.InvokeVoidAsync("showSuccessToast", message);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.success", message);
}
public async Task CreateProcessToast(string id, string text)
{
await JsRuntime.InvokeVoidAsync("createToast", id, text);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.create", id, text);
}
public async Task UpdateProcessToast(string id, string text)
{
await JsRuntime.InvokeVoidAsync("modifyToast", id, text);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.modify", id, text);
}
public async Task RemoveProcessToast(string id)
{
await JsRuntime.InvokeVoidAsync("removeToast", id);
await JsRuntime.InvokeVoidAsync("moonlight.toasts.remove", id);
}
}

View file

@ -100,15 +100,21 @@
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-search@0.8.2/lib/xterm-addon-search.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-web-links@0.5.0/lib/xterm-addon-web-links.min.js"></script>
@*
<script src="/assets/js/xtermAddons.js"></script>
*@
<script src="/_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
<script>require.config({ paths: { 'vs': '/_content/BlazorMonaco/lib/monaco-editor/min/vs' } });</script>
<script src="/_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>
<script src="/_content/BlazorMonaco/jsInterop.js"></script>
@*
<script src="/assets/js/monacoTheme.js"></script>
*@
<script src="/assets/js/scripts.bundle.js"></script>
@*
<script src="/assets/js/flashbang.js"></script>
<script src="/assets/js/cookieUtils.js"></script>
<script src="/assets/js/clipboard.js"></script>
@ -118,7 +124,9 @@
<script src="/assets/js/loggingUtils.js"></script>
<script src="/assets/js/snow.js"></script>
<script src="/assets/js/recaptcha.js"></script>
*@
<script src="/assets/js/moonlight.js"></script>
<script src="_content/Blazor-ApexCharts/js/apex-charts.min.js"></script>
<script src="_content/Blazor-ApexCharts/js/blazor-apex-charts.js"></script>
</body>

View file

@ -71,7 +71,7 @@
{
if (firstRender)
{
await JsRuntime.InvokeVoidAsync("initMonacoTheme");
await JsRuntime.InvokeVoidAsync("moonlight.loading.loadMonaco");
Editor.OnDidInit = new EventCallback<MonacoEditorBase>(this, async () =>
{

View file

@ -47,6 +47,6 @@
private async void TriggerFlashbang()
{
await JsRuntime.InvokeVoidAsync("flashbang");
await JsRuntime.InvokeVoidAsync("moonlight.flashbang.run");
}
}

View file

@ -208,7 +208,7 @@
{
var url = await ServerService.DownloadBackup(CurrentServer, serverBackup);
await ClipboardService.CopyToClipboard(url);
await ClipboardService.Copy(url);
await AlertService.Success(
SmartTranslateService.Translate("Success"),
SmartTranslateService.Translate("Backup URL successfully copied to your clipboard"));

View file

@ -16,7 +16,7 @@
[Parameter]
public Action RunOnFirstRender { get; set; }
private TerminalOptions TerminalOptions = new TerminalOptions
private TerminalOptions TerminalOptions = new()
{
CursorBlink = false,
CursorStyle = CursorStyle.Underline,
@ -33,6 +33,7 @@
}
catch (Exception)
{
// ignored
}
}
@ -50,6 +51,7 @@
}
catch (Exception)
{
// ignored
}
}
}

View file

@ -160,7 +160,7 @@
await JsRuntime.InvokeVoidAsync("KTMenu.createInstances");
await JsRuntime.InvokeVoidAsync("KTDrawer.createInstances");
//await JsRuntime.InvokeVoidAsync("createSnow");
await JsRuntime.InvokeVoidAsync("moonlight.loading.registerXterm");
await SessionService.Register();

View file

@ -1,68 +0,0 @@
window.showAlertInfo = function (title, description)
{
Swal.fire(
title,
description,
'info'
)
}
window.showAlertSuccess = function (title, description)
{
Swal.fire(
title,
description,
'success'
)
}
window.showAlertWarning = function (title, description)
{
Swal.fire(
title,
description,
'warning'
)
}
window.showAlertError = function (title, description)
{
Swal.fire(
title,
description,
'error'
)
}
window.showAlertYesNo = function (title, yesText, noText)
{
return Swal.fire({
title: title,
showDenyButton: true,
confirmButtonText: yesText,
denyButtonText: noText,
}).then((result) => {
if (result.isConfirmed) {
return true;
} else if (result.isDenied) {
return false;
}
})
}
window.showAlertText = function (title, description) {
const {value: text} = Swal.fire({
title: title,
input: 'text',
inputLabel: description,
inputValue: "",
showCancelButton: false,
inputValidator: (value) => {
if (!value) {
return 'Es muss ein Wert angegeben werden'
}
}
})
return text;
}

View file

@ -1,32 +0,0 @@
function fallbackCopyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.value = text;
// Avoid scrolling to bottom
textArea.style.top = "0";
textArea.style.left = "0";
textArea.style.position = "fixed";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}
document.body.removeChild(textArea);
}
function copyTextToClipboard(text) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(function() {
}, function(err) {
console.error('Async: Could not copy text: ', err);
});
}

View file

@ -1,143 +0,0 @@
window.initConsolePlugins = function () {
window.XtermBlazor.registerAddon("xterm-addon-fit", new window.FitAddon.FitAddon());
addEventListener('resize', (event) => {
//XtermBlazor.invokeAddonFunction()
});
};
window.initGraphs = function () {
};
window.initCpu = function () {
var element = document.getElementById('cpuchart');
var height = parseInt(KTUtil.css(element, 'height'));
var labelColor = KTUtil.getCssVariableValue('--kt-gray-500');
var borderColor = KTUtil.getCssVariableValue('--kt-gray-200');
var baseColor = KTUtil.getCssVariableValue('--kt-info');
var lightColor = KTUtil.getCssVariableValue('--kt-info-light');
if (!element) {
return;
}
var options = {
series: [{
name: 'CPU Auslastung',
data: [0, 0, 0, 0, 0, 0, 0]
}],
chart: {
fontFamily: 'inherit',
type: 'area',
height: height,
toolbar: {
show: false
}
},
plotOptions: {},
legend: {
show: false
},
dataLabels: {
enabled: false
},
fill: {
type: 'solid',
opacity: 1
},
stroke: {
curve: 'smooth',
show: true,
width: 3,
colors: [baseColor]
},
xaxis: {
categories: [],
axisBorder: {
show: false,
},
axisTicks: {
show: false
},
labels: {
style: {
colors: labelColor,
fontSize: '12px'
}
},
crosshairs: {
position: 'front',
stroke: {
color: baseColor,
width: 1,
dashArray: 3
}
},
tooltip: {
enabled: false,
formatter: undefined,
offsetY: 0,
style: {
fontSize: '12px'
}
}
},
yaxis: {
labels: {
style: {
colors: labelColor,
fontSize: '12px'
}
}
},
states: {
normal: {
filter: {
type: 'none',
value: 0
}
},
hover: {
filter: {
type: 'none',
value: 0
}
},
active: {
allowMultipleDataPointsSelection: false,
filter: {
type: 'none',
value: 0
}
}
},
colors: [lightColor],
grid: {
borderColor: borderColor,
strokeDashArray: 4,
yaxis: {
lines: {
show: true
}
}
},
markers: {
strokeColor: baseColor,
strokeWidth: 3
}
};
var chart = new ApexCharts(element, options);
chart.render();
window.console.cpuchart = chart;
};
window.updateCpu = function (value) {
window.console.cpuchart.appendSeries({
name: 'CPU Auslastung',
data: value
});
};

View file

@ -1,26 +0,0 @@
window.setCookie = function (key, value, days) {
const d = new Date();
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
let expires = "expires=" + d.toUTCString();
document.cookie = key + "=" + value + ";" + expires + ";path=/";
}
window.deleteCookie = function (key) {
window.setCookie(key, "", 0);
}
window.getCookie = function (cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}

View file

@ -1,12 +0,0 @@
function flashbang() {
const light = document.getElementById("flashbang");
light.style.boxShadow = "0 0 10000px 10000px white, 0 0 250px 10px #FFFFFF";
light.style.animation = "flashbang 5s linear forwards";
light.onanimationend = clearFlashbang;
}
function clearFlashbang() {
const light = document.getElementById("flashbang");
light.style.animation = "";
light.style.opacity = "0";
}

View file

@ -1,51 +0,0 @@
window.logInfo = function (prefix, message)
{
console.log(
'%c[%cINFO%c] [%c' + prefix + '%c] %c' + message,
'color: white', // [
'color: aqua', // INFO
'color: white', // ]
'color: purple', // {prefix}
'color: white', // ]
'color: lightgray' // {message}
);
};
window.logWarn = function (prefix, message)
{
console.log(
'%c[%cWARN%c] [%c' + prefix + '%c] %c' + message,
'color: white', // [
'color: orange', // WARN
'color: white', // ]
'color: purple', // {prefix}
'color: white', // ]
'color: lightgray' // {message}
);
};
window.logError = function (prefix, message)
{
console.log(
'%c[%cERROR%c] [%c' + prefix + '%c] %c' + message,
'color: white', // [
'color: red', // ERROR
'color: white', // ]
'color: purple', // {prefix}
'color: white', // ]
'color: lightgray' // {message}
);
};
window.logDebug = function (prefix, message)
{
console.log(
'%c[%cDEBUG%c] [%c' + prefix + '%c] %c' + message,
'color: white', // [
'color: green', // DEBUG
'color: white', // ]
'color: purple', // {prefix}
'color: white', // ]
'color: lightgray' // {message}
);
};

View file

@ -1,12 +0,0 @@
window.initMonacoTheme = function ()
{
monaco.editor.defineTheme('moonlight-theme', {
base: 'vs-dark',
inherit: true,
rules: [
],
colors: {
'editor.background': '#000000'
}
});
}

View file

@ -1,13 +1,338 @@
window.moonlight =
{
modals: {
show: function (name)
{
show: function (name) {
$('#' + name).modal('show');
},
hide: function (name)
{
hide: function (name) {
$('#' + name).modal('hide');
}
},
alerts: {
info: function (title, description) {
Swal.fire(
title,
description,
'info'
)
},
success: function (title, description) {
Swal.fire(
title,
description,
'success'
)
},
warning: function (title, description) {
Swal.fire(
title,
description,
'warning'
)
},
error: function (title, description) {
Swal.fire(
title,
description,
'error'
)
},
yesno: function (title, yesText, noText) {
return Swal.fire({
title: title,
showDenyButton: true,
confirmButtonText: yesText,
denyButtonText: noText,
}).then((result) => {
if (result.isConfirmed) {
return true;
} else if (result.isDenied) {
return false;
}
})
},
text: function (title, description) {
const {value: text} = Swal.fire({
title: title,
input: 'text',
inputLabel: description,
inputValue: "",
showCancelButton: false,
inputValidator: (value) => {
if (!value) {
return 'You need to enter a value'
}
}
})
return text;
}
},
clipboard: {
copy: function (text) {
if (!navigator.clipboard) {
var textArea = document.createElement("textarea");
textArea.value = text;
// Avoid scrolling to bottom
textArea.style.top = "0";
textArea.style.left = "0";
textArea.style.position = "fixed";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}
document.body.removeChild(textArea);
return;
}
navigator.clipboard.writeText(text).then(function () {
},
function (err) {
console.error('Async: Could not copy text: ', err);
}
);
}
},
recaptcha: {
render: function (id, sitekey, page) {
return grecaptcha.render(id, {
'sitekey': sitekey,
'callback': (response) => {
page.invokeMethodAsync('CallbackOnSuccess', response);
},
'expired-callback': () => {
page.invokeMethodAsync('CallbackOnExpired');
}
});
}
},
snow: {
create: function () {
(function () {
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
};
window.requestAnimationFrame = requestAnimationFrame;
})();
var flakes = [],
canvas = document.getElementById("snow"),
ctx = canvas.getContext("2d"),
flakeCount = 200,
mX = -100,
mY = -100
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
function snow() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < flakeCount; i++) {
var flake = flakes[i],
x = mX,
y = mY,
minDist = 150,
x2 = flake.x,
y2 = flake.y;
var dist = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)),
dx = x2 - x,
dy = y2 - y;
if (dist < minDist) {
var force = minDist / (dist * dist),
xcomp = (x - x2) / dist,
ycomp = (y - y2) / dist,
deltaV = force / 2;
flake.velX -= deltaV * xcomp;
flake.velY -= deltaV * ycomp;
} else {
flake.velX *= .98;
if (flake.velY <= flake.speed) {
flake.velY = flake.speed
}
flake.velX += Math.cos(flake.step += .05) * flake.stepSize;
}
ctx.fillStyle = "rgba(255,255,255," + flake.opacity + ")";
flake.y += flake.velY;
flake.x += flake.velX;
if (flake.y >= canvas.height || flake.y <= 0) {
reset(flake);
}
if (flake.x >= canvas.width || flake.x <= 0) {
reset(flake);
}
ctx.beginPath();
ctx.arc(flake.x, flake.y, flake.size, 0, Math.PI * 2);
ctx.fill();
}
requestAnimationFrame(snow);
};
function reset(flake) {
flake.x = Math.floor(Math.random() * canvas.width);
flake.y = 0;
flake.size = (Math.random() * 3) + 2;
flake.speed = (Math.random() * 1) + 0.5;
flake.velY = flake.speed;
flake.velX = 0;
flake.opacity = (Math.random() * 0.5) + 0.3;
}
function init() {
for (var i = 0; i < flakeCount; i++) {
var x = Math.floor(Math.random() * canvas.width),
y = Math.floor(Math.random() * canvas.height),
size = (Math.random() * 3) + 2,
speed = (Math.random() * 1) + 0.5,
opacity = (Math.random() * 0.5) + 0.3;
flakes.push({
speed: speed,
velY: speed,
velX: 0,
x: x,
y: y,
size: size,
stepSize: (Math.random()) / 30,
step: 0,
opacity: opacity
});
}
snow();
};
canvas.addEventListener("mousemove", function (e) {
mX = e.clientX,
mY = e.clientY
});
window.addEventListener("resize", function () {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
})
init();
}
},
toasts: {
info: function (msg) {
toastr['info'](msg);
},
error: function (msg) {
toastr['error'](msg);
},
success: function (msg) {
toastr['success'](msg);
},
warning: function (msg) {
toastr['warning'](msg);
},
create: function (id, text) {
var toast = toastr.success(text, '',
{
closeButton: true,
progressBar: false,
tapToDismiss: false,
timeOut: 0,
extendedTimeOut: 0,
positionClass: "toastr-bottom-right",
preventDuplicates: false,
onclick: function () {
toastr.clear(toast);
}
});
var toastElement = toast[0];
toastElement.setAttribute('data-toast-id', id);
toastElement.classList.add("bg-secondary");
},
modify: function (id, newText) {
var toast = document.querySelector('[data-toast-id="' + id + '"]');
if (toast) {
var toastMessage = toast.lastChild;
if (toastMessage) {
toastMessage.innerHTML = newText;
}
}
},
remove: function (id) {
var toast = document.querySelector('[data-toast-id="' + id + '"]');
if (toast) {
toast.childNodes.item(1).click();
}
}
},
utils: {
scrollToElement: function (id)
{
let e = document.getElementById(id);
e.scrollTop = e.scrollHeight;
},
triggerResizeEvent: function ()
{
window.dispatchEvent(new Event('resize'));
},
showNotification: function (title, text, img) {
let notification = new Notification(title, { body: text, icon: img });
}
},
loading: {
registerXterm: function()
{
console.log("Registering xterm addons");
window.XtermBlazor.registerAddon("xterm-addon-fit", new window.FitAddon.FitAddon());
window.XtermBlazor.registerAddon("xterm-addon-search", new window.SearchAddon.SearchAddon());
window.XtermBlazor.registerAddon("xterm-addon-web-links", new window.WebLinksAddon.WebLinksAddon());
},
loadMonaco: function ()
{
console.log("Loading monaco");
monaco.editor.defineTheme('moonlight-theme', {
base: 'vs-dark',
inherit: true,
rules: [
],
colors: {
'editor.background': '#000000'
}
});
}
},
flashbang: {
run: function()
{
const light = document.getElementById("flashbang");
light.style.boxShadow = "0 0 10000px 10000px white, 0 0 250px 10px #FFFFFF";
light.style.animation = "flashbang 5s linear forwards";
light.onanimationend = moonlight.flashbang.clean;
},
clean: function()
{
const light = document.getElementById("flashbang");
light.style.animation = "";
light.style.opacity = "0";
}
}
};

View file

@ -1,9 +0,0 @@
window.recaptcha = new Object();
window.recaptcha.render = function (id, sitekey, page)
{
return grecaptcha.render(id, {
'sitekey': sitekey,
'callback': (response) => { page.invokeMethodAsync('CallbackOnSuccess', response); },
'expired-callback': () => { page.invokeMethodAsync('CallbackOnExpired'); }
});
}

View file

@ -1,118 +0,0 @@
window.createSnow = function () {
(function () {
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
};
window.requestAnimationFrame = requestAnimationFrame;
})();
var flakes = [],
canvas = document.getElementById("snow"),
ctx = canvas.getContext("2d"),
flakeCount = 200,
mX = -100,
mY = -100
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
function snow() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < flakeCount; i++) {
var flake = flakes[i],
x = mX,
y = mY,
minDist = 150,
x2 = flake.x,
y2 = flake.y;
var dist = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)),
dx = x2 - x,
dy = y2 - y;
if (dist < minDist) {
var force = minDist / (dist * dist),
xcomp = (x - x2) / dist,
ycomp = (y - y2) / dist,
deltaV = force / 2;
flake.velX -= deltaV * xcomp;
flake.velY -= deltaV * ycomp;
} else {
flake.velX *= .98;
if (flake.velY <= flake.speed) {
flake.velY = flake.speed
}
flake.velX += Math.cos(flake.step += .05) * flake.stepSize;
}
ctx.fillStyle = "rgba(255,255,255," + flake.opacity + ")";
flake.y += flake.velY;
flake.x += flake.velX;
if (flake.y >= canvas.height || flake.y <= 0) {
reset(flake);
}
if (flake.x >= canvas.width || flake.x <= 0) {
reset(flake);
}
ctx.beginPath();
ctx.arc(flake.x, flake.y, flake.size, 0, Math.PI * 2);
ctx.fill();
}
requestAnimationFrame(snow);
};
function reset(flake) {
flake.x = Math.floor(Math.random() * canvas.width);
flake.y = 0;
flake.size = (Math.random() * 3) + 2;
flake.speed = (Math.random() * 1) + 0.5;
flake.velY = flake.speed;
flake.velX = 0;
flake.opacity = (Math.random() * 0.5) + 0.3;
}
function init() {
for (var i = 0; i < flakeCount; i++) {
var x = Math.floor(Math.random() * canvas.width),
y = Math.floor(Math.random() * canvas.height),
size = (Math.random() * 3) + 2,
speed = (Math.random() * 1) + 0.5,
opacity = (Math.random() * 0.5) + 0.3;
flakes.push({
speed: speed,
velY: speed,
velX: 0,
x: x,
y: y,
size: size,
stepSize: (Math.random()) / 30,
step: 0,
opacity: opacity
});
}
snow();
};
canvas.addEventListener("mousemove", function (e) {
mX = e.clientX,
mY = e.clientY
});
window.addEventListener("resize", function () {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
})
init();
}

View file

@ -1,52 +0,0 @@
window.showInfoToast = function (msg) {
toastr['info'](msg);
}
window.showErrorToast = function (msg) {
toastr['error'](msg);
}
window.showSuccessToast = function (msg) {
toastr['success'](msg);
}
window.showWarningToast = function (msg) {
toastr['warning'](msg);
}
window.createToast = function (id, text) {
var toast = toastr.success(text, '',
{
closeButton: true,
progressBar: false,
tapToDismiss: false,
timeOut: 0,
extendedTimeOut: 0,
positionClass: "toastr-bottom-right",
preventDuplicates: false,
onclick: function () {
toastr.clear(toast);
}
});
var toastElement = toast[0];
toastElement.setAttribute('data-toast-id', id);
toastElement.classList.add("bg-secondary");
}
window.modifyToast = function (id, newText) {
var toast = document.querySelector('[data-toast-id="' + id + '"]');
if (toast) {
var toastMessage = toast.lastChild;
if (toastMessage) {
toastMessage.innerHTML = newText;
}
}
}
window.removeToast = function (id) {
var toast = document.querySelector('[data-toast-id="' + id + '"]');
if (toast) {
toast.childNodes.item(1).click();
}
}

View file

@ -1,42 +0,0 @@
window.scrollToElement = function (id)
{
let e = document.getElementById(id);
e.scrollTop = e.scrollHeight;
};
window.showModal = function (name)
{
$('#' + name).modal('show');
}
window.hideModal = function (name)
{
$('#' + name).modal('hide');
}
window.attachFileUploadWebkit = function (id)
{
document.getElementById(id).addEventListener("change", function(e) {
var files = [];
Array.from(e.target.files).forEach(file => {
files.push(file.webkitRelativePath);
});
window.webkitStorage = files;
});
};
window.getWebkitStorage = function ()
{
return window.webkitStorage;
};
window.triggerResizeEvent = function ()
{
window.dispatchEvent(new Event('resize'));
}
window.showNotification = function (title, text, img) {
let notification = new Notification(title, { body: text, icon: img });
}

View file

@ -1,3 +0,0 @@
window.XtermBlazor.registerAddon("xterm-addon-fit", new window.FitAddon.FitAddon());
window.XtermBlazor.registerAddon("xterm-addon-search", new window.SearchAddon.SearchAddon());
window.XtermBlazor.registerAddon("xterm-addon-web-links", new window.WebLinksAddon.WebLinksAddon());