1(function ($) { 2 "use strict"; 3 4 $(window).on( 'load', function () { 5 for (var key in qodefCore.shortcodes) { 6 for (var keyChild in qodefCore.shortcodes[key]) { 7 qodefElementor.init(key, keyChild); 8 } 9 } 10 11 qodefElementorSection.init(); 12 elementorSection.init(); 13 }); 14 15 var qodefElementor = { 16 init: function (key, keyChild) { 17 $(window).on('elementor/frontend/init', function (e) { 18 elementorFrontend.hooks.addAction('frontend/element_ready/' + key + '.default', function (e) { 19 qodefCore.shortcodes[key][keyChild].init(); 20 }); 21 }); 22 } 23 }; 24 25 var qodefElementorSection = { 26 init: function () { 27 $(window).on('elementor/frontend/init', function () { 28 elementorFrontend.hooks.addAction('frontend/element_ready/section', elementorSection.init); 29 }); 30 } 31 }; 32 33 var elementorSection = { 34 init: function ($scope) { 35 var $target = $scope, 36 isEditMode = Boolean(elementorFrontend.isEditMode()), 37 settings = [], 38 sectionData = {}; 39 40 //generate parallax settings 41 if (isEditMode && typeof $scope !== 'undefined') { 42 // generate options when in admin 43 var editorElements = window.elementor.elements, 44 sectionId = $target.data('id'); 45 46 $.each(editorElements.models, function (index, object) { 47 if (sectionId === object.id) { 48 sectionData = object.attributes.settings.attributes; 49 } 50 }); 51 52 if (sectionData.qodef_enable_parallax.length) { 53 settings['enable_parallax'] = sectionData.qodef_enable_parallax; 54 } 55 56 if (sectionData.qodef_parallax_image['url']) { 57 settings['image_url'] = sectionData.qodef_parallax_image['url']; 58 } 59 60 if (sectionData.qodef_parallax_height.length) { 61 settings['section_height'] = sectionData.qodef_parallax_height; 62 } 63 64 } else { 65 // generate options when in frontend using global js variable 66 var sectionHandlerData = qodefElementorGlobal.vars.elementorSectionHandler; 67 68 $.each(sectionHandlerData, function (index, property) { 69 $target = $('[data-id="' + index + '"]'); 70 settings['image_url'] = property[0].url; 71 settings['section_height'] = property[1]; 72 73 if (typeof settings['image_url'] !== 'undefined') { 74 settings['enable_parallax'] = 'yes'; 75 } 76 77 //generate output 78 if (typeof $target !== 'undefined' && $target.length) { 79 elementorSection.generateOutput($target, settings); 80 } 81 }); 82 } 83 84 //generate output 85 if (typeof $target !== 'undefined') { 86 elementorSection.generateOutput($target, settings); 87 } 88 }, 89 generateOutput: function ($target, settings) { 90 $('.qodef-parallax-img-holder', $target).remove(); 91 $target.removeClass('qodef-parallax qodef--parallax-row'); 92 $target.css({ 'overflow': 'hidden' }); 93 94 if (typeof settings['enable_parallax'] !== 'undefined' && settings['enable_parallax'] == 'yes' && typeof settings['image_url'] !== 'undefined') { 95 var $layout = null; 96 97 $target.addClass('qodef-parallax qodef--parallax-row'); 98 $target.css({ 'minHeight': settings['section_height'] + 'px', 'background': 'transparent' }); 99 100 $layout = $('<div class="qodef-parallax-img-holder"><div class="qodef-parallax-img-wrapper"><img src="' + settings['image_url'] + '" alt="Parallax image"></div></div>').prependTo($target); 101 102 //wait for image src to be loaded 103 var newImg = new Image; 104 newImg.onload = function () { 105 $target.find('img').attr('src', this.src); 106 qodefCore.qodefParallaxBackground.init(); 107 }; 108 newImg.src = settings['image_url']; 109 } 110 } 111 }; 112 113})(jQuery);
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.