core/1/iiko_files/tilda-scripts-3.0.min.js

2 lines
18 KiB
JavaScript
Raw Normal View History

2023-04-09 19:52:26 +05:00
function t_onReady(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}function t_addClass(t,e){document.body.classList?t.classList.add(e):t.className+=(t.className?" ":"")+e}function t_removeClass(t,e){document.body.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}function t_removeEl(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function t_outerWidth(t){var e=getComputedStyle(t),n=e.width,t=e.marginLeft,e=e.marginRight;return"auto"===n&&(n=0),"auto"===t&&(t=0),"auto"===e&&(e=0),n=parseInt(n)+parseInt(t)+parseInt(e)}var version;function t_throttle(i,o,a){var r,d;return o=o||250,function(){var t=a||this,e=+new Date,n=arguments;r&&e<r+o?(clearTimeout(d),d=setTimeout(function(){r=e,i.apply(t,n)},o)):(r=e,i.apply(t,n))}}function t_onFuncLoad(n,i,o){var a,r;"function"==typeof window[n]?i():(a=Date.now(),r=new Error(n+" is undefined"),setTimeout(function t(){var e=Date.now();"function"!=typeof window[n]?("complete"===document.readyState&&5e3<e-a&&"function"!=typeof window[n]&&function(){throw r}(),setTimeout(t,o||100)):i()}))}function t_scrollBarWidthCompensator__setObject(){window.scrollBarWidthCompensator={};var a=window.scrollBarWidthCompensator;a.isInited=!1,a.scrollBarWidth=Math.abs(window.innerWidth-document.documentElement.clientWidth),a.delay=0;var t=document.querySelectorAll("*");a.fixedElements=[],Array.prototype.forEach.call(t,function(t){var e,n,i,o;t.classList.contains("t975")||(n=(e=window.getComputedStyle(t)).getPropertyValue("position"),i=e.getPropertyValue("width"),o=e.getPropertyValue("height"),i="100%"===i||i===window.innerWidth+"px"||i===window.innerWidth-a.scrollBarWidth+"px"||"100vw"===i,o="100%"===o||o===window.innerHeight+"px"||o===window.innerHeight-a.scrollBarWidth+"px"||"auto"===o||"100vh"===o,("fixed"===n||"absolute"===n&&i&&!o)&&a.fixedElements.push({el:t,computedStyle:e}))})}function t_scrollBarWidthCompensator__init(){window.scrollBarWidthCompensator||t_scrollBarWidthCompensator__setObject();var t,e,r,d=window.scrollBarWidthCompensator;d.scrollBarWidth=Math.abs(window.innerWidth-document.documentElement.clientWidth),!d.isInited&&d.scrollBarWidth&&(d.isInited=!0,t=window.getComputedStyle(document.body).getPropertyValue("padding-right"),t=parseInt(t.replace("px",""),10),(e=document.body.style.paddingRight)&&document.body.setAttribute("data-tilda-initial-padding-right",e),document.body.style.paddingRight=d.scrollBarWidth+t+"px",document.body.style.height="100vh",document.body.style.minHeight="100vh",document.body.style.overflow="hidden",r=[],Array.prototype.forEach.call(d.fixedElements,function(t){var e,n,i,o,a=t.el;!document.body.contains(a)||a.classList.contains("t975")||a.classList.contains("t975")||("fixed"!==(e=(i=t.computedStyle).getPropertyValue("position"))&&"absolute"!==e||((o=i.getPropertyValue("transition-duration")).indexOf("ms")+1?(o=parseInt(o.replace("ms",""),10),r.push(o)):o.indexOf("s")+1&&(o=1e3*parseFloat(o.replace("s","")),r.push(o)),n=i.getPropertyValue("right"),n=parseInt(n.replace("px",""),10),t=i.getPropertyValue("width"),o=i.getPropertyValue("height"),(i=a.style.right)&&a.setAttribute("data-tilda-initial-right",i),(i=a.style.width)&&a.setAttribute("data-tilda-initial-width",i),t="100%"===t||t===window.innerWidth+"px"||t===window.innerWidth-d.scrollBarWidth+"px"||"100vw"===t,o="100%"===o||o===window.innerHeight+"px"||o===window.innerHeight-d.scrollBarWidth+"px"||"auto"===o||"100vh"===o,!n&&0!==n||"auto"===a.style.right||"absolute"===e||t?t&&!o&&(a.style.width="calc(100vw - "+d.scrollBarWidth+"px)"):a.style.right=d.scrollBarWidth+n+"px"))}),r.length&&(d.delay=Math.max.apply(null,r)))}function t_scrollBarWidthCompensator__cancel(){var t=window.scrollBarWidthCompensator;t&&t.isInited&&(t.isInited=!1,t.delay=0,document.body.hasAttribute("data-tilda-initial-padding-right")?(document.body.style.paddingRight=document.body.getAttribute("data-tilda-initial-padding-right"),document.body.removeAttribute("data-tilda-initial-padding-right")):document.body.styl