1(function ($, elementor) { 2 'use strict'; 3 4 var ElementsKitParallax = { 5 6 init: function () { 7 elementor.hooks.addAction('frontend/element_ready/section', ElementsKitParallax.elementorSection); 8 }, 9 10 elementorSection: function ($scope) { 11 var $target = $scope, 12 instance = null, 13 editMode = Boolean(elementor.isEditMode()); 14 15 instance = new ElementsKitSectionParallaxPlugin($target); 16 instance.init(instance); 17 }, 18 }; 19 20 $(window).on('elementor/frontend/init', ElementsKitParallax.init); 21 22 var ElementsKitSectionParallaxPlugin = function ($target) { 23 var self = this, 24 sectionId = $target.data('id'), 25 settings = false, 26 editMode = Boolean(elementor.isEditMode()), 27 $window = $(window), 28 $body = $('body'), 29 scrollLayoutList = [], 30 mouseLayoutList = [], 31 winScrollTop = $window.scrollTop(), 32 winHeight = $window.height(), 33 requesScroll = null, 34 requestMouse = null, 35 x = {}, 36 isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), 37 platform = navigator.platform; 38 39 /** 40 * Init 41 */ 42 self.init = function () { 43 if ($(window).width() <= 1024) { 44 return false; 45 } 46 self.setParallaxMulti(sectionId); 47 self.moveBg(sectionId); 48 49 return false; 50 }; 51 52 self.setParallaxMulti = function (sectionId) { 53 var optionsRaw = {}, 54 optionsOpt = null, 55 options = []; 56 57 optionsRaw = self.getOptions(sectionId, 'ekit_section_parallax_multi_items'); 58 optionsOpt = self.getOptions(sectionId, 'ekit_section_parallax_multi'); 59 60 if (optionsOpt != 'yes') { 61 return; 62 } 63 64 if (editMode) { 65 if (!optionsRaw.hasOwnProperty('models') || 0 === Object.keys(optionsRaw.models).length || optionsOpt != 'yes') { 66 return; 67 } 68 optionsRaw = optionsRaw.models; 69 } 70 71 72 $target.addClass('elementskit-parallax-multi-container'); 73 74 $.each(optionsRaw, function (index, obj) { 75 if (obj.hasOwnProperty('attributes')) { 76 obj = obj.attributes; 77 } 78 options.push(obj); 79 self.pushElement(obj); 80 self.getSVG(); 81 }); 82 83 if (options.length < 0) { 84 return options; 85 } 86 87 88 $target.on('mousemove', function (e) { 89 $.each(options, function (index, obj) { 90 if (obj.parallax_style == 'mousemove') { 91 self.moveItem(obj, e); 92 } 93 }); 94 }); 95 96 $.each(options, function (index, obj) { 97 if (obj.parallax_style == 'tilt') { 98 self.tiltItem(obj); 99 } 100 if (obj.parallax_style == 'onscroll') { 101 self.walkItem(obj); 102 } 103 }); 104 }; 105 106 self.moveBg = function (sectionId) { 107 var optionsOpt = null, 108 optionsSpeed = .2; 109 110 111 optionsOpt = self.getOptions(sectionId, 'ekit_section_parallax_bg'); 112 optionsSpeed = self.getOptions(sectionId, 'ekit_section_parallax_bg_speed'); 113 114 $target.addClass('elementskit-parallax-multi-container'); 115 116 if (optionsOpt == 'yes' && !editMode) { 117 $target.jarallax({ 118 speed: optionsSpeed 119 }); 120 } 121 }; 122 123 self.walkItem = function (obj) { 124 if (obj.parallax_transform !== undefined && obj.parallax_transform_value !== undefined) { 125 $target.find('.elementor-repeater-item-' + obj._id).magician({ 126 type: 'scroll', 127 offsetTop: parseInt(obj.offsettop), 128 offsetBottom: parseInt(obj.offsetbottom), 129 duration: parseInt(obj.smoothness), 130 animation: { 131 [obj.parallax_transform]: obj.parallax_transform_value 132 } 133 }); 134 } 135 }; 136 137 self.moveItem = function (obj, e) { 138 var relX = e.pageX - $target.offset().left; 139 var relY = e.pageY - $target.offset().top; 140 var el = $target.find('.elementor-repeater-item-' + obj._id); 141 142 TweenMax.to(el, 1, { 143 x: (relX - $target.width() / 2) / $target.width() * obj.parallax_speed, 144 y: (relY - $target.height() / 2) / $target.height() * obj.parallax_speed, 145 ease: Power2.ease 146 }); 147 }; 148 149 self.tiltItem = function (obj) { 150 var container = $target.find('.elementor-repeater-item-' + obj._id), 151 item = container.find('img'); 152 container.tilt({ 153 disableAxis: obj.disableaxis, 154 scale: obj.scale, 155 speed: obj.parallax_speed, 156 maxTilt: obj.maxtilt, 157 glare: true, 158 maxGlare: .5 159 }); 160 }; 161 162 self.getOptions = function (sectionId, key) { 163 var editorElements = null, 164 sectionData = {}; 165 166 167 if (!editMode) { 168 sectionId = '.elementor-element-' + sectionId; 169 sectionData = $(sectionId).data('settings'); 170 171 if(typeof sectionData === 'undefined'){ 172 return; 173 } 174 175 if (!sectionData.hasOwnProperty(key)) { 176 return false;
177 } 178 179 } else { 180 if (!window.elementor.hasOwnProperty('elements')) { 181 return false; 182 } 183 editorElements = window.elementor.elements; 184 if (!editorElements.models) { 185 return false; 186 } 187 $.each(editorElements.models, function (index, obj) { 188 if (sectionId == obj.id) { 189 sectionData = obj.attributes.settings.attributes; 190 } 191 }); 192 193 if (!sectionData.hasOwnProperty(key)) { 194 return false; 195 } 196 } 197 198 // console.log(sectionData[key]); 199 return sectionData[key]; 200 }; 201 202 self.pushElement = function (elData) { 203 204 var klass = 'ekit-section-parallax-mousemove ekit-section-parallax-layer elementor-repeater-item-' + elData._id; 205 var shapeKlass = ''; 206 // console.log(elData); 207 if (elData.item_source == 'shape') { 208 elData.image = {}; 209 elData.image.url = window.elementskit_module_parallax_url + 'assets/svg/' + elData.shape + '.svg'; 210 klass = klass + ' ekit-section-parallax-layer-shape'; 211 shapeKlass = 'shape-' + elData.shape.replace('.svg', ''); 212 } 213 214 215 if ($target.find('.elementor-repeater-item-' + elData._id).length === 0 && elData.image.url != '') { 216 $target.prepend(` 217 <div class="${klass} ekit-section-parallax-type-${elData.parallax_style}" > 218 <img class="elementskit-parallax-graphic ${shapeKlass}" src="${elData.image.url}"/> 219 </div> 220 `); 221 } 222 }; 223 224 self.getSVG = function () { 225 $target.find('.ekit-section-parallax-layer-shape img').each(function () { 226 var img = $(this); 227 var attributes = img.prop("attributes"); 228 var imgURL = img.attr("src"); 229 $.get(imgURL, function (data) { 230 var svg = $(data).find('svg'); 231 svg = svg.removeAttr('xmlns:a'); 232 $.each(attributes, function () { 233 svg.attr(this.name, this.value); 234 }); 235 img.replaceWith(svg); 236 }); 237 }); 238 } 239 } 240 241}(jQuery, window.elementorFrontend));
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.