PageSourceSearch

https://assur3d.com/wp-content/uploads/ac_assets/uc_content_accordion/content_accordion.js?ver=2.0.20

js assur3d.com collected 2026-10-01 23:48:11 UTC 8,004 bytes, 316 lines download raw bytes

1
2function UCContentAccordion(objAccordion){
3  
4  var g_activeClass;
5  var g_dataLinkNum, g_accItem, g_scrollOffset;
6
7  //scroll func
8  function scrollToTop(){
9    var panel = jQuery(this).closest(".uc_ac_box");
10    
11    jQuery('html, body').animate({
12      scrollTop: panel.offset().top + g_scrollOffset
13    }, 400);
14  }
15  
16  /**
17  * set hash
18  */
19  function setHash(objTab){
20    
21    var isHashSet = objAccordion.data("set-hash");
22    
23    if(isHashSet == false)
24    return(false);
25    
26    var objTabDataId = objTab.parent().attr('id');
27    
28    window.location.hash = objTabDataId;    
29    
30  }
31
32  function onItemClick(){
33    
34    var objCaption = jQuery(this);
35    var objContent = objCaption.next();
36    var objItem = objCaption.parent();
37    
38    setHash(objCaption);
39    
40    var isActive = objItem.hasClass(g_activeClass);
41    var dataCloseothers = objAccordion.data("closeothers");
42    
43    if(dataCloseothers == true){
44
45      if(isActive == true){    
46        //remove active class from clicked
47        objItem.removeClass(g_activeClass);
48        objContent.slideUp();    
49        return(false);
50      }
51       
52      var objItems = objItem.siblings();
53
54      objItems.each(function(){
55
56        var objTab = jQuery(this);
57        var isTabActive = objTab.hasClass(g_activeClass);
58     
59        //remove active class from all other tabs
60        //use carefully, not to touch inner accordion if such exists
61        if(isTabActive == true){
62          objTab.removeClass(g_activeClass);
63          objTab.find(" > .uc_content").slideUp();        
64        }
65      });      
66      
67      
68    }
69   
70    objItem.addClass(g_activeClass);
71    
72    var dataScroll = objAccordion.data('scroll');
73    
74    if (dataScroll == "desktop"){
75      if(window.matchMedia("(min-width: 1024px)").matches){
76        objContent.slideDown(scrollToTop);
77      }else{
78        objContent.slideDown();
79      }
80    }
81    
82    if (dataScroll == "mobile"){
83      if(window.matchMedia("(max-width: 1024px)").matches){
84        objContent.slideDown(scrollToTop);
85      }else{
86        objContent.slideDown();
87      }
88    }
89    
90    if (dataScroll == "desktop+mobile"){
91      objContent.slideDown(scrollToTop);
92    }
93    
94    if (dataScroll == "off"){
95      objContent.slideDown();
96    }
97    
98    return false;
99  }
100  
101  
102  function linkToSlideScroll(){ 
103    
104    jQuery('html, body').animate({
105      scrollTop: g_accItem.offset().top + g_scrollOffset
106    }, 400);
107  }
108  
109  /*
110  * check if element is in viewport
111  */
112  function isElementInViewport(objElement) {
113    
114    var elementTop = objElement.offset().top;
115    var elementBottom = elementTop + objElement.outerHeight();
116    
117    var viewportTop = jQuery(window).scrollTop();
118    var viewportBottom = viewportTop + jQuery(window).height();
119    
120    var isInViwport = elementBottom > viewportTop && elementTop < viewportBottom;
121    
122    return(isInViwport);
123  } 
124  
125  /*
126  * on trigger link click
127  */
128  function onLinkClick(e){
129    
130    var objLink = jQuery(this);
131    
132    var dataAccName = objAccordion.data('name');
133    var dataLinkName = objLink.data('name');
134    g_dataLinkNum = objLink.data('num');
135    g_accItem = objAccordion.find('.uc_ac_box .uc_trigger').eq(g_dataLinkNum - 1);
136    var accItemNumber = objAccordion.find('.uc_ac_box').length;
137    
138    
139    if(dataLinkName != dataAccName)
140    return(false);
141    
142    if(dataLinkName == undefined || g_dataLinkNum == '' || g_dataLinkNum > accItemNumber)
143    return(false);
144    
145    var accItemContent = g_accItem.next();
146    var accItemParent = g_accItem.parent();
147    var isItemParentActive = accItemParent.hasClass(g_activeClass);
148    
149    e.preventDefault();
150    
151    if(isItemParentActive == true){
152
153      if(isElementInViewport(objAccordion) == false)
154      linkToSlideScroll();
155
156      accItemContent.slideUp();
157      accItemParent.removeClass(g_activeClass);
158      
159    }else if(isItemParentActive == false && isElementInViewport(objAccordion) == false){
160      
161      onItemClick();	      
162      accItemContent.slideDown(linkToSlideScroll);
163      accItemParent.addClass(g_activeClass);
164      
165    }else if(isItemParentActive == false && isElementInViewport(objAccordion) == true){
166      
167      onItemClick();	      
168      accItemContent.slideDown();
169      accItemParent.addClass(g_activeClass);
170    }
171    
172    
173  }
174
175  /**
176   * on expand all item clik
177   */
178function onExpandAllClick(e) {
179  e.preventDefault();
180
181  var objAllItems = objAccordion.find(".uc_ac_box");
182
183  var anyAccordionClosed = objAllItems.filter(":not(." + g_activeClass + ")").length > 0;
184
185  objAllItems.each(function () {
186    var objItem = jQuery(this);
187    var objItemContent = objItem.find("> .uc_content");
188
189    if (anyAccordionClosed) {
190      // If any accordion is closed, open all
191      objItem.addClass(g_activeClass);
192      if (objItemContent) objItemContent.show();
193    } else {
194      // If all accordions are open, close all
195      objItem.removeClass(g_activeClass);
196      if (objItemContent) objItemContent.hide();
197    }
198  });
199}
200  
201  /**
202  * init open links
203  */
204  function initLinks(){
205    
206    var objLinks = jQuery('.ue-link-goto-item').not(".uc-link-inited");
207    
208    if(objLinks.length == 0){
209      return(false);
210    }
211    
212    var elementName = objAccordion.data("name");
213    
214    jQuery.each(objLinks, function(index, linkElement){
215      
216      var objLink = jQuery(linkElement);      
217      var name = objLink.data("name");
218      
219      if(name != elementName)
220      return(true);
221      
222      objLink.addClass("uc-link-inited");
223      
224      objLink.on("click", onLinkClick);
225      
226    });
227    
228  }
229  
230  
231  function runPostAccordion(){
232    //init globals
233    
234    g_activeClass = "uc-item-active";    
235    g_scrollOffset = objAccordion.data('offset');
236    
237    initLinks();
238    
239    //init events    
240    objAccordion.on("click", ".uc_trigger", onItemClick);
241    objAccordion.on("ucclick", ".uc_trigger", onItemClick);
242    jQuery(".ue-content-accordion-expand-all").on("click", onExpandAllClick);
243    
244    //init hash
245    if(!window.location.hash)
246    return(false);
247        
248    //find hashed tab object
249    var objHashedTabs = jQuery('[id=' + window.location.hash + ']');
250
251    objHashedTabs.each(function(){
252
253      var objHashedTab = jQuery(this);
254
255      //find main widget wrapper of the hashed tab
256      var objHashedTabWrapper = objHashedTab.parents('.uc_material_accordion'); 
257
258      //find if main widget wrapper is inside another accordion tab
259      var objWrapperParent = objHashedTabWrapper.parents('.uc_ac_box');
260
261      //if not than trigger click on hashed tab only and move to another hashed tab object
262      //do nothing with inner accordion on this stage (if its exists)
263      if(!objWrapperParent.length){
264          
265        setTimeout(function(){
266
267          //find if tab is active
268          var isActive = objHashedTab.hasClass(g_activeClass);
269
270          if(isActive == true)
271          return(true);
272
273          objHashedTab.find(' > .uc_trigger').trigger('click');
274
275        },200);
276
277        return(true);
278      }
279      
280      //if wrapper is inside another accordion tab
281      setTimeout(function(){
282
283        //if tab is active then skip and go to another one
284        var isActive = objHashedTab.hasClass('uc-item-active');
285        
286        if(isActive == true)
287        return(true);
288
289        objHashedTab.find(' > .uc_trigger').trigger('click');
290       
291        //open parent accordion tab it wasn't open already
292        var isParentTabActive = objWrapperParent.hasClass('uc-item-active');
293
294        if(isParentTabActive == true)
295        return(true);
296
297        var objParentAccordionTab = objWrapperParent.find(' > .uc_trigger');
298        var accItemContent = objParentAccordionTab.next();
299        var accItemParent = objParentAccordionTab.parent();          
300
301        accItemContent.slideDown();
302        accItemParent.addClass("uc-item-active");
303   
304      },300);
305
306      
307    });
308
309	objAccordion.addClass('uc-inited');
310    
311  }
312  
313  if(objAccordion.hasClass('uc-inited') == false)
314  runPostAccordion();
315  
316}

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.