1class ManageAppSelector { 2 constructor() { 3 if (this.hasAppSelector(window.location.pathname)) { 4 document.addEventListener('click', (event) => { 5 const link = event.target.closest('a'); 6 if (link && link.href && !link.href.startsWith('#') && link.hostname === window.location.hostname) { 7 event.preventDefault(); 8 const newHref = this.addAppSelector(link.href); 9 window.location.href = newHref; 10 } 11 }); 12 } 13 }; 14 15 hasAppSelector(path) { 16 const regex = /(\.app)(\.)?(.*)?$/; 17 return path.match(regex) !== null; 18 } 19 20 addAppSelector(path) { 21 const currentPath = window.location.pathname; 22 const appSelectorPresent = this.hasAppSelector(currentPath); 23 console.log(`current href app selector: ${currentPath} ${appSelectorPresent}`); 24 25 if (appSelectorPresent && !this.hasAppSelector(path)) { 26 return path.replace(/(\.?(html|\/)?$)/, ".app$1"); 27 } 28 29 return path; 30 } 31}; 32 33window.AppSelector = new ManageAppSelector();
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.