PageSourceSearch

https://aimcaana.org/wp-content/plugins/mascot-core/assets/section-col-stretch/tm-stretch.js?ver=7.1.2

js aimcaana.org collected 2026-10-03 02:56:20 UTC 21,245 bytes, 580 lines download raw bytes

1"use strict";
2
3/* ====================================== */
4/* Reset and rearrange Stretched Column
5/* ====================================== */
6var tm_rearrange_stretched_col = function( model_id ) {
7	if( jQuery('body').hasClass('elementor-editor-active') ){
8		jQuery( '*[data-id="'+model_id+'"]' ).each(function(){
9			jQuery('.tm-stretched-div', this).remove();
10			jQuery('.elementor-widget-wrap', this).removeAttr('style');
11			setTimeout(function(){ tm_stretched_col(); }, 50);
12		});	
13	}
14}
15
16/* ====================================== */
17/* Stretched Column
18/* ====================================== */
19var tm_stretched_col = function() {
20	jQuery('.elementor-section.elementor-top-section').each(function(){
21		if( jQuery(this).hasClass('tm-col-stretched-left') || jQuery(this).hasClass('tm-col-stretched-right') || jQuery(this).hasClass('tm-col-stretched-both') ){
22			jQuery(this).addClass('tm-col-stretched-yes').removeClass('tm-col-stretched-no');
23		} else {
24			jQuery(this).addClass('tm-col-stretched-no').removeClass('tm-col-stretched-yes');
25		}
26	});
27
28	// remove all stretched related changes in each column
29	jQuery('.elementor-section.elementor-top-section').each(function(){
30		var ThisSection = jQuery(this);
31		var ThisColumn	= '';
32		jQuery( '.elementor-column.elementor-top-column', ThisSection ).each(function(){
33			ThisColumn	= jQuery(this);
34			jQuery( '.tm-stretched-div', ThisColumn ).remove();
35			ThisColumn.removeClass('tm-col-stretched-yes tm-col-stretched-left tm-col-stretched-right tm-col-stretched-content-yes');
36		});
37	});
38
39	// reset - Remove all inline css
40	jQuery('.elementor-section.elementor-top-section').each(function(){
41		jQuery( '.elementor-column.elementor-top-column', jQuery(this) ).each(function(){
42			if( jQuery(this).children('.elementor-column-wrap').length > 0 ){
43				jQuery(this).children('.elementor-column-wrap').removeAttr('style');
44			} else {
45				jQuery(this).children('.elementor-widget-wrap').removeAttr('style');
46			}
47		});
48	});
49
50	jQuery('.elementor-section.elementor-top-section.tm-col-stretched-yes').each(function(){
51
52		var ThisSection		= jQuery(this);
53		var ThisColumn		= '';
54		var ColWrapper		= '';
55		var StretchedEle	= '';
56		var StretchedInnerEle = '';
57
58		if( ThisSection.hasClass('tm-col-stretched-left') || ThisSection.hasClass('tm-col-stretched-both') ){
59			ThisColumn = jQuery( '.elementor-column.elementor-top-column', ThisSection ).first();
60
61			if( jQuery('.tm-stretched-div', ThisColumn).length == 0 ){
62
63				if( ThisColumn.children('.elementor-column-wrap').length > 0 ){
64					ColWrapper = ThisColumn.children('.elementor-column-wrap');
65				} else {
66					ColWrapper = ThisColumn.children('.elementor-widget-wrap');
67				}
68
69				ColWrapper.prepend( '<div class="tm-stretched-div"></div>' );
70
71				// Stretched Element
72				StretchedEle = ColWrapper.children('.tm-stretched-div');
73
74				// RTL
75				if( jQuery('body').hasClass('rtl') ){
76					StretchedEle.addClass( 'tm-stretched-right tm-stretched-for-rtl' );
77					ThisColumn.addClass('tm-col-stretched-yes tm-col-stretched-right tm-col-stretched-for-rtl');
78				} else {
79					StretchedEle.addClass( 'tm-stretched-left' );
80					ThisColumn.addClass('tm-col-stretched-yes tm-col-stretched-left');
81				}
82
83				// specially for Skew view only
84				if( ThisColumn.hasClass('tm-skew-yes') ){
85					StretchedEle.prepend( '<div class="tm-stretched-inner-div"></div>' );
86					StretchedInnerEle = StretchedEle.children('.tm-stretched-inner-div');
87					StretchedInnerEle.css('position', 'absolute');
88					StretchedInnerEle.css('width', '100%');
89					StretchedInnerEle.css('height', '100%');
90				}
91
92				if( ThisSection.hasClass('tm-left-col-stretched-content-yes') ){
93					ThisColumn.addClass('tm-col-stretched-content-yes');
94				} else {
95					ThisColumn.removeClass('tm-col-stretched-content-yes');
96				}
97
98				// background move to stretched div
99				ColWrapper.removeAttr('style');
100				var bgImage =  ColWrapper.css('background-image');
101				if( bgImage!='none' && bgImage!='' ){
102					// specially for Skew view only
103					if( ThisColumn.hasClass('tm-skew-yes') ){
104						StretchedInnerEle.css('background-image', bgImage );
105					} else {
106						StretchedEle.css('background-image', bgImage );
107					}
108					ColWrapper.css('background-image', 'none');
109				}
110
111				// border radious
112				ColWrapper.css('border-top-left-radius', '');
113				ColWrapper.css('border-top-right-radius', '');
114				ColWrapper.css('border-bottom-left-radius', '');
115				ColWrapper.css('border-bottom-right-radius', '');
116				var radius_t_left  =  ColWrapper.css('border-top-left-radius');
117				var radius_t_right =  ColWrapper.css('border-top-right-radius');
118				var radius_b_left  =  ColWrapper.css('border-bottom-left-radius');
119				var radius_b_right =  ColWrapper.css('border-bottom-right-radius');
120				if( radius_t_left!='0' && radius_t_left!='' ){
121					StretchedEle.css('border-top-left-radius', radius_t_left );
122					ColWrapper.css('border-top-left-radius', '0');
123				}
124				if( radius_t_right!='0' && radius_t_right!='' ){
125					StretchedEle.css('border-top-right-radius', radius_t_right );
126					ColWrapper.css('border-top-right-radius', '0');
127				}
128				if( radius_b_left!='0' && radius_b_left!='' ){
129					StretchedEle.css('border-bottom-left-radius', radius_b_left );
130					ColWrapper.css('border-bottom-left-radius', '0');
131				}
132				if( radius_b_right!='0' && radius_b_right!='' ){
133					StretchedEle.css('border-bottom-right-radius', radius_b_right );
134					ColWrapper.css('border-bottom-right-radius', '0');
135				}
136
137				// Background Color
138				var bgColor = ColWrapper.css('background-color');
139
140				if( bgColor && bgColor!='' ){
141
142					if( bgColor.indexOf('rgba') != -1 ){ // check if RGB or RGBA
143
144						var bgColorArray = bgColor.split(',');
145						var colors = [];
146						jQuery(bgColorArray).each(function(x,y){
147							y = y.replace( 'rgba' , '' );
148							y = y.replace( '(' , '' );
149							y = y.replace( ')' , '' );
150							y = y.trim();
151							colors.push(y);
152						});
153
154						bgColor = 'rgb(';
155						var loopx = 1;
156						var opacity = 'n'
157						jQuery.each( colors , function( index, value ) {
158							if ( loopx == 1 ){
159								bgColor += value;
160							} else if ( loopx == 2 || loopx == 3 ){
161								bgColor += ',' + value;
162							} else if ( loopx == 4 && ( value == '0' || value == 0 ) ){
163								opacity = 'y';
164							}
165							loopx = loopx + 1;
166						});
167						bgColor += ')';
168
169						if ( opacity == 'y' ){
170							bgColor = 'transparent';
171						}
172
173					}
174
175					// specially for Skew view only
176					if( ThisColumn.hasClass('tm-skew-yes') ){
177						StretchedInnerEle.css('background-color', bgColor );
178					} else {
179						StretchedEle.css('background-color', bgColor );
180					}
181					
182					ColWrapper.css('background-color', 'transparent');
183				}
184
185				// Background Position
186				var bgPosition = ColWrapper.css('background-position');
187				if( bgPosition!='' ){
188					if( ThisColumn.hasClass('tm-skew-yes') ){
189						StretchedInnerEle.css('background-position', bgPosition );
190					} else {
191						StretchedEle.css('background-position', bgPosition );
192					}
193				}
194
195				// Background Repeat
196				var bgRepeat = ColWrapper.css('background-repeat');
197				if( bgRepeat!='' ){
198					if( ThisColumn.hasClass('tm-skew-yes') ){
199						StretchedInnerEle.css('background-repeat', bgRepeat );
200					} else {
201						StretchedEle.css('background-repeat', bgRepeat );
202					}
203				}
204
205				// Background Size
206				var bgSize = ColWrapper.css('background-size');
207				if( bgSize!='' ){
208					if( ThisColumn.hasClass('tm-skew-yes') ){
209						StretchedInnerEle.css('background-size', bgSize );
210					} else {
211						StretchedEle.css('background-size', bgSize );
212					}
213				}
214
215				tm_stretched_col_calc();
216
217			}
218
219		}
220
221		if( ThisSection.hasClass('tm-col-stretched-right') || ThisSection.hasClass('tm-col-stretched-both') ){
222			ThisColumn = jQuery( '.elementor-column.elementor-top-column', ThisSection ).last();
223
224			if( jQuery('.tm-stretched-div', ThisColumn).length==0 ){
225
226				if( ThisColumn.children('.elementor-column-wrap').length > 0 ){
227					ColWrapper = ThisColumn.children('.elementor-column-wrap');
228				} else {
229					ColWrapper = ThisColumn.children('.elementor-widget-wrap');
230				}
231
232				ColWrapper.prepend( '<div class="tm-stretched-div"></div>' );
233
234				// Stretched Element
235				StretchedEle = ColWrapper.children('.tm-stretched-div');
236
237				// RTL
238				if( jQuery('body').hasClass('rtl') ){
239					StretchedEle.addClass( 'tm-stretched-left tm-stretched-for-rtl' );
240					ThisColumn.addClass('tm-col-stretched-yes tm-col-stretched-left tm-col-stretched-for-rtl');
241				} else {
242					StretchedEle.addClass( 'tm-stretched-right' );
243					ThisColumn.addClass('tm-col-stretched-yes tm-col-stretched-right');
244				}
245
246				// specially for Skew view only
247				if( ThisColumn.hasClass('tm-skew-yes') ){
248					StretchedEle.prepend( '<div class="tm-stretched-inner-div"></div>' );
249					StretchedInnerEle = StretchedEle.children('.tm-stretched-inner-div');
250					StretchedInnerEle.css('position', 'absolute');
251					StretchedInnerEle.css('width', '100%');
252					StretchedInnerEle.css('height', '100%');
253				}
254
255				if( ThisSection.hasClass('tm-right-col-stretched-content-yes') ){
256					ThisColumn.addClass('tm-col-stretched-content-yes');
257				} else {
258					ThisColumn.removeClass('tm-col-stretched-content-yes');
259				}
260
261				// background move to stretched div
262				ColWrapper.removeAttr('style');
263				var bgImage = ColWrapper.css('background-image');
264				if( bgImage!='none' && bgImage!='' ){
265					// specially for Skew view only
266					if( ThisColumn.hasClass('tm-skew-yes') ){
267						StretchedInnerEle.css('background-image', bgImage );
268					} else {
269						StretchedEle.css('background-image', bgImage );
270					}
271					ColWrapper.css('background-image', 'none');
272				}
273
274				// border radious
275				ColWrapper.css('border-top-left-radius', '');
276				ColWrapper.css('border-top-right-radius', '');
277				ColWrapper.css('border-bottom-left-radius', '');
278				ColWrapper.css('border-bottom-right-radius', '');
279				var radius_t_left  =  ColWrapper.css('border-top-left-radius');
280				var radius_t_right =  ColWrapper.css('border-top-right-radius');
281				var radius_b_left  =  ColWrapper.css('border-bottom-left-radius');
282				var radius_b_right =  ColWrapper.css('border-bottom-right-radius');
283				if( radius_t_left!='0' && radius_t_left!='' ){
284					StretchedEle.css('border-top-left-radius', radius_t_left );
285					ColWrapper.css('border-top-left-radius', '0');
286				}
287				if( radius_t_right!='0' && radius_t_right!='' ){
288					StretchedEle.css('border-top-right-radius', radius_t_right );
289					ColWrapper.css('border-top-right-radius', '0');
290				}
291				if( radius_b_left!='0' && radius_b_left!='' ){
292					StretchedEle.css('border-bottom-left-radius', radius_b_left );
293					ColWrapper.css('border-bottom-left-radius', '0');
294				}
295				if( radius_b_right!='0' && radius_b_right!='' ){
296					StretchedEle.css('border-bottom-right-radius', radius_b_right );
297					ColWrapper.css('border-bottom-right-radius', '0');
298				}
299
300				// Background Color
301				var bgColor = ColWrapper.css('background-color');
302				if( bgColor && bgColor!='' ){
303					if( bgColor.indexOf('rgba') != -1 ){ // check if RGB or RGBA
304						var bgColorArray = bgColor.split(',');
305
306						var colors = [];
307						jQuery(bgColorArray).each(function(x,y){
308							y = y.replace( 'rgba' , '' );
309							y = y.replace( '(' , '' );
310							y = y.replace( ')' , '' );
311							y = y.trim();
312							colors.push(y);
313						});
314						
315						bgColor = 'rgb(';
316						var loopx = 1;
317						var opacity = 'n'
318						jQuery.each( colors , function( index, value ) {
319							if ( loopx == 1 ){
320								bgColor += value;
321							} else if ( loopx == 2 || loopx == 3 ){
322								bgColor += ',' + value;
323							} else if ( loopx == 4 && ( value == '0' || value == 0 ) ){
324								opacity = 'y';
325							}
326							loopx = loopx + 1;
327						});
328						bgColor += ')';
329
330						if ( opacity == 'y' ){
331							bgColor = 'transparent';
332						}
333
334					}
335
336					// specially for Skew view only
337					if( ThisColumn.hasClass('tm-skew-yes') ){
338						StretchedInnerEle.css('background-color', bgColor );
339					} else {
340						StretchedEle.css('background-color', bgColor );
341					}
342					ColWrapper.css('background-color', 'transparent');
343				}
344
345				// Background Position
346				var bgPosition = ColWrapper.css('background-position');
347				if( bgPosition!='' ){
348					if( ThisColumn.hasClass('tm-skew-yes') ){
349						StretchedInnerEle.css('background-position', bgPosition );
350					} else {
351						StretchedEle.css('background-position', bgPosition );
352					}
353				}
354
355				// Background Repeat
356				var bgRepeat = ColWrapper.css('background-repeat');
357				if( bgRepeat!='' ){
358					if( ThisColumn.hasClass('tm-skew-yes') ){
359						StretchedInnerEle.css('background-repeat', bgRepeat );
360					} else {
361						StretchedEle.css('background-repeat', bgRepeat );
362					}
363				}
364
365				// Background Size
366				var bgSize = ColWrapper.css('background-size');
367				if( bgSize!='' ){
368					if( ThisColumn.hasClass('tm-skew-yes') ){
369						StretchedInnerEle.css('background-size', bgSize );
370					} else {
371						StretchedEle.css('background-size', bgSize );
372					}
373				}
374
375				tm_stretched_col_calc();
376
377			}
378		}
379
380	});
381
382};
383
384var tm_stretched_col_calc = function() {
385
386	// padding left or right
387	if( jQuery('.elementor-section.elementor-top-section > .elementor-container .elementor-column.elementor-top-column.tm-col-stretched-yes').length>0 ){
388
389		// Returns width of browser viewport
390		var window_width = jQuery( window ).width();
391
392		// Returns width of HTML document
393		var document_width = jQuery( document ).width();
394
395		jQuery('.elementor-section.elementor-top-section > .elementor-container .elementor-column.elementor-top-column.tm-col-stretched-yes').each(function(){
396
397			if( jQuery(this).closest('.elementor-section.elementor-top-section').hasClass('tm-col-stretched-both') && ( jQuery(this).hasClass('elementor-col-100') || jQuery(this).attr('data-col') == '100' ) ){
398				// Do nothing
399			} else {
400				var this_ele    = jQuery(this);
401				var curr_width  = jQuery(this).closest('.elementor-container').width();
402				var extra_width = ((window_width - curr_width)/2);
403				var parent_width = '';
404
405				if( this_ele.hasClass('tm-skew-yes') ){
406					extra_width = extra_width + 100;
407				}
408
409				var position = 'left';
410				if( jQuery(this).hasClass('tm-col-stretched-right') ){
411					position = 'right';
412				}
413
414				// set width to 100% if parent is 100%
415				parent_width = jQuery(this).width();
416				if( parent_width == '100%' ){
417					jQuery(this).children('.elementor-widget-wrap') .css('width','100%');
418					jQuery(this).children('.elementor-column-wrap') .css('width','100%');
419				} else {
420					jQuery(this).children('.elementor-widget-wrap') .css('width','');
421					jQuery(this).children('.elementor-column-wrap') .css('width','');
422				}
423
424				jQuery('.tm-stretched-div', jQuery(this)).css( 'margin-'+position,'-'+extra_width+'px' );
425				jQuery('.tm-stretched-div+.elementor-background-overlay', jQuery(this)).css( 'margin-'+position,'-'+extra_width+'px' ).css({
426					'width' : 'auto',
427					'left' : '0',
428					'right' : '0'
429				});
430
431
432				// stretched column content too
433				if( jQuery(this).hasClass('tm-col-stretched-content-yes') ){
434					
435					jQuery('.tm-stretched-div', jQuery(this)).css( 'margin-'+position, "" );
436					var stretched_width = jQuery('.tm-stretched-div', jQuery(this) ).width() + extra_width;
437					if( jQuery(this).children('.elementor-column-wrap').length > 0 ){
438						jQuery(this).children('.elementor-column-wrap').css( 'margin-'+position,'-'+extra_width+'px' );
439						jQuery(this).children('.elementor-column-wrap').css( 'width', stretched_width+'px' );
440					} else {
441						jQuery(this).children('.elementor-widget-wrap').css( 'margin-'+position,'-'+extra_width+'px' );
442						jQuery(this).children('.elementor-widget-wrap').css( 'width', stretched_width+'px' );
443					}
444
445				} else {
446					if( jQuery(this).children('.elementor-column-wrap').length > 0 ){
447						jQuery(this).children('.elementor-column-wrap').css( 'margin-'+position,'' );
448						jQuery(this).children('.elementor-column-wrap').css( 'width', '' );
449					} else {
450						jQuery(this).children('.elementor-widget-wrap').css( 'margin-'+position,'' );
451						jQuery(this).children('.elementor-widget-wrap').css( 'width', '' );
452					}
453				}
454
455		}
456
457		});
458
459	}
460
461}
462
463/* ============================================== */
464/* BG Image yes class in each Section and Column
465/* ============================================== */
466var tm_bgimage_class = function() {
467	jQuery('.elementor-section.elementor-top-section').each(function() {
468
469		if( jQuery(this).css('background-image')!='' && jQuery(this).css('background-image')!='none' ){
470			jQuery(this).addClass('tm-bgimage-yes' ).removeClass('tm-bgimage-no' );
471		} else {
472			jQuery(this).addClass('tm-bgimage-no' ).removeClass('tm-bgimage-yes' );
473		}
474	});
475	jQuery('.elementor-column.elementor-top-column').each(function() {
476
477		if( jQuery(this).children('.elementor-column-wrap').length > 0 ){
478
479			if( jQuery(this).children('.elementor-column-wrap').children('.tm-stretched-div').length > 0 ){
480
481				if( jQuery(this).children('.elementor-column-wrap').children('.tm-stretched-div').css('background-image') == 'none' || jQuery(this).children('.elementor-column-wrap').children('.tm-stretched-div').css('background-image') == '' ){
482					jQuery(this).addClass('tm-bgimage-no' ).removeClass('tm-bgimage-yes' );
483				} else {
484					jQuery(this).addClass('tm-bgimage-yes' ).removeClass('tm-bgimage-no' );
485				}
486
487			} else {
488
489				if( jQuery(this).children('.elementor-column-wrap').css('background-image') == 'none' || jQuery(this).children('.elementor-column-wrap').css('background-image') == '' ){
490					jQuery(this).addClass('tm-bgimage-no' ).removeClass('tm-bgimage-yes' );
491				} else {
492					jQuery(this).addClass('tm-bgimage-yes' ).removeClass('tm-bgimage-no' );
493				}
494
495			}
496
497		} else {
498
499			if( jQuery(this).children('.elementor-widget-wrap').children('.tm-stretched-div').length > 0 ){
500
501				if( jQuery(this).children('.elementor-widget-wrap').children('.tm-stretched-div').css('background-image') == 'none' || jQuery(this).children('.elementor-widget-wrap').children('.tm-stretched-div').css('background-image') == '' ){
502					jQuery(this).addClass('tm-bgimage-no' ).removeClass('tm-bgimage-yes' );
503				} else {
504					jQuery(this).addClass('tm-bgimage-yes' ).removeClass('tm-bgimage-no' );
505				}
506
507			} else {
508
509				if( jQuery(this).children('.elementor-widget-wrap').css('background-image') == 'none' || jQuery(this).children('.elementor-widget-wrap').css('background-image') == '' ){
510					jQuery(this).addClass('tm-bgimage-no' ).removeClass('tm-bgimage-yes' );
511				} else {
512					jQuery(this).addClass('tm-bgimage-yes' ).removeClass('tm-bgimage-no' );
513				}
514
515			}
516
517		}
518	});
519};
520
521/* ============================================== */
522/* BG Color yes class in each Section and Column
523/* ============================================== */
524var tm_bgcolor_class = function() {
525	jQuery('.elementor-section.elementor-top-section').each(function() {
526		if( jQuery(this).css('background-color')!='' && jQuery(this).css('background-color')!='transparent' ){
527			jQuery(this).addClass('tm-bgcolor-yes');
528		}
529	});
530	jQuery('.elementor-column.elementor-top-column').each(function() {
531		if( jQuery(this).children('.tm-stretched-div').length ){
532			if( jQuery(this).children('.tm-stretched-div').css('background-color')!='' && jQuery(this).children('.tm-stretched-div').css('background-color')!='transparent' ){
533				jQuery(this).addClass('tm-bgcolor-yes' ).removeClass('tm-bgcolor-no' );
534			} else {
535				jQuery(this).addClass('tm-bgcolor-no' ).removeClass('tm-bgcolor-yes' );
536			}
537		} else {
538
539
540			if( jQuery(this).children('.elementor-column-wrap').length > 0 ){
541
542				if( jQuery(this).children('.elementor-column-wrap').css('background-color') == 'transparent' || jQuery(this).children('.elementor-column-wrap').css('background-color') == '' ){
543					jQuery(this).addClass('tm-bgcolor-no' ).removeClass('tm-bgcolor-yes' );
544				} else {
545					jQuery(this).addClass('tm-bgcolor-yes' ).removeClass('tm-bgcolor-no' );
546				}
547
548			} else {
549
550				if( jQuery(this).children('.elementor-widget-wrap').css('background-color') == 'transparent' || jQuery(this).children('.elementor-widget-wrap').css('background-color') == '' ){
551					jQuery(this).addClass('tm-bgcolor-no' ).removeClass('tm-bgcolor-yes' );
552				} else {
553					jQuery(this).addClass('tm-bgcolor-yes' ).removeClass('tm-bgcolor-no' );
554				}
555
556			}
557
558		}
559	});
560};
561
562/*----  Events  ----*/
563
564// On resize
565jQuery(window).resize(function(){
566	setTimeout(function() {
567		tm_stretched_col_calc();
568	}, 100);
569});
570
571// on ready
572jQuery(document).ready(function(){
573	tm_stretched_col();
574	tm_stretched_col_calc();
575	tm_bgimage_class();
576	tm_bgcolor_class();
577	setTimeout(function() {
578		tm_stretched_col_calc();
579	}, 100);
580});

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.