1(function (util) { 2 var componentType = registerComponentType('personlistblock-person'); 3 4 5 componentType.onCreate(function (component) { 6 7 let lastOpen = undefined; 8 9 component.state('open', function(){ 10 return component.getRoot().matches('.is-open'); 11 }); 12 13 component.on('toggleOpen', function(){ 14 if(component.state('open')){ 15 component.do('close'); 16 }else{ 17 component.do('open'); 18 } 19 }); 20 21 component.on('open', function(){ 22 if(!component.state('open')) { 23 component.getRoot().classList.add('is-open'); 24 lastOpen = new Date(); 25 } 26 }); 27 28 component.on('close', function(){ 29 component.getRoot().classList.remove('is-open'); 30 }); 31 32 component.onDOMEvent(null, 'click', function(evt){ 33 if(!component.state('open')) { 34 component.do('open'); 35 evt.preventDefault(); 36 evt.stopImmediatePropagation(); 37 return; 38 } 39 // prevent clicks on first click 40 if(lastOpen && ((new Date()).getTime() - lastOpen.getTime()) < 100){ 41 evt.preventDefault(); 42 evt.stopImmediatePropagation(); 43 } 44 }); 45 component.onDOMEvent(null, 'mouseenter', 'open'); 46 component.onDOMEvent(null, 'mouseleave', 'close'); 47 48 }); 49 50 componentType.autoRegisterComponents(); 51 52})(window.jQueryPolyfill);
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.