1const classesToMonitor = [ 2 ".fa.fa-download.fa-2x", // Changed to a CSS class selector 3 ".ItemDownloadImage-itemDownloadDropdown.dropdown.btn-group" // Changed to a CSS class selector 4]; 5const newMessage = "Please note that any use of content downloaded or printed from this site is limited to non-commercial personal or educational use, including fair use as directed by U.S. copyright laws. For more information or for reproduction requests, please contact: [email protected]"; 6 7// Self-executing anonymous function to encapsulate the code 8(function() { 9 // Listen for the custom event 'cdm-item-page:ready' 10 document.addEventListener('cdm-item-page:ready', function(event) { 11 let globalScope = true; 12 // Loop through each CSS selector in the classesToMonitor array 13 classesToMonitor.forEach(selector => { 14 // Find all elements matching the current CSS selector 15 const elements = document.querySelectorAll(selector); 16 17 // For each found element, attach a click event listener 18 elements.forEach(element => { 19 element.addEventListener('click', (clickEvent) => { 20 alert(newMessage); // Display the alert message 21 }); 22 }); 23 }); 24 }); 25})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.