PageSourceSearch

https://www.redhat.com/rhdc/system-files/js/js_CgxJQRnFCLtxuS27qqD…ant365siwRP93EXxMdmXrvAfJNPxRjn1nJX4B0BHtog

js redhat.com collected 2026-10-01 07:59:05 UTC 11,546 bytes, 3 lines download raw bytes

1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */
2"use strict";((window)=>{performance.mark('rhdc-user--start');let loginButtonsInit=false;let oidcClient=null;if(!window.oidcManager)window.addEventListener('oidc-manager-registered',oidcManagerRegistered,{once:true});else{oidcManagerRegistered();const defaultMessage=new CustomEvent('message',{detail:{type:'oidc_manager_available'}});oidcManagerCallback(defaultMessage);}function oidcManagerRegistered(){window.oidcManager.addEventListener('message',oidcManagerCallback);}function oidcManagerCallback(e){performance.mark('rhdc-user--callback');customElements.whenDefined('rh-navigation-primary').then(()=>{const client=window.oidcManager.clients.get(window.drupalSettings.rh_oidc_manager.oidc_settings.client_id);oidcClient=client;performance.mark('rhdc-user--setup');if(client.user){dispatchLoginEvent(client);document.addEventListener('rh-nav:logout-requested',()=>{if(oidcClient)oidcClient.logout();});}else setupLoginButton(client);});}function dispatchLoginEvent(client){const userProfile=client.user.profile;document.dispatchEvent(new CustomEvent('rh-nav:login',{detail:{firstName:userProfile.given_name,lastName:userProfile.family_name,email:userProfile.email,username:userProfile.preferred_username,account_number:userProfile.organization?.account_number??'',realm_access:userProfile.realm_access??{roles:[]}}}));}function setupLoginButton(client){const loginLink=document.querySelector('#account-login-button');if(loginLink&&!loginButtonsInit){const isHomePage=!window.location.pathname.split('/')[2];let redirect_uri=window.location.href;if(isHomePage){const langFromPath=window.location.pathname.split('/')[1];redirect_uri=(langFromPath)?window.origin+'/'+langFromPath+'/dashboard':window.origin+'/dashboard';}client.manager._client.createSigninRequest({redirect_uri}).then((res)=>{const {url}=res;loginLink.setAttribute('href',url);});loginButtonsInit=true;}}})(window);;
3(function(Drupal,drupalSettings,once){Drupal.behaviors.rhdc_search={attach:function(context){const forms=once('rhdc-search-form','.nav-search-form',context);if(forms.length>
30)forms.forEach(((form)=>{form.addEventListener('submit',function(e){e.preventDefault();const searchField=this.querySelector('#nav-search-input');const keys=searchField?searchField.value.trim():'';if(keys){document.cookie=`nav_search=true; SameSite=Strict; domain=${window.location.host}; path=/en/search; Secure`;window.location.href=`${window.location.origin}/${drupalSettings.path.pathPrefix.replace(/\/?$/,'/')}search?search=${encodeURIComponent(keys)}`;}else window.location.href=`${window.location.origin}/${drupalSettings.path.pathPrefix.replace(/\/?$/,'/')}search`;});}));}};Drupal.behaviors.rhdc_search_autocomplete={autocompleteState:{form:null,container:null,input:null,clearButton:null,timeout:null,lastKeyPressed:''},autocompleteEvents:[],terms:[],termsPromise:null,loadTerms:function(){const url=drupalSettings.rhdc_search?.auto_suggestions_url;if(!url)return Promise.resolve();if(!this.termsPromise)this.termsPromise=fetch(url).then((response)=>(response.ok?response.json():{terms:[]})).then((data)=>{if(data?.terms?.length)this.terms=data.terms;}).catch(()=>{this.terms=[];});return this.termsPromise;},attach:function(context){const rhdcSearchForm=once('rhdc-search-autocomplete-form',context.querySelector('.nav-search-form')).shift();if(rhdcSearchForm)this.suggestionsInit(context,rhdcSearchForm,'.form-wrapper','nav-search-input');},suggestionsInit:function(context,formElement,wrapperSelector,inputId){this.autocompleteState.form=formElement;this.autocompleteState.container=this.ensureContainer(this.autocompleteState.form.querySelector(wrapperSelector),'search-autocomplete__container');this.autocompleteState.input=this.autocompleteState.form.querySelector(`#${inputId}`);this.autocompleteState.clearButton=context.getElementById('clear-search-button');this.autocompleteEvents=[{target:context,event:'focusin',handler:this.focusListener.bind(this),persistent:true},{target:context,event:'keydown',handler:this.lastKeyListener.bind(this),persistent:true},{target:context,event:'click',handler:this.clickListener.bind(this)},{target:this.autocompleteState.form,event:'keydown',handler:this.handleKeydown.bind(this)}];this.autocompleteEvents.filter(({persistent})=>persistent).forEach(({target,event,handler})=>target.addEventListener(event,handler));this.autocompleteState.input.addEventListener('input',Drupal.debounce(this.autocompleteSuggestions.bind(this),250));this.autocompleteState.input.addEventListener('search-cleared',()=>{this.hideSuggestions();});},attachListeners:function(){this.autocompleteEvents.filter(({persistent})=>!persistent).forEach(({target,event,handler})=>{target.addEventListener(event,handler);});},detachListeners:function(){this.autocompleteEvents.filter(({persistent})=>!persistent).forEach(({target,event,handler})=>{target.removeEventListener(event,handler);});},showSuggestions:function(immediate=false){clearTimeout(this.autocompleteState.timeout);const reveal=()=>{this.autocompleteState.container.removeAttribute('inert');this.autocompleteState.container.classList.add('visible');};if(immediate)reveal();else this.autocompleteState.timeout=setTimeout(reveal,600);this.attachListeners();},collapseSuggestions:function(){clearTimeout(this.autocompleteState.timeout);this.autocompleteState.container.classList.remove('visible');this.autocompleteState.container.setAttribute('inert','');this.detachListeners();},hideSuggestions:function(){clearTimeout(this.autocompleteState.timeout);this.autocompleteState.container.replaceChildren();this.autocompleteState.container.dataset.lastKeys='';this.autocompleteState.container.classList.remove('visible');this.autocompleteState.container.removeAttribute('inert');this.detachListeners();},autocompleteSuggestions:function(){const {input,container}=this.autocompleteState;const keys=input.value.trim();const baseUrl=`${window.location.origin}/${drupalSettings.path.pathPrefix.replace(/\/?$/,'/')}`;const limit=drupalSettings.rhdc_search?.limit||10;if(keys.length>=2&&keys!==container.dataset.lastKeys){container.dataset.lastKeys=keys;this.loadTerms().then(()=>{if(keys!==input.value.trim()||keys!==container.dataset.lastKeys)return;if(this.terms&&this.terms.length){const results=this.terms.filter((term)=>term.name.toLowerCase().includes(keys.toLowerCase())).sort((a,b)=>b.weight-a.weight).slice(0,limit);this.showSuggestions();const ul=document.createElement('ul');ul.setAttribute('role','listbox');if(results&&results.length>
30){results.forEach((item)=>{const li=document.createElement('li');li.classList.add('search-autocomplete__item');li.setAttribute('role','option');const href=`${baseUrl}search?search=${encodeURIComponent(item.name)}`;const anchor=document.createElement('a');anchor.setAttribute('href',href);anchor.textContent=item.name;anchor.addEventListener('click',()=>{document.cookie=`nav_search=true; SameSite=Strict; domain=${window.location.host}; path=/en/search; Secure`;});li.appendChild(anchor);ul.appendChild(li);});container.replaceChildren(ul);}else this.hideSuggestions();}else{container.dataset.lastKeys='';this.hideSuggestions();}});}else{if(!keys||keys.length<2)this.hideSuggestions();}},ensureContainer:function(parent,className){let element=once(`element-${className}`,parent.querySelector(`.${className}`)).shift();if(!element){element=document.createElement('div');element.classList.add(className);parent.appendChild(element);}return element;},handleKeydown:function(e){const {input,container}=this.autocompleteState;const activeElement=document.activeElement;this.lastKeyListener(e);const isTargetInContainer=container.contains(e.target);switch(e.key){case 'Escape':if(container.hasChildNodes()){if(isTargetInContainer)input.focus();e.stopImmediatePropagation();e.preventDefault();this.hideSuggestions();}break;case 'Enter':if(isTargetInContainer){input.value=e.target.text;input.focus();}break;case ' ':if(isTargetInContainer){e.preventDefault();input.value=e.target.text;input.focus();this.hideSuggestions();}break;case 'ArrowUp':if(isTargetInContainer){e.preventDefault();if(e.altKey&&e.key==='ArrowUp'){input.value=e.target.text;input.focus();this.hideSuggestions();}else{const activeElementParent=activeElement.parentNode;let previousSibling=null;if(activeElementParent.previousSibling)previousSibling=activeElementParent.previousSibling.firstChild;if(container.contains(previousSibling))previousSibling?.focus({focusVisible:true});}}break;case 'ArrowDown':if(isTargetInContainer){e.preventDefault();const activeElementParent=activeElement.parentNode;let nextSibling=null;if(activeElementParent.nextSibling)nextSibling=activeElementParent.nextSibling.firstChild;if(container.contains(nextSibling))nextSibling?.focus({focusVisible:true});}else{if(activeElement===input){e.preventDefault();if(container.firstChild.firstChild.firstChild)container.firstChild.firstChild.firstChild.focus({focusVisible:true});}}break;case 'Home':if(isTargetInContainer){e.preventDefault();const activeElementContainer=activeElement.parentNode.parentNode;const containerFirstChild=activeElementContainer.firstChild.firstChild;if(activeElement!==containerFirstChild)containerFirstChild.focus({focusVisible:true});}break;case 'End':if(isTargetInContainer){e.preventDefault();const activeElementContainer=activeElement.parentNode.parentNode;const containerLastChild=activeElementContainer.lastChild.firstChild;if(activeElement!==containerLastChild)containerLastChild.focus({focusVisible:true});}break;case 'PageUp':if(isTargetInContainer){e.preventDefault();const activeElementParent=activeElement.parentNode;const activeElementContainer=activeElement.parentNode.parentNode;const siblings=[];let sibling=activeElementContainer.firstChild;while(sibling){if(sibling.nodeType===1&&sibling!==e)siblings.push(sibling);sibling=sibling.nextSibling;}const currentIndex=siblings.indexOf(activeElementParent);if(currentIndex-10<0)activeElementContainer.firstChild.firstChild.focus({focusVisible:true});else{if(currentIndex-10>=0)siblings[currentIndex-10].firstChild.focus({focusVisible:true});}}break;case 'PageDown':if(isTargetInContainer){e.preventDefault();const activeElementParent=activeElement.parentNode;const activeElementContainer=activeElement.parentNode.parentNode;const siblings=[];let sibling=activeElementContainer.firstChild;while(sibling){if(sibling.nodeType===1&&sibling!==e)siblings.push(sibling);sibling=sibling.nextSibling;}const siblingCount=siblings.length;const currentIndex=siblings.indexOf(activeElementParent);if((currentIndex+1)+10>siblingCount)activeElementContainer.lastChild.firstChild.focus({focusVisible:true});else{if((currentIndex+1)+10<=siblingCount)siblings[currentIndex+10].firstChild.focus({focusVisible:true});}}break;default:break;}},clickListener:function(e){const {input,container}=this.autocompleteState;
3if(e.target!==input&&!container.contains(e.target))this.hideSuggestions();},focusListener:function(e){const {input,container,clearButton}=this.autocompleteState;const keys=input.value.trim();if(e.target===input){if(!container.classList.contains('visible')&&container.hasChildNodes()&&keys.length>=2&&keys===container.dataset.lastKeys)this.showSuggestions(true);return;}if(this.autocompleteState.lastKeyPressed==='Tab'){if(container.classList.contains('visible')&&container.contains(e.target)){e.preventDefault();clearButton.focus();}this.collapseSuggestions();}},lastKeyListener:function(e){this.autocompleteState.lastKeyPressed=e.key;}};})(Drupal,drupalSettings,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.