2024-11-14 00:02:04 +01:00
|
|
|
function submit_pandora(node_uuid, ressource_hash, pandora_submit_url){
|
2024-09-04 16:30:33 +02:00
|
|
|
let data = {};
|
|
|
|
if (node_uuid) {
|
|
|
|
data.node_uuid = node_uuid;
|
|
|
|
};
|
|
|
|
if (ressource_hash) {
|
|
|
|
data.ressource_hash = ressource_hash;
|
|
|
|
};
|
2024-11-14 00:02:04 +01:00
|
|
|
fetch(pandora_submit_url, {
|
2024-09-04 16:30:33 +02:00
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
if (navigator.clipboard && window.isSecureContext) {
|
|
|
|
navigator.clipboard.writeText(data.link);
|
|
|
|
}
|
|
|
|
openURLInNewTab(data.link);
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
throw new Error(error);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2024-11-09 22:15:53 +01:00
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
2024-11-11 02:06:19 +01:00
|
|
|
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
|
|
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
|
|
|
|
|
|
|
document.querySelectorAll('.submitPandoraButton').forEach(
|
|
|
|
el => el.addEventListener('click', event => {
|
2024-11-14 00:02:04 +01:00
|
|
|
submit_pandora(el.dataset.hostnode, el.dataset.hash, el.dataset.pandorasubmit);
|
2024-11-11 02:06:19 +01:00
|
|
|
}));
|
|
|
|
document.querySelectorAll('.js-copy').forEach(
|
|
|
|
el => el.addEventListener('click', event => {
|
|
|
|
navigator.clipboard.writeText(el.dataset.copy).then(function() {
|
|
|
|
el.setAttribute('data-bs-original-title', 'Copying to clipboard was successful!');
|
|
|
|
}, function(err) {
|
|
|
|
el.setAttribute('data-bs-original-title', 'Could not copy text: ' + err);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
2024-11-09 22:15:53 +01:00
|
|
|
});
|