mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
- 2.x - sites (wip)
- improved ssh error handling - database soft deletes
This commit is contained in:
@ -1,62 +1,7 @@
|
||||
import 'flowbite';
|
||||
import 'flowbite/dist/datepicker.js';
|
||||
import './ace-editor/ace-editor';
|
||||
import CodeEditorAlpinePlugin from "./components/editor";
|
||||
|
||||
import Alpine from 'alpinejs';
|
||||
window.Alpine = Alpine;
|
||||
Alpine.start();
|
||||
|
||||
import ApexCharts from 'apexcharts';
|
||||
window.ApexCharts = ApexCharts;
|
||||
|
||||
import htmx from "htmx.org";
|
||||
window.htmx = htmx;
|
||||
window.htmx.defineExtension('disable-element', {
|
||||
onEvent: function (name, evt) {
|
||||
let elt = evt.detail.elt;
|
||||
let target = elt.getAttribute("hx-disable-element");
|
||||
let targetElements = (target === "self") ? [elt] : document.querySelectorAll(target);
|
||||
|
||||
for (let i = 0; i < targetElements.length; i++) {
|
||||
if (name === "htmx:beforeRequest" && targetElements[i]) {
|
||||
targetElements[i].disabled = true;
|
||||
} else if (name === "htmx:afterRequest" && targetElements[i]) {
|
||||
targetElements[i].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
document.body.addEventListener('htmx:configRequest', (event) => {
|
||||
event.detail.headers['X-CSRF-TOKEN'] = document.head.querySelector('meta[name="csrf-token"]').content;
|
||||
// if (window.getSelection) { window.getSelection().removeAllRanges(); }
|
||||
// else if (document.selection) { document.selection.empty(); }
|
||||
});
|
||||
document.body.addEventListener('htmx:beforeRequest', (event) => {
|
||||
let targetElements = event.target.querySelectorAll('[hx-disable]');
|
||||
for (let i = 0; i < targetElements.length; i++) {
|
||||
targetElements[i].disabled = true;
|
||||
}
|
||||
});
|
||||
document.body.addEventListener('htmx:afterRequest', (event) => {
|
||||
let targetElements = event.target.querySelectorAll('[hx-disable]');
|
||||
for (let i = 0; i < targetElements.length; i++) {
|
||||
targetElements[i].disabled = false;
|
||||
}
|
||||
});
|
||||
document.body.addEventListener('htmx:afterSwap', (event) => {
|
||||
tippy('[data-tooltip]', {
|
||||
content(reference) {
|
||||
return reference.getAttribute('data-tooltip');
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
import tippy from 'tippy.js';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
tippy('[data-tooltip]', {
|
||||
content(reference) {
|
||||
return reference.getAttribute('data-tooltip');
|
||||
},
|
||||
document.addEventListener("alpine:init", () => {
|
||||
window.Alpine.plugin(CodeEditorAlpinePlugin);
|
||||
});
|
||||
|
||||
window.copyToClipboard = async function (text) {
|
||||
@ -73,11 +18,11 @@ window.copyToClipboard = async function (text) {
|
||||
textArea.select();
|
||||
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
document.execCommand("copy");
|
||||
} catch (error) {
|
||||
//
|
||||
} finally {
|
||||
textArea.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user