PageSourceSearch

https://unitedtaxis.co.uk/wp-content/plugins/mascot-core-taxix/ass…/tm-stretch.js?ver=7.1.2

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

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.