1/** 2 * Subfolder-language client-side keeper (ECT-4200). 3 */ 4(function () { 5 'use strict'; 6 7 var lang = (typeof window.SUBFOLDER_LANG === 'string') ? window.SUBFOLDER_LANG : ''; 8 if (!/^[a-z]{2}$/.test(lang)) { 9 return; 10 } 11 12 var EXCLUDES = Array.isArray(window.SUBFOLDER_URL_EXCLUDES) ? window.SUBFOLDER_URL_EXCLUDES : []; 13 14 function prefixPath(url) { 15 if (typeof url !== 'string' || url.charAt(0) !== '/' || url.charAt(1) === '/') { 16 return url; 17 } 18 if (url === '/' + lang || url.indexOf('/' + lang + '/') === 0) { 19 return url; 20 } 21 var firstSegment = url.replace(/^\/+/, '').split(/[/?#]/)[0]; 22 if (EXCLUDES.indexOf(firstSegment) !== -1) { 23 return url; 24 } 25 return '/' + lang + url; 26 } 27 28 window.subfolderPrefixPath = prefixPath; 29 30 document.addEventListener('click', function (event) { 31 var anchor = event.target.closest ? event.target.closest('a[href]') : null; 32 if (!anchor) { 33 return; 34 } 35 var raw = anchor.getAttribute('href'); 36 var prefixed = prefixPath(raw); 37 if (prefixed !== raw) { 38 anchor.setAttribute('href', prefixed); 39 } 40 }, true); 41 42 if (window.jQuery) { 43 window.jQuery.ajaxPrefilter(function (options) { 44 if (options.url) { 45 options.url = prefixPath(options.url); 46 } 47 }); 48 } 49})();
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.