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 64 qodeWidgetsPromoHandler = { 65 66 className: function () { 67 var className = 'elementor-element-wrapper'; 68 if (!this.isEditable() ) { 69 className += ' elementor-element--promotion'; 70 71 if ( this.isQodeWidget() ){ 72 className += ' qodef-element--promotion'; 73 } 74 } 75 return className; 76 }, 77 78 isQodeWidget: function () { 79 80 if ( undefined !== this.model.get( 'name' ) ) { 81 return 0 === this.model.get( 'name' ).indexOf( 'qi_' ); 82 } 83 }, 84 85 getElementObj: function ( key ) { 86 87 var widgetObj = elementor.config.promotionWidgets.find( 88 function ( widget, index ) { 89 if ( widget.name == key ) { 90 return true; 91 } 92 } 93 ); 94 95 return widgetObj; 96 97 }, 98 99 onMouseDown: function () { 100 var actionURL = elementor.config.elementPromotionURL.replace( 101 '%s', 102 this.model.get( 'name' ) 103 ), 104 title = this.model.get( 'title' ), 105 content = sprintf( 106 wp.i18n.__( 107 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 108 'qi-addons-for-elementor' 109 ), 110 title 111 ), 112 promotion = elementor.config.promotion.elements; 113 114 if ( this.isQodeWidget() ) { 115 var widgetObject = this.getElementObj( this.model.get( 'name' ) ); 116 if ( typeof widgetObject.helpUrl !== 'undefined' ) { 117 actionURL = widgetObject.helpUrl; 118 } 119 120 content = sprintf( 121 wp.i18n.__( 122 'The %s comes with advanced professional functionalities and an even smoother website-making experience. %s Upgrade Qi Addons for Elementor %s', 123 'qi-addons-for-elementor' 124 ), 125 title, 126 '<a class="qodef-dialog-box-link" target="_blank" href="https://qodeinteractive.com/pricing/">', 127 '</a>' 128 ); 129 } 130 131 elementor.promotion.showDialog( 132 { 133 /* translators: %s: Widget Title. */ 134 title: sprintf( 135 wp.i18n.__( 136 '%s Widget', 137 'qi-addons-for-elementor' 138 ), 139 title 140 ), 141 content: content, 142 position: { 143 blockStart: '-7' 144 }, 145 targetElement: this.el, 146 actionButton: { 147 // eslint-disable-next-line @wordpress/valid-sprintf 148 url: actionURL, 149 text: promotion.action_button.text, 150 classes: promotion.action_button.classes || ['elementor-button', 'go-pro'] 151 } 152 } 153 ); 154 155 } 156 }; 157 158 panel.elements.view = elementsView.extend( 159 { 160 childView: elementsView.prototype.childView.extend( qodeWidgetsPromoHandler ) 161 } 162 ); 163 164 panel.categories.view = categoriesView.extend( 165 { 166 childView: categoriesView.prototype.childView.extend( 167 { 168 childView: categoriesView.prototype.childView.prototype.childView.extend( qodeWidgetsPromoHandler ) 169 } 170 ) 171 } 172 ); 173 174 return panel; 175 } 176 ); 177 } 178 }, 179 }; 180 181})( 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.