File "burst-goals.min.js"

Full path: /home/satkhirabarta/public_html/wp-content/plugins/burst-statistics/assets/js/build/burst-goals.min.js
File size: 1.9 B
MIME-type: text/plain
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

let viewportGoals=[];const burst_goals_setup=()=>{for(let e=0;e<burst.goals.length;e++){var t=burst.goals[e];t.url&&t.url!==window.location.pathname&&"*"!==t.url&&burst.goals.splice(e,1)}for(let e=0;e<burst.goals.length;e++){var r=burst.goals[e];("views"===r.type?burst_setup_viewport_tracker:burst_setup_click_tracker)(r)}window.addEventListener("scroll",handle_viewport_goals,!0)},handle_viewport_goals=()=>{viewportGoals.forEach((e,t)=>{burst_is_element_in_viewport(e.element)&&(burst_goal_triggered(e.goal),viewportGoals.splice(t,1))})},burst_setup_viewport_tracker=t=>{if(0!==t.attribute_value.length){var e="id"===t.attribute?"#":".",r=document.querySelectorAll(e+t.attribute_value);for(let e=0;e<r.length;e++){var l=r[e];burst_is_element_in_viewport(l)?burst_goal_triggered(t):viewportGoals.push({element:l,goal:t})}}},is_element_truly_visible=e=>{var t;return!e||"none"!==(t=window.getComputedStyle(e)).display&&"0"!==t.opacity&&is_element_truly_visible(e.parentElement)},burst_is_element_in_viewport=e=>{return!!is_element_truly_visible(e)&&0<=(e=e.getBoundingClientRect()).top&&0<=e.left&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)},burst_listener_view=(e,t)=>{burst_is_element_in_viewport(e)&&(burst_goal_triggered(t),window.removeEventListener("scroll",()=>burst_listener_view(e,t),!0))},burst_setup_click_tracker=t=>{document.body.addEventListener("click",function(e){burst_recursive_trigger_check(e.target,t)})},burst_recursive_trigger_check=(e,t)=>{var r;0!==t.attribute_value.length&&(r="id"===t.attribute?"#":".",e.matches(r+t.attribute_value)?burst_goal_triggered(t):e.parentElement&&burst_recursive_trigger_check(e.parentElement,t))},burst_goal_triggered=t=>{-1===burst_completed_goals.indexOf(t.ID)&&(burst_completed_goals.push(t.ID),viewportGoals=viewportGoals.filter(e=>e.goal.ID!==t.ID))};export default()=>{burst_goals_setup()};