fix: More cleanup in JS

pull/990/head
Raphaël Vinot 2024-11-09 22:15:53 +01:00
parent 05e4200392
commit 34871f3729
3 changed files with 19 additions and 37 deletions

View File

@ -20,8 +20,8 @@
"favicon.ico": "KOmrfwRbOQqhhwSeBkNpMRAxSVMmmLg+2kRMg9iSv7OWjE9spJc7x4MKB4AE/hi0knaV7UBVctAU6XZ7AC72ZA==",
"font.png": "RwoQkj9dT9SLUL2F7cAA16Nat9t2hDb58eQlHF9ThUar829p0INUXG+5XuDaFOC8SsmCZK5vw2f+YAQ6mLC1Qw==",
"generic.css": "Sh/BcxFMLYYaLdCluVt9efGvJ9CF5d+YJ7lkL2M24PRGu8VZHI9lJiUlFObIocjQgwss3Ve2U5cUAE5WiAdpQQ==",
"generic.js": "/8a1CxlMcMAwl3UMfcGVe1smZZUB0gesxjd3Bmy7LLV16gE/ZPq6HciOnjNq0Jh+55PSSgIRLPsTbqGNv6Mcxw==",
"hostname_popup.js": "8VoaZVwk2FBFCBVjgAup534WPy8B+e5/uUJPqyERUYf3kBcUVC8/T72ha9BYPYj5a6SNOOUJPgVmD5QI6qtAWw==",
"generic.js": "4IMm1lUySxybv57NQgNSvGyzWzihzPl26cBvbai/5MYMcil964nNfiTBgF2ifhZAwDvLMlu7V1h+LOcc/3DDOw==",
"hostname_popup.js": "vBWeN+TLq3OnuUqfmDWiDT10C4lzwklvqZFO9bTvabARHPGZ/95WOETDEXcbvWkx7YUO8Ybp/MTYLg01CKQeyA==",
"html.png": "T7pZrb8MMDsA/JV/51hu+TOglTqlxySuEVY0rpDjTuAEyhzk2v+W4kYrj7vX+Tp3n2d2lvVD08PwhCG62Yfbzg==",
"ifr.png": "rI5YJypmz1QcULRf9UaOYSqV4tPUSxUdLAycoYzCwywt4Pw4eWzBg9SUr769VyIimoiIyJR+aNuoIA4p5WO2fQ==",
"img.png": "bknBlmIfSb9qv9/lSaJ2idn2a8bDyvJ2pATj4oOpehRlCdXlWYOyb2jN3wV1QGHFoqyxNqOv5MfCpI0tbqkicg==",

View File

@ -52,10 +52,20 @@ openNewTabButtons.forEach(el => el.addEventListener('click', event => {
if (window.opener === null) {
return openTreeInNewTab(el.dataset.capture, el.dataset.hostnode)
} else {
return window.opener.openTreeInNewTab(el.dataset.capture, el.dataset.hostnode);
let success = window.opener.openTreeInNewTab(el.dataset.capture, el.dataset.hostnode);
if (! success) {
alert("Your browser doesn't allow Lookyloo to open a new tab. There should be an icon on the right side of your URL bar *in the main window* to allow it.");
}
}
}));
const locateInTree = document.querySelectorAll(".locateInTree")
if (locateInTree) {
locateInTree.forEach(el => el.addEventListener('click', event => {
window.opener.LocateNode(el.dataset.hostnode);
}));
}
// Parameters:
// contentType: The content type of your file.
// its like application/pdf or application/msword or image/jpeg or

View File

@ -1,24 +1,3 @@
const locateInTree = document.querySelectorAll(".locateInTree")
if (locateInTree) {
locateInTree.forEach(el => el.addEventListener('click', event => {
window.opener.LocateNode(el.dataset.hostnode);
}));
}
let openTreeInNewTab = (capture_uuid, hostnode_uuid=Null) => {
let success = window.opener.openTreeInNewTab(capture_uuid, hostnode_uuid);
if (! success) {
alert("Your browser doesn't allow Lookyloo to open a new tab. There should be an icon on the right side of your URL bar *in the main window* to allow it.");
}
}
var openNewTabButtons = document.querySelectorAll('.openNewTab');
if (openNewTabButtons) {
openNewTabButtons.forEach(el => el.addEventListener('click', event => {
openTreeInNewTab(el.dataset.capture, el.dataset.hostnode);
}));
}
document.addEventListener("DOMContentLoaded", () => {
// Grab any text in the attribute 'data-copy' and pass it to the copy function
$('.js-copy').tooltip();
@ -59,16 +38,9 @@ function submit_pandora(node_uuid, ressource_hash){
});
};
var submitPandoraButtons = document.querySelectorAll('.submitPandoraButton');
if (submitPandoraButtons) {
submitPandoraButtons.forEach(el => el.addEventListener('click', event => {
submit_pandora(el.dataset.hostnode, el.dataset.hash);
}));
}
let openURLInNewTab = (url) => {
let success = window.opener.openURLInNewTab(url);
if (! success) {
alert("Your browser doesn't allow Lookyloo to open a new tab. There should be an icon on the right side of your URL bar *in the main window* to allow it.");
}
}
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('.submitPandoraButton').forEach(
el => el.addEventListener('click', event => {
submit_pandora(el.dataset.hostnode, el.dataset.hash);
}));
});