PageSourceSearch

https://hospitalsanjuandedios.es/wp-content/uploads/ac_assets/fullscreen_navigation_menu/menu.js?ver=2.0.20

js hospitalsanjuandedios.es collected 2026-10-01 16:31:29 UTC 10,459 bytes, 426 lines download raw bytes

1function UCFullscreenMenu(menuWrapperID){
2  
3  var g_menuWrapper, g_isCloseOnOpen = false, g_isCurrentParentItemOpened = false;
4  var g_menuWrapperID = menuWrapperID;
5  var g_currentLocation = window.location.href;
6  var isIconClicked = false;
7  
8  /**
9  * collapse inner section
10  */
11  function collapseInnerSection(element, link){
12    
13    var sectionHeight = element.scrollHeight;
14    
15    var elementTransition = element.style.transition;
16    element.style.transition = '';    
17    
18    requestAnimationFrame(function() {
19      element.style.height = sectionHeight + 'px';
20      element.style.transition = elementTransition;
21      
22      
23      requestAnimationFrame(function() {	
24        element.style.height = 0 + 'px';
25        
26      });
27    });
28    
29    element.setAttribute('data-collapsed', 'true');
30  }
31  
32  /**
33  * expand the inner of the section
34  */
35  function expandSectionInner(element){
36    var sectionHeight = element.scrollHeight;
37    
38    element.style.height = sectionHeight + 'px';
39    
40    element.addEventListener('transitionend', function(e) {
41      element.removeEventListener('transitionend', arguments.callee);
42      element.style.height = null;
43    });
44    
45    element.setAttribute('data-collapsed', 'false');
46    
47  }
48  
49  /**
50  * expand section
51  */
52  function expandSection(section, objLink){
53    
54    expandSectionInner(section);
55   
56    section.setAttribute('data-collapsed', 'false')
57    objLink.removeClass("collapsed");
58    objLink.addClass("expanded");
59    
60  }
61  
62  /**
63  * collapse the section
64  */
65  function collapseSection(section, objLink){
66    
67    collapseInnerSection(section, objLink);
68    
69    objLink.addClass("collapsed");
70    objLink.removeClass("expanded");
71  }
72  
73  /**
74  * collapse all expanded sections
75  */
76  function collapseAllExpanded(clickedItem){
77
78    var clickedParentExpanded = jQuery(clickedItem).parents('.sub-menu').prev();    
79    var clickedChildrenExpanded = jQuery(clickedItem).next().find('.expanded'); 
80    
81    var objAllExpanded = g_menuWrapper.find(".expanded").not(clickedChildrenExpanded).not(clickedParentExpanded);
82    
83    if(objAllExpanded.length == false)
84    return(false);
85    
86    jQuery.each(objAllExpanded, function(index, link){
87      var objLink = jQuery(link);
88      var section = link.nextElementSibling;
89
90      collapseSection(section, objLink);      
91    });
92  }
93  
94  /**
95  * close or open link
96  */
97  function toggleSection(objLink){
98    
99    var link = objLink[0];
100    var section = link.nextElementSibling;
101    
102    var isCollapsed = section.getAttribute('data-collapsed') === 'true';
103    
104    if (isCollapsed) {		//expend current
105      
106      if(g_isCloseOnOpen == true)
107      collapseAllExpanded(link);
108      
109      expandSection(section, objLink);
110      
111    } else {		//collapse current
112      
113      collapseSection(section,objLink);
114    }
115    
116  }
117  
118  /**
119  * open or close some item
120  */
121  function openCloseItem(link, event){
122    
123    var section = link.nextElementSibling;
124    
125    if(!section)
126    return(true);
127    
128    var objSection = jQuery(section);
129    if(objSection.hasClass("sub-menu") == false)
130    return(true);
131    
132    if(event)
133    event.preventDefault();
134    
135    var objLink = jQuery(link);    
136    var isCollapsed = section.getAttribute('data-collapsed') === 'true';
137   
138    if (isCollapsed) {		//expend current
139      
140      if(g_isCloseOnOpen == true)
141      collapseAllExpanded(link);
142      
143      expandSection(section, objLink);
144      
145    } else {		//collapse current
146      
147      collapseSection(section,objLink);
148    }
149    
150  }
151  
152  /**
153  * on menu item click, if sub menu, open or close
154  */
155  function onMenuItemClick(event){   
156    openCloseItem(this, event);    
157  }
158  
159  /**
160  * console log shorcut
161  */
162  function trace(str){    
163    console.log(str);
164  }
165  
166  /**
167  * init from popups
168  */
169  function checkInitFromPopups(){    
170    jQuery( document ).on( 'elementor/popup/show', (event) => {			
171      runMenu();
172    });    
173  }
174
175  
176  /**
177  * expand current item tree
178  */
179  function expandCurrentItemTree(){    
180    //disable transition    
181    var objCurrentItem = g_menuWrapper.find(".uc-list-menu ul .current-menu-item");
182    
183    if(objCurrentItem.length == 0)
184    return(false);
185    
186    g_menuWrapper.addClass("uc-no-transition");
187    
188    setTimeout(function(){
189      g_menuWrapper.removeClass("uc-no-transition");
190    },300);
191    
192    var objParents = objCurrentItem.parents("li");
193    
194    if(objParents.length == 0)
195    return(false);
196    
197    jQuery.each(objParents, function(index, parent){      
198      var objParent = jQuery(parent);
199      var objLink = objParent.children("a");      
200      var link = objLink[0];
201      
202      openCloseItem(link);      
203    });    
204  }
205  
206  // collapse all except the current	
207  this.collapseAll = function(){    
208    g_menuWrapper.find("ul.uc-list-menu li a").each((i, item) => {
209      var objLink = jQuery(item);
210      
211      collapseAllExpanded(objLink[0]);		    
212    });
213  }
214  
215
216  /**
217   * expand all
218   */
219  this.expandAllAfterPageLoad = function(){
220    var dataExpandAll = g_menuWrapper.data("expandall");
221
222    if(dataExpandAll == false)
223      return(false);
224
225    var objParentItems = g_menuWrapper.find(".menu-item-has-children");
226
227    if(!objParentItems || objParentItems.length == 0)
228      return(false);
229
230    //disable transition temporarely
231    g_menuWrapper.addClass("uc-no-transition");
232    setTimeout(function(){
233      g_menuWrapper.removeClass("uc-no-transition");
234    },300);
235
236    objParentItems.each(function(){
237      var objItem = jQuery(this);
238      var objLink = objItem.children("a");      
239      var link = objLink[0];
240      
241      openCloseItem(link); 
242    });
243
244  }
245
246  /*
247  * open current page menu item
248  */
249  this.openCurrentPageMenuItem = function(){
250    
251    g_menuWrapper.find("ul.uc-list-menu li a").each((i, item) => {
252      
253      var objLink = jQuery(item);
254      var section = item.nextElementSibling;  
255      var objLinkItemHref = objLink.attr('href');
256      
257      if(g_currentLocation == objLinkItemHref){
258       
259        if(jQuery(section) && jQuery(section).length > 0)
260        expandSection(section, objLink); 
261
262        var objParentSection = objLink.parents(".sub-menu");
263
264        if(!objParentSection)
265        return(true)
266
267        var objParentLink = objParentSection.prev();
268
269        if(!objParentLink)
270        return(true)
271
272        if(objParentSection && objParentSection.length > 0)
273        expandSection(objParentSection[0], objParentLink);
274      }    
275    });    
276  }
277  
278  
279  /*
280  * position fixed protection from parents transform rules
281  */
282  function protectForFixed(){
283    
284    //find element with position fixed css rule
285    var objFixedElement = g_menuWrapper.parents('.ue_menu');
286    
287    //find all parents and look at each one
288    var objFixedParents = objFixedElement.parents();
289    
290    objFixedParents.each(function(){
291      
292      var objFixedParent = jQuery(this);
293      
294      //check if parent has one of issued css rules
295      var transformRule = objFixedParent.css('transform');
296      
297      //if transform is epsent then skip and move to another css rule
298      if(transformRule == 'none')
299      return(true);
300      
301      //if finds transform then remove it
302      objFixedParent.css('transform', '');
303      
304      //animation-fill-mode
305      var fillmodeRule = objFixedParent.css('animation-fill-mode');
306      
307      if(fillmodeRule == 'none')
308      return(true);
309      
310      objFixedParent.css('animation-fill-mode', 'none');
311      
312      //perspective
313      var perspectiveRule = objFixedParent.css('perspective');
314      
315      if(perspectiveRule == 'none')
316      return(true);
317      
318      objFixedParent.css('perspective', 'none');
319      
320      //filter
321      var filterRule = objFixedParent.css('filter');
322      
323      if(filterRule == 'none')
324      return(true);
325      
326      objFixedParent.css('filter', 'none');
327      
328    });
329    
330  }
331  
332  
333  /**
334  * run the menu, init
335  */
336  this.runMenu = function(){
337    
338    //init globals
339    g_menuWrapper = jQuery("#"+g_menuWrapperID);
340    
341    g_isCloseOnOpen = g_menuWrapper.data("closeothers");
342    g_isCloseOnOpen = (g_isCloseOnOpen == "yes");
343    
344    var isClickable = g_menuWrapper.data("clickable");
345    
346    if(g_menuWrapper.length == 0){
347      console.log("menu with ID: "+g_menuWrapperID+" not found!");
348      
349      checkInitFromPopups();
350      
351      return(false);
352    }
353    
354    //collapse all except the current
355    
356    g_menuWrapper.find("ul.uc-list-menu li a").each((i, item) => {
357
358      //add area haspopup
359      var objHasChildrenLinks = g_menuWrapper.find(".menu-item-has-children > a");
360
361      if(objHasChildrenLinks && objHasChildrenLinks.length > 0){
362        objHasChildrenLinks.attr("aria-haspopup", "true");
363      }
364      
365      if(item.nextElementSibling){
366        
367        var objItem = jQuery(item);
368        var iconPosition = g_menuWrapper.data('icon-position');
369        
370        if(iconPosition == 'start')
371        objItem.prepend("<span class='uc-menu-item-pointer'></span>");
372        
373        if(iconPosition == 'end')
374        objItem.append("<span class='uc-menu-item-pointer'></span>");
375        
376        collapseInnerSection(item.nextElementSibling, item);
377        
378        item.nextElementSibling.style.display = "block";
379        
380        jQuery(item).addClass("collapsed");
381        jQuery(item).removeClass("expanded");
382      }
383      
384    });
385    
386    //init events
387    
388    if(isClickable == false){
389      
390      g_menuWrapper.find("ul.uc-list-menu li a").on("click", onMenuItemClick);
391      
392    }else{
393      
394      //pointer click - toggle section      
395      g_menuWrapper.find("ul.uc-list-menu li .uc-menu-item-pointer").on("click", function(event){       
396        isIconClicked = true;
397
398        var objLink = jQuery(this).parent();
399        toggleSection(objLink);
400      });
401      
402      g_menuWrapper.find("ul.uc-list-menu li a").on("click", function(e){
403        //check if icon was clicked if not make sure that no icon found in clicked link
404        if(isIconClicked == true){
405          var objIcon = jQuery(this).find(".uc-menu-item-pointer");
406    
407          if(objIcon && objIcon.length > 0){
408            e.preventDefault();
409            isIconClicked = false;
410          }
411        }
412      });
413    }
414    
415    //open the section with current item
416    
417    setTimeout(expandCurrentItemTree,100);
418    
419    //protection for elements with position fixed rule
420    
421    setTimeout(protectForFixed,2000);
422    
423  }
424  
425  
426}

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.