1app.directive('pioLoading', ['$timeout', function ($timeout) { 2 return { 3 restrict: 'A', 4 link: function (scope, element, attrs) { 5 var host = element[0]; 6 var reserved = (attrs.pioLoadingHeight || '').trim(); 7 var holdsHeight = attrs.pioLoadingHold !== 'false'; 8 var overlay = document.createElement('div'); 9 var lastHeight = 0; 10 var observer = null; 11 12 overlay.className = 'pio-loading-overlay'; 13 overlay.setAttribute('aria-hidden', 'true'); 14 overlay.innerHTML = '<span class="pio-loading-spinner"></span>'; 15 16 host.classList.add('pio-loading-host'); 17 if (reserved) host.style.minHeight = reserved; 18 host.appendChild(overlay); 19 20 function remember() { 21 if (host.classList.contains('pio-is-loading')) return; 22 var height = host.offsetHeight; 23 if (height > 0) lastHeight = height; 24 } 25 26 if (window.ResizeObserver) { 27 observer = new ResizeObserver(remember); 28 observer.observe(host); 29 } 30 31 function hold() { 32 if (!observer) remember(); 33 if (holdsHeight && lastHeight > 0) host.style.minHeight = lastHeight + 'px'; 34 host.classList.add('pio-is-loading'); 35 host.setAttribute('aria-busy', 'true'); 36 } 37 38 function release() { 39 host.classList.remove('pio-is-loading'); 40 host.removeAttribute('aria-busy'); 41 host.style.minHeight = reserved; 42 $timeout(remember, 0, false); 43 } 44 45 scope.$watch( 46 function () { return !!scope.$eval(attrs.pioLoading); }, 47 function (loading) { if (loading) hold(); else release(); } 48 ); 49 50 scope.$on('$destroy', function () { 51 if (observer) observer.disconnect(); 52 }); 53 } 54 }; 55}]);
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.