{"version":3,"sources":["ticker.js"],"names":["jQuery","$","each","$list","this","$items","width","duration","Math","round","append","clone","addClass","attr","target_transx","$item","diff_transx_time","current_transx","e","target","parseFloat","WebKitCSSMatrix","window","getComputedStyle","get","transform","m41","new_delay","css","animationDuration","concat","animationPlayState"],"mappings":"aAAAA,OAAQ,SAAWC,GAKjBA,EAAG,kBAAmBC,KAAM,WAC1B,IAAMC,EAAWF,EAAA,OAAQG,MACnBC,EAAYJ,EAAA,OAAQE,GACpBG,EAAQH,EAAMG,QAEdC,EAAWC,KAAKC,MAAOH,EAR/B,GAQ+C,KAG3CH,EAAKD,KAACQ,WADRP,EAAAO,OAAAT,EAAAG,MAAAO,QAAAC,SAAA,SAAAC,KAAA,cAAA,WAMAV,EAAAA,WAAeA,GAAAU,KAAe,YAAA,GAI5BV,EAAMW,QAAAA,SAAgBC,GAGhBC,IACuC,EAHvCC,EAAcC,EAAKC,QACLL,QAAa,MAEXM,IAAYjB,GAAAA,WAHT,IAAIkB,gBAAiBC,OAAOC,iBAAkBpB,EAAMqB,IAAI,IAAKC,WAAcC,KAE7DpB,EAAQC,EAM9CoB,EAFoB,IAAAP,WAAAjB,EAAAyB,IAAA,oBAEpBZ,EAFgB,EAAZW,IAGLA,GAAapB,GAObsB,EAAAA,IAAAA,kBAAAA,GAAAA,OArBFF,GAAApB,EAqBEsB,SAvCN1B,EAAAyB,IAAA,CAuCMC,kBAAiB,GAAAC,OAAMvB,EAAN,MACjBwB,mBAAoB","file":"ticker.js","sourcesContent":["jQuery( function ( $ ) {\n\n // ticker speed in px/s\n const speed = 50;\n\n $( '.simple-ticker' ).each( function () {\n const $list = $( '> ul', this );\n const $items = $( '> li', $list );\n const width = $list.width();\n // in ms\n const duration = Math.round( width / speed * 1000 );\n \n $items.each( function () {\n $list.append( $(this).clone().addClass( 'clone' ).attr( 'aria-hidden', 'true' ) );\n });\n $( '.clone a', $list ).attr( 'tabindex', -1 );\n\n\n $list.focusin( function ( e ) {\n const $target = $( e.target );\n const $item = $target.closest( 'li' );\n\n const target_transx = $item.get(0).offsetLeft * -1;\n const current_transx = ( new WebKitCSSMatrix( window.getComputedStyle( $list.get(0) ).transform ) ).m41;\n const diff_transx = target_transx - current_transx;\n const diff_transx_time = diff_transx / width * duration;\n const current_delay = parseFloat( $list.css( 'animation-delay' ) ) * 1000; // JS reads the value in seconds\n\n let new_delay = current_delay + diff_transx_time;\n if ( new_delay > 0 ) {\n new_delay -= duration;\n }\n new_delay %= duration;\n\n $list.css( 'animation-delay', `${ new_delay }ms` );\n });\n\n\n $list.css({\n animationDuration: `${ duration }ms`,\n animationPlayState: 'running',\n });\n\n });\n\n});"]}