1(function ( $ ) { 2 'use strict'; 3 4 $( window ).on( 5 'elementor/frontend/init', 6 function () { 7 qodefAddonsElementor.init(); 8 qodefAddonsElementorPromoWidgets.init(); 9 10 } 11 ); 12 13 var qodefAddonsElementor = { 14 init: function () { 15 var isEditMode = Boolean( elementorFrontend.isEditMode() ); 16 17 if ( isEditMode ) { 18 for ( var key in qodefAddonsCore.shortcodes ) { 19 for ( var keyChild in qodefAddonsCore.shortcodes[key] ) { 20 qodefAddonsElementor.reInitShortcode( 21 key, 22 keyChild 23 ); 24 } 25 } 26 } 27 }, 28 reInitShortcode: function ( key, keyChild ) { 29 elementorFrontend.hooks.addAction( 30 'frontend/element_ready/' + key + '.default', 31 function ( e ) { 32 // Check if object doesn't exist and print the module where is the error 33 if ( typeof qodefAddonsCore.shortcodes[key][keyChild] === 'undefined' ) { 34 console.log( keyChild ); 35 } else if ( typeof qodefAddonsCore.shortcodes[key][keyChild].initSlider === 'function' && e.find( '.qodef-qi-swiper-container' ).length ) { 36 var $sliders = e.find( '.qodef-qi-swiper-container' ); 37 if ( $sliders.length ) { 38 $sliders.each( 39 function () { 40 qodefAddonsCore.shortcodes[key][keyChild].initSlider( $( this ) ); 41 } 42 ); 43 } 44 } else if ( typeof qodefAddonsCore.shortcodes[key][keyChild].initItem === 'function' && e.find( '.qodef-shortcode' ).length ) { 45 qodefAddonsCore.shortcodes[key][keyChild].initItem( e.find( '.qodef-shortcode' ) ); 46 } else { 47 qodefAddonsCore.shortcodes[key][keyChild].init(); 48 } 49 } 50 ); 51 }, 52 }; 53 54 var qodefAddonsElementorPromoWidgets = { 55 init: function () { 56 if ( typeof elementor !== 'undefined' ) { 57 elementor.hooks.addFilter( 58 'panel/elements/regionViews', 59 function ( panel ) { 60 var qodeWidgetsPromoHandler, 61 elementsView = panel.elements.view, 62 categoriesView = panel.categories.view, 63 widgets = panel.elements.options.collection, 64 categories = panel.categories.options.collection; 65 66 qodeWidgetsPromoHandler = { 67 68 isQodeWidget: function () { 69 70 if ( undefined !== this.model.get( 'name' ) ) { 71 return 0 === this.model.get( 'name' ).indexOf( 'qi_' ); 72 } 73 }, 74 75 getElementObj: function ( key ) { 76 77 var widgetObj = elementor.config.promotionWidgets.find( 78 function ( widget, index ) { 79 if ( widget.name == key ) { 80 return true; 81 } 82 } 83 ); 84 85 return widgetObj; 86 87 }, 88 89 onMouseDown: function () { 90 91 var actionURL = elementor.config.elementPromotionURL.replace( 92 '%s', 93 this.model.get( 'name' ) 94 ), 95 title = this.model.get( 'title' ), 96 message = sprintf( 97 wp.i18n.__( 98 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 99 'qi-addons-for-elementor' 100 ), 101 title 102 ); 103 104 if ( this.isQodeWidget() ) { 105 var widgetObject = this.getElementObj( this.model.get( 'name' ) ); 106 if ( typeof widgetObject.helpUrl !== 'undefined' ) { 107 actionURL = widgetObject.helpUrl; 108 } 109 110 message = sprintf( 111 wp.i18n.__( 112 'The %s comes with advanced professional functionalities and an even smoother website-making experience. %s Upgrade Qi Addons for Elementor %s', 113 'qi-addons-for-elementor' 114 ), 115 title, 116 '<a class="qodef-dialog-box-link" target="_blank" href="https://qodeinteractive.com/pricing-elementor/">', 117 '</a>' 118 ); 119 } 120 121 elementor.promotion.showDialog( 122 { 123 /* translators: %s: Widget Title. */ 124 headerMessage: sprintf( 125 wp.i18n.__( 126 '%s Widget', 127 'qi-addons-for-elementor' 128 ), 129 title 130 ), 131 message: message, 132 top: '-7', 133 element: this.el, 134 actionURL: actionURL 135 } 136 ); 137 138 } 139 }; 140 141 panel.elements.view = elementsView.extend( 142 { 143 childView: elementsView.prototype.childView.extend( qodeWidgetsPromoHandler ) 144 } 145 ); 146 147 panel.categories.view = categoriesView.extend( 148 { 149 childView: categoriesView.prototype.childView.extend( 150 { 151 childView: categoriesView.prototype.childView.prototype.childView.extend( qodeWidgetsPromoHandler ) 152 } 153 ) 154 } 155 ); 156 157 return panel; 158 } 159 ); 160 } 161 }, 162 }; 163 164})( 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.