1// @see https://developer.mozilla.org/fr/docs/Web/API/EventTarget/addEventListener 2// Thank you Maxence 3// Check if third argument options is supported 4// https://caniuse.com/mdn-api_eventtarget_addeventlistener_options_parameter 5let optionsSupported = false; 6try { 7 let options = Object.defineProperty( {}, "passive", { 8 get: function() { 9 optionsSupported = true; 10 } 11 } ); 12 window.addEventListener( "test", null, options ); 13 window.removeEventListener( "test", null, options ); 14} catch( err ) { 15 optionsSupported = false; 16} 17 18document.addEventListener( 'DOMContentLoaded', function() { 19 let options = false; 20 if ( optionsSupported ) { 21 options = { once: true, passive: true }; 22 } 23 var links = document.querySelectorAll( '[' + obflink_link_options.data_url + ']' ); 24 for ( var i = 0; i < links.length; i++ ) { 25 links[i].addEventListener( 'click', deObfuscate, options ); 26 links[i].addEventListener( 'contextmenu', deObfuscate, options ); 27 links[i].addEventListener( 'focusin', deObfuscate, options ); 28 links[i].addEventListener( 'mouseover', deObfuscate, options ); 29 } 30} ); 31 32var deObfuscate = function() { 33 34 // Retrieve the (modifiable) attributes names 35 let data_url_name = obflink_link_options.data_url; 36 37 let link = this.getAttribute( data_url_name ); 38 // Prevent double decode; == is intentional 39 if ( link == null ) { 40 return; 41 } 42 let url = decodeURIComponent( window.atob( link ) ); 43 44 // Reset href 45 this.setAttribute( 'href', url ); 46 this.removeAttribute( data_url_name ); 47 48 // Maybe transform <span> into <a> 49 if ( this.nodeName == 'SPAN' ) { 50 51 // Create new node 52 let aNode = document.createElement( 'a' ); 53 54 // Transfer link text 55 aNode.innerHTML = this.innerHTML; 56 57 // Transfer attributes 58 for ( const attr of this.attributes ) { 59 aNode.setAttribute( attr.name, attr.value ); 60 } 61 62 // Insert new node and remove original <span> 63 this.parentNode.insertBefore( aNode, this ); 64 this.remove(); 65 } 66}
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.