PageSourceSearch

https://vimff.org/wp-content/uploads/ac_assets/ue-mega-slider/mega_slider.js?ver=2.0.20

js vimff.org collected 2026-09-24 19:56:09 UTC 9,386 bytes, 325 lines download raw bytes

1function ueMegaSlider(){
2  
3  var g_megaSlider, g_megaSliderItems, g_objSlider; 
4  var g_classConnected, g_activeSliderClass;
5  var g_isInEditor;
6  var g_currentIndex, g_previousIndex;
7  
8  /*
9  * apply template's styles to mega slide's section 
10  */
11  function setTemplateStyle(){
12    
13    var objLayout = g_megaSlider.find('.ue-mega-slider-template-wrapper .elementor');
14    var objLayoutClass = objLayout.attr('class');
15    
16    g_megaSlider.addClass(objLayoutClass);
17  }
18  
19  /*
20  * clone sections and append to their parent slides
21  */
22  function findSections(objMegaSliderItem, sectionToClone){     
23    
24    //clone section - use detach method on front to make elementor widgets work
25    var clonedSectionItem = sectionToClone.detach();
26    
27    //paste section
28    objMegaSliderItem.html(clonedSectionItem);
29    
30    //add connected class to mega slider child element
31    var objMegaSliderSection = objMegaSliderItem.children();
32    
33    objMegaSliderSection.addClass(g_classConnected);
34    
35  }
36  
37  /*
38  * show what sections are connected to mega slider in editor
39  */
40  function findSectionsInEditor(objMegaSliderItem){     
41    
42    //cloned section's id
43    var objMegaSliderItemId = objMegaSliderItem.data("id");
44    
45    //mega slider item message in editor
46    var objMegaSliderItemHTML = "<div class='uc-message'>Section with id <b>'" + objMegaSliderItemId + "'</b> connected to Mega Slider</div>";
47    
48    //paste section
49    objMegaSliderItem.html(objMegaSliderItemHTML);
50    
51  }
52  
53  /*
54  * handle section find error 
55  */
56  function showHideErrors(objMegaSliderItem, megaSliderItemId, sectionToClone) {
57    
58    var showErrors = g_megaSlider.data("errors");
59    
60    if(showErrors == false)
61    return(false);
62    
63    //check if section with id from mega slider item exist
64    if(sectionToClone.length > 0)
65    return(false);
66    
67    //if section with id from mega slider item does not exist, then add error clas to mega slider item
68    objMegaSliderItem.addClass('uc-item-error');
69    
70    //add error html element
71    objMegaSliderItem.html("<div class='uc-section-error'><div class='uc-error'>Couldn't find a section with id: '" + megaSliderItemId + "'</div></div>");
72    
73  }
74  
75  /*
76  * debug items id
77  */
78  function showHideMegaSliderItemsId(){
79    
80    var debugMegaSliderItemsId = g_megaSlider.data("items-id");
81    
82    if (debugMegaSliderItemsId == false)
83    return(false);
84    
85    //show all items id
86    g_megaSlider.append("<div class='available-id-s'>Item Id's List<ul class='available-item-id-s-list'></ul></div>");
87    
88    var objItemIdList = g_megaSlider.find(".available-item-id-s-list");
89    var megaSliderItemsNumber = g_megaSliderItems.length;
90    
91    for(let i = 0; i <= megaSliderItemsNumber - 1; i++){
92      
93      var objMegaSliderItem = g_megaSliderItems.eq(i);
94      var objMegaSliderItemId = objMegaSliderItem.data("id");
95      
96      //if data-id attribute is empty, skip and go to next data-id
97      if(!objMegaSliderItemId)
98      continue;
99      else
100      objItemIdList.append("<li>" + objMegaSliderItemId + "</li>");
101      
102    }
103  }
104  
105  /*
106  * debug elements id
107  */
108  function showHideMegaSliderElementsId(){
109    
110    var debugElementsId = g_megaSlider.data("elements-id");
111    
112    if (debugElementsId == false)
113    return(false);
114    
115    //show list of section's ids that can be connected to mega slider items
116    g_megaSlider.append("<div class='available-id-s'>Section Id's List<ul class='available-section-id-s-list'></ul></div>");
117    
118    var objSectionIdList = g_megaSlider.find(".available-section-id-s-list");
119    var availableSections = jQuery('section');
120    
121    availableSections.each(function(){
122      
123      var objSectionItem = jQuery(this);
124      var objSectionItemId = objSectionItem.attr('id');
125      var objSectionItemDisplay = objSectionItem.css('display');
126      
127      //watch only those sections that are displayed on the page
128      if(objSectionItemDisplay == 'none')
129      return(true);
130      
131      //if id attribute is empty, skip and go to next id
132      if(!objSectionItemId)
133      return(true);
134      
135      //check if sections are connected to mega slider items
136      if(objSectionItem.hasClass(g_classConnected) == true)
137      return(true);
138      
139      //add section's id to the list
140      if(objSectionItem.hasClass(g_classConnected) == false)
141      objSectionIdList.append("<li>" + objSectionItemId + "</li>");
142      
143    });
144  }
145  
146  /*
147  * show | hide section in editor
148  */ 
149  function hideSectionInEditor(sectionToClone){
150    
151    if(g_isInEditor == false)
152    return(false);
153    
154    //affect only section that are not in connected to mega slider
155    if(sectionToClone.hasClass(g_classConnected) == true)
156    return(false);
157    
158    var dataShowInEditor = g_megaSlider.data('show-section');
159    
160    if(dataShowInEditor == 'no')
161    sectionToClone.css('display', '');
162    
163    if(dataShowInEditor == 'message' || dataShowInEditor == 'hide')
164    sectionToClone.hide();
165    
166  }
167  
168  /*
169  * define item type "section" behaviour on live page
170  */
171  function handleItemTypeSection(){
172    
173    g_megaSliderItems.each(function(){
174      
175      var objMegaSliderItem = jQuery(this); 
176      var megaSliderItemId = objMegaSliderItem.data("id");
177      
178      //find sections to clone on the page
179      var sectionToClone = jQuery("#" + megaSliderItemId);
180      
181      //set template's style for mega slides 
182      setTemplateStyle();
183      
184      //clone and paste section from elementor layout
185      findSections(objMegaSliderItem, sectionToClone);  
186      
187      //see if mega slider item id has its element on the page
188      showHideErrors(objMegaSliderItem, megaSliderItemId, sectionToClone);
189      
190    }); 
191    
192    //handle debug mode   
193    showHideMegaSliderItemsId();
194    showHideMegaSliderElementsId();
195    
196  }
197  
198  
199  /*
200  * define item type "section" behaviour in editor
201  */
202  function handleItemTypeSectionInEditor(){
203    
204    g_megaSliderItems.each(function(){
205      
206      var objMegaSliderItem = jQuery(this); 
207      var megaSliderItemId = objMegaSliderItem.data("id");
208      
209      //find sections to clone on the page
210      var sectionToClone = jQuery("#" + megaSliderItemId);
211      
212      //tell to user which section is connected
213      findSectionsInEditor(objMegaSliderItem);
214      
215      //see if mega slider item id has its element on the page
216      showHideErrors(objMegaSliderItem, megaSliderItemId, sectionToClone);
217      
218      //show | hide sections if needed
219      hideSectionInEditor(sectionToClone);
220      
221    }); 
222    
223    //handle debug mode   
224    showHideMegaSliderItemsId();
225    showHideMegaSliderElementsId();
226    
227  }
228  
229  
230  /*
231  * Slider Animation Repeat
232  */
233  function triggerAnimation(){
234    
235    setTimeout(function(){      
236      
237      //update active slider index
238      g_currentIndex = g_objSlider.find(g_activeSliderClass).index();
239      
240      if(g_currentIndex == g_previousIndex)
241      return(false);
242      
243      //find all elements with data-settings attribute
244      g_objSlider.find('[data-settings]').each(function(){
245        
246        var objAnimatedElement = jQuery(this);
247        var settings = objAnimatedElement.attr('data-settings');        
248        var settingsObj = JSON.parse(settings);
249        
250        //exclude all elements that dont have _animation setting
251        if(!settingsObj._animation)
252        return(true);
253        
254        //add non animated class and remove all animatedd classes
255        objAnimatedElement.addClass('elementor-invisible');
256        objAnimatedElement.removeClass( settingsObj._animation + ' animated' );
257        
258        //exclude those elements that are not inside active slider item
259        if(!objAnimatedElement.closest(g_activeSliderClass).length)
260        return(true);
261        
262        //find delays
263        var animatedElementDelay;
264        
265        if(settingsObj._animation_delay)
266        animatedElementDelay = settingsObj._animation_delay;
267        else
268        animatedElementDelay = 0;
269
270        var sliderDelay = g_megaSlider.data('slider-delay');
271        var totalDelay = animatedElementDelay + sliderDelay;
272        
273        //se time out function that add's animated class after animation is over
274        setTimeout(function(){
275          
276          objAnimatedElement.removeClass('elementor-invisible');
277          objAnimatedElement.addClass( settingsObj._animation + ' animated' );
278          
279        }, totalDelay);      
280        
281      });   
282      
283      g_previousIndex = g_currentIndex;
284      
285    }, 50);
286    
287  }
288  
289  /**
290  * on changed item owl event
291  */
292  function onSliderItemChange(){
293    
294    triggerAnimation();
295    
296  }
297  
298  /*
299  * init mega slider
300  */
301  this.init = function(objMegaMenu){
302    
303    //init globals
304    g_megaSlider = jQuery(objMegaMenu);
305    g_megaSliderItems = g_megaSlider.find('.ue-mega-slider-item');
306    g_objSlider = g_megaSlider.find('.owl-carousel');
307    
308    g_classConnected = 'uc-connected';
309    g_activeSliderClass = '.uc-active-item';
310    
311    g_isInEditor = g_megaSlider.data("editor");
312    
313    //do not run mega slider in editor
314    if(g_isInEditor == "no")
315    handleItemTypeSection();    
316    
317    //in editor run a different function that do not manipulate DOM
318    if(g_isInEditor == "yes")
319    handleItemTypeSectionInEditor();
320    
321    //init events
322    g_objSlider.on('changed.owl.carousel', onSliderItemChange);
323    
324  }
325}

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.