diff --git a/website/web/sri.txt b/website/web/sri.txt index 3c7190f8..389fe373 100644 --- a/website/web/sri.txt +++ b/website/web/sri.txt @@ -20,8 +20,8 @@ "favicon.ico": "KOmrfwRbOQqhhwSeBkNpMRAxSVMmmLg+2kRMg9iSv7OWjE9spJc7x4MKB4AE/hi0knaV7UBVctAU6XZ7AC72ZA==", "font.png": "RwoQkj9dT9SLUL2F7cAA16Nat9t2hDb58eQlHF9ThUar829p0INUXG+5XuDaFOC8SsmCZK5vw2f+YAQ6mLC1Qw==", "generic.css": "Sh/BcxFMLYYaLdCluVt9efGvJ9CF5d+YJ7lkL2M24PRGu8VZHI9lJiUlFObIocjQgwss3Ve2U5cUAE5WiAdpQQ==", - "generic.js": "4IMm1lUySxybv57NQgNSvGyzWzihzPl26cBvbai/5MYMcil964nNfiTBgF2ifhZAwDvLMlu7V1h+LOcc/3DDOw==", - "hostname_popup.js": "vBWeN+TLq3OnuUqfmDWiDT10C4lzwklvqZFO9bTvabARHPGZ/95WOETDEXcbvWkx7YUO8Ybp/MTYLg01CKQeyA==", + "generic.js": "B1Kd8EpQRDDLAxh7eD2QZNyDBwY8zyC8NBoGhml8zpF9TRsEtiH7XcXus+NMNvRtqKoo93Xhc+JTAW9Fn0lMdw==", + "hostname_popup.js": "kYsVppmphN/tsdLnWVHD8GAVp4CvViRWquL5xVowLsALai/Oeb2RXVYn7SsVoMOuvWaGVmzsY4ZkxetgNJhGdA==", "html.png": "T7pZrb8MMDsA/JV/51hu+TOglTqlxySuEVY0rpDjTuAEyhzk2v+W4kYrj7vX+Tp3n2d2lvVD08PwhCG62Yfbzg==", "ifr.png": "rI5YJypmz1QcULRf9UaOYSqV4tPUSxUdLAycoYzCwywt4Pw4eWzBg9SUr769VyIimoiIyJR+aNuoIA4p5WO2fQ==", "img.png": "bknBlmIfSb9qv9/lSaJ2idn2a8bDyvJ2pATj4oOpehRlCdXlWYOyb2jN3wV1QGHFoqyxNqOv5MfCpI0tbqkicg==", @@ -33,13 +33,13 @@ "loader.gif": "ZZKD5vLSKBWKeUpa2KI9qheUJ49iTI/UULmVU/AX28fBfH00K3lLc2v5pVJZ4qXG1BbB13LTXzRKKU35H2XfNg==", "lookyloo.jpeg": "i6wBj8CsIM5YAQLEMQfhs3CNOSKkErF8AMqqM6ZygSwCyQgv9CU8xt94veMZhM/ufBWoz7kAXmR+yywmxsTxug==", "redirect.png": "PAjzlPV97rEFvH55mG1ZC9wRl98be3yMeX/nENuFkJcds6/AXgSR2ig/QyPULgobSnNgiYieLVWY/oqsgeywrQ==", - "render_tables.js": "OLZO9NhH1yPc6oneYjwRyk0aVAEPGlt/O6TjGvqhFYj8FMZSP9w32kTByYzWXIY0AszJj6It33u8U2uLuGiEZQ==", + "render_tables.js": "Lpte5N1uaEGRFWyn8DlriXQUS51LEMBTj9Ux8CcdkTcg70LuuTo3RPdBrC2b63U/sdaOR9RuDFo9Z4UELK2GTw==", "secure.svg": "H8ni7t0d60nCJDVGuZpuxC+RBy/ipAjWT627D12HlZGg6LUmjSwPTQTUekm3UJupEP7TUkhXyq6WHc5gy7QBjg==", "stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==", "stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==", "tree.css": "jc7+RiJaZy7utfMu7iMWicpt0y0ZFiEQlB4c7MFNdlWcZf0czi3LgSQUFlDWt828Mx463V+JP1RalXuRjbGcEg==", "tree.js": "lj5SMtMYs2Oo++fWzHl2aQVHraCFZgpLCey99kql5wjhpYXryoacHM1zLHrP9E6A+b/1VA2zun9d445E3RLk4Q==", - "tree_modals.js": "mGWQ9o4O+x8vBe9XNuAFrEfz8veuRwqE+wpreVKFQcvBvxNcgvxI0SjH9Z3gdozTTY7Hq7yqvC7xA9PWDblN/Q==", + "tree_modals.js": "E3SbfY0PXAwAOjaTu+l8VJ1L84bM7VgMRt3xEwdsPmstipyAlFtJAUTBV1FoV6nXRp7vKqeHtKDvncgapGs1Uw==", "up.jpg": "d1ljZJ9f5JekyM6RLFFH2Ua44j6neiQBdUIXOenRTjGppQr3JaeglpQIH6BjPCJL177+TH52U3UIRNS5YAyKIg==", "up_right.jpg": "OMmz+n+MxR34P8/fn5t4DkqKqdJRzQbXQ7fAi2lhkZIJGhVs2vIyY1f2hpYoBxDAX1OcYsSE2lqIR2vXNDGZsA==", "video.png": "gJtmkfr8I1Kw43pYEKjg6CAjgmhl1vIBKBQ3ZkxCu3wvxQm+6kf93iLrrFiY2WuiXzxEn2Leu52GJzmVN5id0g==", diff --git a/website/web/static/generic.js b/website/web/static/generic.js index 14582f74..93567205 100644 --- a/website/web/static/generic.js +++ b/website/web/static/generic.js @@ -1,23 +1,5 @@ "use strict"; -// Copy to clipboard -// Source: https://codepen.io/nathanlong/pen/ZpAmjv -let copyToClipboard = (text, el) => { - const elOriginalText = el.attr('data-original-title'); - - const copyTextArea = document.createElement("textarea"); - copyTextArea.value = text; - document.body.appendChild(copyTextArea); - copyTextArea.select(); - - const successful = document.execCommand('copy'); - const msg = successful ? 'Copied!' : 'Whoops, not copied!'; - el.attr('data-original-title', msg).tooltip('show'); - - document.body.removeChild(copyTextArea); - el.attr('data-original-title', elOriginalText); -} - function checkAllBoxes(name) { let checkboxs = document.getElementsByName(name); for(let i = 0; i < checkboxs.length ; i++) { @@ -42,30 +24,6 @@ function openTreeInNewTab(capture_uuid, hostnode_uuid=null) { return openURLInNewTab(url); } -const goBackButtons = document.querySelectorAll('.goBack'); -goBackButtons.forEach(el => el.addEventListener('click', event => { - window.history.back(); -})); - -const openNewTabButtons = document.querySelectorAll('.openNewTab'); -openNewTabButtons.forEach(el => el.addEventListener('click', event => { - if (window.opener === null) { - return openTreeInNewTab(el.dataset.capture, el.dataset.hostnode) - } else { - 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 @@ -80,3 +38,25 @@ function downloadBase64File(contentType, base64Data, fileName) { downloadLink.download = fileName; downloadLink.click(); } + +document.addEventListener("DOMContentLoaded", () => { + + document.querySelectorAll('.goBack').forEach(el => el.addEventListener('click', event => { + window.history.back(); + })); + + document.querySelectorAll('.openNewTab').forEach(el => el.addEventListener('click', event => { + if (window.opener === null) { + return openTreeInNewTab(el.dataset.capture, el.dataset.hostnode) + } else { + 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."); + } + } + })); + + document.querySelectorAll(".locateInTree").forEach(el => el.addEventListener('click', event => { + window.opener.LocateNode(el.dataset.hostnode); + })); +}); diff --git a/website/web/static/hostname_popup.js b/website/web/static/hostname_popup.js index de655e0d..5d35c9b7 100644 --- a/website/web/static/hostname_popup.js +++ b/website/web/static/hostname_popup.js @@ -1,19 +1,3 @@ -document.addEventListener("DOMContentLoaded", () => { - // Grab any text in the attribute 'data-copy' and pass it to the copy function - $('.js-copy').tooltip(); - $('.js-copy').click(function() { - const text = $(this).attr('data-copy'); - const el = $(this); - copyToClipboard(text, el); - }); -}); - -document.addEventListener("DOMContentLoaded", () => { - $(function () { - $('[data-bs-toggle="tooltip"]').tooltip() - }) -}); - function submit_pandora(node_uuid, ressource_hash){ let data = {}; if (node_uuid) { @@ -39,8 +23,20 @@ function submit_pandora(node_uuid, ressource_hash){ }; document.addEventListener("DOMContentLoaded", () => { - document.querySelectorAll('.submitPandoraButton').forEach( - el => el.addEventListener('click', event => { - submit_pandora(el.dataset.hostnode, el.dataset.hash); - })); + 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 => { + submit_pandora(el.dataset.hostnode, el.dataset.hash); + })); + 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); + }); + }) + ); }); diff --git a/website/web/static/render_tables.js b/website/web/static/render_tables.js index e65c5bb9..4cc2bd7a 100644 --- a/website/web/static/render_tables.js +++ b/website/web/static/render_tables.js @@ -1,4 +1,4 @@ -["load", "shown.bs.modal"].forEach(e => window.addEventListener(e, function() { +["DOMContentLoaded", "shown.bs.modal", "jquery.modal.rendered"].forEach(e => window.addEventListener(e, function() { if (document.getElementById('bodyHashDetailsTable')) { new DataTable('#bodyHashDetailsTable', { diff --git a/website/web/static/tree_modals.js b/website/web/static/tree_modals.js index 102b264d..f70560b6 100644 --- a/website/web/static/tree_modals.js +++ b/website/web/static/tree_modals.js @@ -3,108 +3,108 @@ $('#hashlookupModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#modulesModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#historyModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#categoriesModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#statsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#identifiersModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#identifierDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#faviconsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#faviconDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#captureHashesTypesModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#captureHashesTypesDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#faviconDetailsProbabilisticHashModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#bodyHashesModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#bodyHashDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#hostnamesModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#hostnameDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#urlsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#urlDetailsModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); $('#mispPushModal').on('show.bs.modal', function(e) { @@ -134,7 +134,7 @@ $('#mispLookupModal').on('show.bs.modal', function(e) { $('#urlsInPageModal').on('show.bs.modal', function(e) { var button = $(e.relatedTarget); var modal = $(this); - modal.find('.modal-body').load(button.data("remote")); + modal.find('.modal-body').load(button.data("remote")).trigger('jquery.modal.rendered'); }); // Categories diff --git a/website/web/templates/hostname_popup.html b/website/web/templates/hostname_popup.html index fafbc6d5..7c5ef9bb 100644 --- a/website/web/templates/hostname_popup.html +++ b/website/web/templates/hostname_popup.html @@ -143,7 +143,7 @@ ... /{{ shorten_string(url['url_path'], 50)}} {# Copy full URL to clipbard #}