PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / trunk
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More vtrunk
4.1.0 4.0.9 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / assets / js / dynamic-blocks / countdown.js
superb-blocks / assets / js / dynamic-blocks Last commit date
accordion.js 2 weeks ago add-to-cart.js 2 weeks ago animated-heading.js 2 weeks ago block-animations.js 2 weeks ago carousel.js 2 weeks ago count-animations.js 2 weeks ago countdown.js 2 weeks ago form.js 2 weeks ago popup.js 2 weeks ago progress-bar.js 2 weeks ago reveal-button.js 2 weeks ago sticky.js 2 weeks ago table-of-contents-smooth-scroll.js 2 weeks ago typing-animations.js 2 weeks ago
countdown.js
1 lines
1 (()=>{"use strict";function t(t,e,n,o,r){if(isNaN(t)||t<=0)return{days:0,hours:0,minutes:0,seconds:0};let s=Math.floor(t/1e3),u=0,a=0,i=0,c=0;return r?(u=s%60,s=Math.floor(s/60)):s=Math.floor(s/60),o?(a=s%60,s=Math.floor(s/60)):s=Math.floor(s/60),n?(i=s%24,s=Math.floor(s/24)):s=Math.floor(s/24),e&&(c=s),{days:c,hours:i,minutes:a,seconds:u}}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".wp-block-superb-addons-countdown").forEach((function(e){!function(e){const n=e.getAttribute("data-target"),o=n?new Date(n).getTime():NaN,r="true"===e.getAttribute("data-evergreen");if(isNaN(o)&&!r)return;const s="false"!==e.getAttribute("data-show-days"),u="false"!==e.getAttribute("data-show-hours"),a="false"!==e.getAttribute("data-show-minutes"),i="false"!==e.getAttribute("data-show-seconds"),c=e.getAttribute("data-expiry-action")||"hide-block",l=e.querySelector(".superb-countdown-days .superb-countdown-digit"),d=e.querySelector(".superb-countdown-hours .superb-countdown-digit"),p=e.querySelector(".superb-countdown-minutes .superb-countdown-digit"),f=e.querySelector(".superb-countdown-seconds .superb-countdown-digit"),b=e.querySelector(".superb-countdown-units"),h=e.querySelector(".superb-countdown-expiry-message"),y=e.querySelector(".superb-countdown-sr-live");function m(t,e){if(!t)return;const n=(o=e,String(Math.max(0,o)).padStart(2,"0"));var o;const r=t.querySelector(".superb-flip-half-top");if(!r){if(t.textContent===n)return;return void(t.textContent=n)}const s=r.textContent.trim();s!==n&&function(t,e,n){const o=t.querySelector(".superb-flip-half-top"),r=t.querySelector(".superb-flip-half-bottom");if(!o||!r)return;t.querySelectorAll(".superb-flip-flap").forEach((t=>t.remove()));const s=document.createElement("span");s.className="superb-flip-flap superb-flip-flap-top",s.textContent=e,s.setAttribute("aria-hidden","true");const u=document.createElement("span");u.className="superb-flip-flap superb-flip-flap-bottom",u.textContent=n,u.setAttribute("aria-hidden","true"),t.appendChild(s),t.appendChild(u),o.textContent=n,r.textContent=e,u.addEventListener("animationend",(function(){r.textContent=n,s.remove(),u.remove()}))}(t,s,n)}function w(t,e,n,o){s&&m(l,t),u&&m(d,e),a&&m(p,n),i&&m(f,o)}let v,g;function C(){clearInterval(v),clearInterval(g),w(0,0,0,0),"hide-block"===c?e.style.display="none":"hide-countdown"===c?b&&(b.style.display="none"):"show-message"===c&&(b&&(b.style.display="none"),h&&(h.style.display="block")),y&&(y.textContent=""),e.dispatchEvent(new CustomEvent("superbCountdownExpired",{bubbles:!0}))}function x(e){return function(){const n=e-Date.now();if(n<=0)return void C();const o=t(n,s,u,a,i);w(o.days,o.hours,o.minutes,o.seconds)}}function S(e){function n(){const n=e-Date.now();if(n<=0)return;const o=t(n,s,u,a,i),r=[];s&&o.days>0&&r.push(o.days+(1===o.days?" day":" days")),u&&o.hours>0&&r.push(o.hours+(1===o.hours?" hour":" hours")),a&&o.minutes>0&&r.push(o.minutes+(1===o.minutes?" minute":" minutes")),i&&o.seconds>0&&r.push(o.seconds+(1===o.seconds?" second":" seconds")),y.textContent=r.length?r.join(", ")+" remaining":""}y&&(clearInterval(g),n(),g=setInterval(n,3e4))}if(!isNaN(o)){const t=x(o);t(),v=setInterval(t,1e3),S(o)}r||(e.style.visibility="visible");e._superbCountdownInterval=v,e._superbCountdownReinit=function(t){clearInterval(v),clearInterval(g);const n=x(t);n(),v=setInterval(n,1e3),e._superbCountdownInterval=v,S(t)}}(e)}))}))})();