PageSourceSearch

https://www.infopresse.com/wp-content/cache/perfmatters/www.infopr…5.infopresse-stimulus.min.js?ver=1776867608

js infopresse.com collected 2026-10-02 07:35:57 UTC 5,385 bytes, 35 lines download raw bytes

1import{Application,Controller}from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
2window.Stimulus=Application.start()
3Stimulus.register("card",class extends Controller{static targets=["link"];connect(){if(!this.hasLinkTarget){const link=this.element.querySelector('.js-link-href');if(link){link.setAttribute('data-card-target','link')}}}
4click(event){if(!this.hasLinkTarget)return
5if(event.target.closest('a')===this.linkTarget)return
6event.preventDefault();event.stopPropagation();this.linkTarget.click()}});Stimulus.register("user",class extends Controller{static values={productCats:String,productCatFeatured:String,userId:String,};connect(){this.cookieName='viewed_cat_counts';this.getCookieValue();if(this.hasProductCatsValue){this.productCatsList=JSON.parse(this.productCatsValue??'[]');this.updateCookieCount();if(this.hasUserIdValue){this.updateUserMetaWithCurrentCat()}}}
7getCookieValue(){try{const cookieValue=(this.getCookie(this.cookieName));this.cookieValue=cookieValue.length>0?JSON.parse(cookieValue):{}}catch(e){this.cookieValue={}}
8return}
9updateCookieCount(){(this.productCatsList||[]).forEach((item)=>{this.cookieValue[item]=(this.cookieValue[item]||0)+1});if(this.hasProductCatFeaturedValue&&parseInt(this.productCatFeaturedValue)>1){this.cookieValue[parseInt(this.productCatFeaturedValue)]=(this.cookieValue[parseInt(this.productCatFeaturedValue)]||0)+4}
10const date=new Date();date.setTime(date.getTime()+(60*24*60*60*1000));document.cookie=this.cookieName+"="+JSON.stringify(this.cookieValue)+"; expires="+date.toUTCString()+"; path=/; Secure; SameSite=Lax"}
11async updateUserMetaWithCurrentCat(){const params=new URLSearchParams({'action':'update_user_viewed_count','cat_ids':JSON.stringify(this.productCatsList||[]),'cat_id_featured':this.productCatFeaturedValue||'',});const response=await fetch(`${wp_ajax.url}?${params}`);const html=await response.text();console.log('update_user_viewed_count => ',html)}
12getCookie(name){const value=`; ${document.cookie}`;const parts=value.split(`; ${name}=`);if(parts.length===2){return parts.pop().split(';').shift()}
13return''}});Stimulus.register("manager",class extends Controller{static targets=["block"];static values={userId:String,};connect(){if((!this.hasUserIdValue||this.userIdValue=='')&&this.hasCookie('viewed_cat_counts')){this.reloadAll()}else{this.reloadAll(!1);this.element.classList.add('updated_content')}
14this.element.classList.add('manager_controller_connect')}
15async reloadAll(updateContent=!0){const blocks=this.blockTargets.map((el,i)=>{el.setAttribute('data-batch-id',i);const storage=el.querySelector('template[data-inner-html-storage]')||'';return{index:i,type:el.dataset.blockType||'',attrs:JSON.parse(el.dataset.blockAttrs),content:storage&&storage.innerHTML?storage.innerHTML:''}});if(!blocks.length){updateContent=!1}
16const formData=new FormData()
17formData.append('action','batch_render_blocks')
18formData.append('payload',JSON.stringify(blocks))
19formData.append('cookie_cat_ids',this.getCookie('viewed_cat_counts'))
20formData.append('update_content',updateContent)
21const response=await fetch(wp_ajax.url,{method:'POST',body:formData})
22const result=await response.json()
23if(result.success){result.data.forEach(item=>{if(item.logs){;(item.logs||[item.logs]).forEach(x=>{console.log(x)})}else{const target=this.element.querySelector(`[data-batch-id="${item.index}"]`)
24let html=item.html;html=html.replace(/data-component="cursorPos"/g,'data-controller="card cursor-pos" data-action="click->card#click mousemove->cursor-pos#mousemove mouseleave->cursor-pos#mouseleave"');html=html.replaceAll('data-component="cursorPos"','data-controller="card cursor-pos" data-action="click->card#click mousemove->cursor-pos#mousemove mouseleave->cursor-pos#mouseleave"');if(target){target.outerHTML=html}}})
25this.element.classList.add('updated_content')}}
26hasCookie(name){const value=`; ${document.cookie}`;const parts=value.split(`; ${name}=`);if(parts.length===2){return!0}
27return!1}
28getCookie(name){const value=`; ${document.cookie}`;const parts=value.split(`; ${name}=`);if(parts.length===2){return parts.pop().split(';').shift()}
29return JSON.stringify({})}});Stimulus.register("cursor-pos",class extends Controller{static targets=["circle"];initialize(){this.tick=this.tick.bind(this);const circle=this.element.querySelector('.circle');if(circle&&!circle.hasAttribute('data-cursor-pos-target')){circle.setAttribute('data-cursor-pos-target','circle')}}
30connect(){this.mouse={x:0,y:0};this.current={x:0,y:0};this.isFirst=!0;this.active=!0;this.isTouch=window.matchMedia("(pointer: coarse)").matches;if(!this.isTouch&&this.hasCircleTarget){this.rafId=requestAnimationFrame(this.tick)}}
31disconnect(){this.active=!1;cancelAnimationFrame(this.rafId)}
32mousemove(e){if(this.isTouch)return;const rect=this.element.getBoundingClientRect();this.mouse.x=e.clientX-rect.left;this.mouse.y=e.clientY-rect.top;if(this.isFirst){this.current.x=this.mouse.x;this.current.y=this.mouse.y;this.isFirst=!1}}
33mouseleave(){this.isFirst=!0}
34tick(){if(!this.active)return;const ease=0.15;this.current.x+=(this.mouse.x-this.current.x)*ease;this.current.y+=(this.mouse.y-this.current.y)*ease;this.updateProperties();this.rafId=requestAnimationFrame(this.tick)}
35updateProperties(){if(!this.hasCircleTarget)return;this.circleTarget.style.transform=`translate3d(${this.current.x.toFixed(2)}px, ${this.current.y.toFixed(2)}
35px, 0)`}})

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.