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