PageSourceSearch

https://psagotwines.com/wp-content/themes/psagot/js/tranquilo-func.js?ver=1709844010

js psagotwines.com collected 2026-10-02 10:20:07 UTC 5,429 bytes, 207 lines download raw bytes

1
2
3window.addEventListener('resize', () => {
4    setCookie('is_mobile' , isMobile() , 1);
5    setWindowHeight();
6});
7
8
9function toggleSubMenu(btn){
10  let submenu= btn.nextElementSibling,
11  listItem = btn.parentNode;
12  if(listItem.classList.contains('active')){
13    listItem.classList.remove("active");
14    if(isMobile()){
15      gsap.to(submenu, {height: '0'});
16    }else{
17      gsap.to(submenu, {opacity: '0'});
18    }
19
20  }else{
21    listItem.classList.add("active");
22    if(isMobile()){
23      gsap.set(submenu, {height: 'auto'});
24      gsap.from(submenu, {height: '0'});
25
26    }else{
27      gsap.to(submenu, {opacity: '1'});
28    }
29  }
30}
31function isInViewport(element) {
32    const rect = element.getBoundingClientRect();
33    return (
34        rect.top >= 0 &&
35        rect.left >= 0 &&
36        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
37        rect.right <= (window.innerWidth || document.documentElement.clientWidth)
38    );
39}
40
41function lockBody(){
42	document.body.style.top = `-${window.scrollY}px`;
43	document.body.style.height = '100vh';
44	setTimeout(function() {
45		document.body.style.position = 'fixed';
46	}, 1);
47	
48	document.body.style.overflow = 'hidden';
49	$('body').addClass('touch-disabled');
50}
51
52function unlockBody(){
53	document.body.style.height = 'auto';
54	document.body.style.position = 'unset';
55	document.body.style.overflow = 'unset';
56	var scrollY = document.body.style.top;
57	document.body.style.top = 'unset';
58	window.scrollTo(0, parseInt(scrollY || '0') * -1);
59	if ($('.slick-slider').length){
60		$('.slick-slider').slick('refresh');
61	}
62    $('body').removeClass('touch-disabled');
63
64}
65
66function setCookie(cname, cvalue, exdays) {
67	var d = new Date();
68	d.setTime(d.getTime() + (exdays*24*60*60*1000));
69	var expires = "expires="+ d.toUTCString();
70	document.cookie = encodeURIComponent(cname) + "=" + encodeURIComponent(cvalue) + ";" + expires + ";path=/";
71}
72
73function getCookie(cname) {
74  var name = cname + "=";
75  var decodedCookie = decodeURIComponent(document.cookie);
76  var ca = decodedCookie.split(';');
77  for(var i = 0; i <ca.length; i++) {
78    var c = ca[i];
79    while (c.charAt(0) == ' ') {
80      c = c.substring(1);
81    }
82    if (c.indexOf(name) == 0) {
83      return c.substring(name.length, c.length);
84    }
85  }
86  return "";
87}
88
89function isMobile(){
90	var check = false;
91	if($(window).width() < 992){
92		check = true;
93	}
94	return check;
95}
96//tabs
97$($('.tablinks')[0]).trigger('click');
98function openTab(e , target_id){
99  let i, tabcontent, tablinks;
100  tabcontent = document.getElementsByClassName("tabcontent");
101  for (i = 0; i < tabcontent.length; i++) {
102    tabcontent[i].style.display = "none";
103  }
104  tablinks = document.getElementsByClassName("tablinks");
105  for (i = 0; i < tablinks.length; i++) {
106    tablinks[i].className = tablinks[i].className.replace(" active", "");
107  }
108  document.getElementById(target_id).style.display = "block";
109  evt.currentTarget.className += " active";
110
111}
112
113//accordion
114function accordionToggle(btn){
115    let _this = $(btn);
116    let item = _this.closest('.accordion__item');
117    let collapse = item.find('.accordion__collapse');
118    if(_this.hasClass('open')){
119        collapse.removeClass('appear');
120  
121        closeElement(collapse, 0.5);
122        _this.removeClass('open').attr('aria-expanded', 'false');
123        item.removeClass('open');
124        
125    }else{
126        openElement(collapse, 0.5, 'auto');
127        
128        _this.addClass('open').attr('aria-expanded', 'true');   
129        item.addClass('open');
130        setTimeout(() => {
131            collapse.addClass('appear');
132        }, 500);
133    }
134  }
135
136function openModal(elem_id) {
137    let elem = $(elem_id);
138    if(isMobile()){
139      lockBody();
140    }
141    elem.show().addClass('open');
142}
143
144function closeModal() {
145   $('.popup.open').hide();
146   if(isMobile()){
147     unlockBody();
148   }
149}
150
151
152
153function toggleMenu(){
154    let menu_btn = $('button.hamburger');
155    
156    let menu_wrap = $('.menu-wrap');
157
158    
159
160    if(menu_btn.hasClass('is-active')){ //close menu
161      unlockBody();
162      gsap.to(menu_wrap, {opacity: '0', zIndex:'-1',  ease:Power0.easeNone});
163      menu_btn.removeClass('is-active');
164      // alterHeaderBack();
165     
166    }else{ //open menu
167        lockBody(); 
168        gsap.to(menu_wrap, {opacity: '1', zIndex: '9',  ease:Power0.easeNone});
169        menu_btn.addClass('is-active');
170        // alterHeader()
171    }
172}
173
174function alterHeader(){
175  const header = document.getElementById('header'),
176  site_branding = header.querySelector('.site-branding');
177
178  gsap.to(site_branding, { y: '-100%' , opacity: 0});
179} 
180function alterHeaderBack(){
181  const header = document.getElementById('header'),
182  site_branding = header.querySelector('.site-branding');
183  gsap.to(site_branding, { y: '0' , opacity: 1});
184
185}
186function scrollToTop(target){
187  $('html, body').animate({
188      scrollTop: target.offset().top - $('.header').height()
189  }, 1000, function() {
190      let $target = $(target);
191      $target.focus();
192      if ($target.is(":focus")) { // Checking if the target was focused
193          return false;
194      } else {
195          $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
196          $target.focus(); // Set focus again
197      };
198  });
199}
200
201function setWindowHeight(){
202 
203  let vh = window.innerHeight * 0.01;
204  document.documentElement.style.setProperty('--vh', `${vh}px`);
205  document.documentElement.style.setProperty('--header-height' , $('.header').height()+'px');
206
207}

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.