classAjaxLoadingSpinner{staticinit(){const$elements=$('.js-ajax-loading-spinner');$elements.on('ajax:beforeSend',AjaxLoadingSpinner.ajaxBeforeSend);$elements.on('ajax:complete',AjaxLoadingSpinner.ajaxComplete);}staticajaxBeforeSend(e){e.target.setAttribute('disabled','');consticonElement=e.target.querySelector('i');// get first fa- iconconstoriginalIcon=iconElement.className.match(/(fa-)([^\s]+)/g).first();iconElement.dataset.icon=originalIcon;AjaxLoadingSpinner.toggleLoadingIcon(iconElement);$(e.target).off('ajax:beforeSend',AjaxLoadingSpinner.ajaxBeforeSend);}staticajaxComplete(e){e.target.removeAttribute('disabled');consticonElement=e.target.querySelector('i');AjaxLoadingSpinner.toggleLoadingIcon(iconElement);$(e.target).off('ajax:complete',AjaxLoadingSpinner.ajaxComplete);}statictoggleLoadingIcon(iconElement){constclassList=iconElement.classList;classList.toggle(iconElement.dataset.icon);classList.toggle('fa-spinner');classList.toggle('fa-spin');}}window.gl=window.gl||{};gl.AjaxLoadingSpinner=AjaxLoadingSpinner;