1// Propaganistas provides the Rot13 in the global namespace. 2// So it has been adapted here an wrapped for Drupal. 3// The inline <script> has been replaced as well. 4(function ($, Drupal, once) { 5 'use strict'; 6 7 function transformRot13(rot13Email) { 8 let result = rot13Email.replace(/[A-Za-z]/g, function (c) { 9 return String.fromCharCode(c.charCodeAt(0) + (c.toUpperCase() <= 'M' ? 13 : -13)); 10 }) 11 12 // document.createElement will trigger any script tag. We must use DOMParser. 13 let doc = new DOMParser().parseFromString(result, 'text/html'); 14 return doc.body.textContent || ''; 15 } 16 17 function init(element) { 18 // Remove the css fallback 19 $(element).find('.js-disabled').remove(); 20 // Transform back the rot 13 21 var rot13Element = $(element).find('.js-enabled'); 22 rot13Element.show(); 23 var transformedEmail = transformRot13(rot13Element.text()); 24 rot13Element.html('<a href="mailto:'+transformedEmail+'">'+transformedEmail+'</a>'); 25 } 26 27 Drupal.behaviors.obfuscateRot13 = { 28 attach: function (context) { 29 let elements = jQuery(once('boshfpngr-e13', '.boshfpngr-e13', context)).each(function () { 30 init(this); 31 }); 32 } 33 }; 34})(jQuery, Drupal, once);
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.