1(function (Drupal, drupalSettings) { 2 Drupal.behaviors.stratis_gdpr_encryption = { 3 attach: function (context) { 4 document.querySelectorAll('button.stratis-gdpr-encryption').forEach(function(button) { 5 button.addEventListener('click', function(e) { 6 const url = this.getAttribute('data-url') + '?route=' + drupalSettings.path.route; 7 const elem = this.parentElement; 8 9 const xhr = new XMLHttpRequest(); 10 xhr.onreadystatechange = function() { 11 if (xhr.readyState === XMLHttpRequest.DONE) { 12 if (xhr.status === 200) { 13 let result = JSON.parse(xhr.responseText); 14 if (result.success === true) { 15 result = result.decrypted; 16 } else { 17 result = Drupal.t('OOPS! Something went wrong'); 18 } 19 20 if (elem.querySelectorAll('label').length > 0) { 21 result = elem.querySelector('label').outerHTML + result; 22 } 23 elem.innerHTML = result; 24 } 25 } 26 }; 27 xhr.open('GET', url); 28 xhr.send(); 29 30 e.preventDefault(); 31 }); 32 }); 33 } 34 }; 35})(Drupal, drupalSettings);
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.