1(function() { 2 /** 3 * Decoding helper function 4 * 5 * @param {number} charCode 6 * @param {number} start 7 * @param {number} end 8 * @param {number} offset 9 * @return {string} 10 */ 11 function decryptCharcode(charCode, start, end, offset) { 12 charCode = charCode + offset; 13 if (offset > 0 && charCode > end) { 14 charCode = start + (charCode - end - 1); 15 } else if (offset < 0 && charCode < start) { 16 charCode = end - (start - charCode - 1); 17 } 18 return String.fromCharCode(charCode); 19 } 20 /** 21 * Decodes string 22 * 23 * @param {string} value 24 * @param {number} offset 25 * @return {string} 26 */ 27 function decryptString(value, offset) { 28 var result = ''; 29 for (var i=0; i < value.length; i++) { 30 var charCode = value.charCodeAt(i); 31 if (charCode >= 0x2B && charCode <= 0x3A) { 32 result += decryptCharcode(charCode,0x2B,0x3A,offset); /* 0-9 . , - + / : */ 33 } else if (charCode >= 0x40 && charCode <= 0x5A) { 34 result += decryptCharcode(charCode,0x40,0x5A,offset); /* A-Z @ */ 35 } else if (charCode >= 0x61 && charCode <= 0x7A) { 36 result += decryptCharcode(charCode,0x61,0x7A,offset); /* a-z */ 37 } else { 38 result += value.charAt(i); 39 } 40 } 41 return result; 42 } 43 44 /** 45 * Opens URL in new window. 46 * 47 * @param {string} url 48 * @param {string|null} target 49 * @param {string|null} features 50 * @return {Window} 51 */ 52 function windowOpen(url, target, features) { 53 var windowRef = window.open(url, target, features); 54 if (windowRef) { 55 windowRef.focus(); 56 } 57 return windowRef; 58 } 59 60 /** 61 * Delegates event handling to elements 62 * 63 * @param {string} event 64 * @param {string} selector 65 * @param {function} callback 66 */ 67 function delegateEvent(event, selector, callback) { 68 document.addEventListener(event, function(evt) { 69 for (var targetElement = evt.target; targetElement && targetElement !== document; targetElement = targetElement.parentNode) { 70 if (targetElement.matches(selector)) { 71 callback.call(targetElement, evt, targetElement); 72 } 73 } 74 }); 75 } 76 77 // @deprecated Will be removed in TYPO3 v12.0 78 if (typeof window['linkTo_UnCryptMailto'] === 'undefined') { 79 window['linkTo_UnCryptMailto'] = function(value, offset) { 80 console.warn('Function linkTo_UnCryptMailto() is deprecated and will be remove in TYPO3 v12.0'); 81 if (value && offset) { 82 document.location.href = decryptString(value, offset); 83 } 84 }; 85 } 86 87 delegateEvent('click', 'a[data-mailto-token][data-mailto-vector]', function(evt, evtTarget) { 88 evt.preventDefault(); 89 var dataset = evtTarget.dataset; 90 var value = dataset.mailtoToken; 91 var offset = parseInt(dataset.mailtoVector, 10) * -1; 92 document.location.href = decryptString(value, offset); 93 }); 94 95 delegateEvent('click', 'a[data-window-url]', function(evt, evtTarget) { 96 evt.preventDefault(); 97 var dataset = evtTarget.dataset; 98 var url = dataset.windowUrl; 99 var target = dataset.windowTarget || null; 100 var features = dataset.windowFeatures || null; 101 windowOpen(url, target, features); 102 }); 103})();
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.