1( function( $, window ) { 2 'use strict'; 3 $(window).on('elementor/frontend/init', function (){ 4 5 function WglSectionParallax( $scope ){ 6 $scope.WglSectionParallaxInit(); 7 $scope.WglSectionShapeDividerInit(); 8 } 9 10 window.elementorFrontend.hooks.addAction( 'frontend/element_ready/section', WglSectionParallax); 11 window.elementorFrontend.hooks.addAction('frontend/element_ready/container', WglSectionParallax); 12 }); 13 14 // Add Wgl Parallax Section 15 $.fn.WglSectionParallaxInit = function( options ){ 16 var defaults = {}; 17 18 return this.each(function( ) { 19 20 var self = $(this), 21 wglParallax = { 22 editorMode: window.elementorFrontend.isEditMode(), 23 itemId: $(this).data('id'), 24 options: false, 25 globalVars: 'add_background_animation', 26 backEndVars: null, 27 items: [], 28 }; 29 30 var init = function() { 31 setParallaxItem(); 32 }, 33 setParallaxItem = function(){ 34 var settings; 35 36 var checkEnabledParallax = parallaxEffectEnabled(); 37 38 if(!checkEnabledParallax){ 39 return; 40 } 41 42 if ( ! wglParallax.editorMode ) { 43 settings = buildFrontParallax(); 44 } else { 45 settings = buildBackendParallax(); 46 } 47 48 if ( ! settings ) { 49 return; 50 } 51 52 build( settings ); 53 hideMobile(); 54 55 }, 56 parallaxEffectEnabled = function(){ 57 var settings = {}; 58 59 if ( ! wglParallax.editorMode ) { 60 settings = wgl_parallax_settings[0][wglParallax.itemId]; 61 62 if(!settings){ 63 return; 64 } 65 66 if(!settings.hasOwnProperty(wglParallax.globalVars) || !sett
66ings[wglParallax.globalVars]){ 67 return; 68 } 69 }else{ 70 if(!window.elementor.elements){ 71 return; 72 } 73 74 if(!window.elementor.elements.models){ 75 return; 76 } 77 78 window.elementor.elements.models.forEach(function( value ){ 79 if ( wglParallax.itemId == value.id ) { 80 wglParallax.backEndVars = value.attributes.settings.attributes; 81 } 82 }); 83 84 if(!wglParallax.backEndVars){ 85 return; 86 } 87 88 if(!wglParallax.backEndVars.hasOwnProperty(wglParallax.globalVars) || !wglParallax.backEndVars[wglParallax.globalVars]){ 89 return; 90 } 91 92 settings = wglParallax.backEndVars; 93 } 94 95 return settings; 96 }, 97 buildFrontParallax = function() { 98 var settings = wgl_parallax_settings[0][wglParallax.itemId]; 99 settings = settings['items_parallax']; 100 return settings; 101 }, 102 buildBackendParallax = function() { 103 104 if(!window.elementor.elements.models){ 105 return; 106 } 107 108 var arr = []; 109 110 if ( ! wglParallax.backEndVars.hasOwnProperty( 'items_parallax' ) ) { 111 return false; 112 } 113 114 wglParallax.backEndVars[ 'items_parallax' ].models.forEach(function( value ){ 115 arr.push( value.attributes ); 116 }); 117 118 return arr; 119 }, 120 appendElement = function( settings ) { 121 var node_str = ''; 122 123 if(settings.image_bg.url){ 124 node_str = '<div data-item-id="' + settings._id + '" class="extended-parallax elementor-repeater-item-' + settings._id + '">'; 125 node_str += '<img src="' + settings.image_bg.url + '"/>'; 126 node_str += '</div>'; 127 } 128 129 if( !$(self).find( '.elementor-repeater-item-'+settings._id ).length > 0 ){ 130 $(self).append(node_str); 131 } 132 133 wglParallax.items.push(settings); 134 135 var item = jQuery(self).find('.extended-parallax'); 136 if (item.length !== 0 ) { 137 item.each( function() { 138 if(settings._id == jQuery(this).data('itemId')){ 139 if(settings.image_effect == 'mouse'){ 140 if(!jQuery(this).closest('.elementor-section').hasClass('wgl-parallax-mouse')){ 141 jQuery(this).closest('.elementor-section').addClass('wgl-parallax-mouse'); 142 } 143 144 jQuery(this).wrapInner('<div class="wgl-parallax-layer layer" data-depth="' + settings.parallax_factor + '"></div>'); 145 }else if( settings.image_effect == 'scroll' ){ 146 if( wglParallax.editorMode ){ 147 jQuery(this).paroller({ 148 factor: settings.parallax_factor, 149 type: 'foreground', // background, foreground 150 direction: settings.parallax_dir, // vertical, horizontal 151 152 }); 153 jQuery(this).css({'transform' : 'unset'}); 154 }else{ 155 jQuery(this).paroller({ 156 factor: settings.parallax_factor, 157 type: 'foreground', // background, foreground 158 direction: settings.parallax_dir, // vertical, horizontal 159 160 }); 161 } 162 }else if( settings.image_effect == 'css_animation' ){ 163 var self = $(this); 164 165 if(self.is_visible()){ 166 self.addClass( settings.animation_name ); 167 } 168 jQuery(window).on('resize scroll', function() { 169 if(self.is_visible()){ 170 self.addClass( settings.animation_name ); 171 } 172 }); 173 } 174 } 175 }); 176 177 if(settings.image_effect == 'mouse'){ 178 jQuery('.wgl-parallax-mouse').each(function(){ 179 var scene = jQuery(this).get(0); 180 var parallaxInstance = new Parallax(scene, { hoverOnly: true, selector: '.wgl-parallax-layer', pointerEvents: true }); 181 }); 182 } 183 } 184 }, 185 hideMobile = function(){ 186 if(wglParallax.items){ 187 $.each( wglParallax.items, function( index, value ) { 188 if(value.hide_on_mobile){ 189 if (jQuery(window).width() <= value.hide_mobile_resolution) { 190 jQuery('.extended-parallax[data-item-id="'+ value._id +'"]').css({ 'opacity' : '0', 'visibility' : 'hidden' }); 191 }else{ 192 jQuery('.extended-parallax[data-item-id="'+ value._id +'"]').css({ 'opacity' : '1', 'visibility' : 'visible' }); 193 } 194 } 195 }); 196 } 197 }, 198 build = function( settings ) { 199 $.each( settings, function( index, value ) { 200 appendElement(value); 201 }); 202 203 204 }; 205 206 /*Init*/ 207 init(); 208 209 jQuery( window ).resize( 210 function() { 211 hideMobile(); 212 } 213 ); 214 }); 215 }; 216 217 // Add Wgl Shape Divider 218 $.fn.WglSectionShapeDividerInit = function( options ){ 219 var defaults = {}; 220 221 return this.each(function( ) { 222 223 var self = $(this), 224 wglShapeDivider = { 225 editorMode: window.elementorFrontend.isEditMode(), 226 itemId: $(this).data('id'), 227 options: false, 228 globalVars: 'add_shape_divider', 229 backEndVars: [], 230 items: [], 231 }; 232 233 var init = function() { 234 setShapeDividerItem(); 235 }, 236 setShapeDividerItem = function(){ 237 var settings; 238 239 var checkEnabledParallax = ShapeDividerEnabled(); 240 241 if(!checkEnabledParallax){ 242 return; 243 } 244 245 if ( ! wglShapeDivider.editorMode ) { 246 settings = buildFrontShapeDivider(); 247 } else {
248 settings = buildBackendShapeDivider(); 249 } 250 251 if ( ! settings ) { 252 return; 253 } 254 255 build( settings ); 256 257 }, 258 ShapeDividerEnabled = function(){ 259 var settings = {}; 260 261 if ( ! wglShapeDivider.editorMode ) { 262 settings = wgl_parallax_settings[0][wglShapeDivider.itemId]; 263 264 if(!settings){ 265 return; 266 } 267 268 }else{ 269 if(!window.elementor.elements){ 270 return; 271 } 272 273 if(!window.elementor.elements.models){ 274 return; 275 } 276 277 window.elementor.elements.models.forEach(function( value ){ 278 if ( wglShapeDivider.itemId == value.id ) { 279 wglShapeDivider.backEndVars[wglShapeDivider.itemId] = value.attributes.settings.attributes; 280 settings = value.attributes.settings.attributes; 281 } 282 } ); 283 } 284 285 return settings; 286 }, 287 buildFrontShapeDivider = function() { 288 var settings = wgl_parallax_settings[0]; 289 return settings; 290 }, 291 292 buildBackendShapeDivider = function() { 293 294 if(!window.elementor.elements.models){ 295 return; 296 } 297 298 var arr = []; 299 300 arr = wglShapeDivider.backEndVars; 301 302 return arr; 303 }, 304 305 getSvgURL = function(fileName) { 306 var svgURL = wgl_parallax_settings.svgURL + fileName + '.svg'; 307 308 return svgURL; 309 }, 310 311 appendElement = function(settings ) { 312 313 var $item = settings[$(self).data('id')]; 314 315 if(!$item){ 316 return; 317 } 318 319 var node_str = '', 320 svgURL = ''; 321 322 if( $item.wgl_shape_divider_top && $item.wgl_shape_divider_top !== '' ){ 323 324 svgURL = getSvgURL( $item.wgl_shape_divider_top ); 325 326 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-top"></div>'; 327 $(self).prepend(node_str); 328 329 jQuery.get(svgURL, function (data) { 330 $(self).find('.wgl-divider.wgl-elementor-shape-top').empty().append(data.childNodes[0]); 331 }); 332 } 333 334 if( $item.wgl_shape_divider_bottom && $item.wgl_shape_divider_bottom !== '' ){ 335 336 svgURL = getSvgURL( $item.wgl_shape_divider_bottom ); 337 338 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-bottom"></div>'; 339 $(self).prepend(node_str); 340 341 jQuery.get(svgURL, function (data) { 342 $(self).find('.wgl-divider.wgl-elementor-shape-bottom').empty().append(data.childNodes[0]); 343 }); 344 } 345 }, 346 347 build = function( settings ) { 348 appendElement(settings); 349 }; 350 351 /*Init*/ 352 init(); 353 354 }); 355 }; 356 357}( jQuery, window ) ); 358
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.