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 var actionURL = elementor.config.elementPromotionURL.replace( 91 '%s', 92 this.model.get( 'name' ) 93 ), 94 title = this.model.get( 'title' ), 95 content = sprintf( 96 wp.i18n.__( 97 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 98 'qi-addons-for-elementor' 99 ), 100 title 101 ), 102 promotion = elementor.config.promotion.elements; 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 content = 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/">', 117 '</a>' 118 ); 119 } 120 121 elementor.promotion.showDialog( 122 { 123 /* translators: %s: Widget Title. */ 124 title: sprintf( 125 wp.i18n.__( 126 '%s Widget', 127 'qi-addons-for-elementor' 128 ), 129 title 130 ), 131 content: content, 132 position: { 133 blockStart: '-7' 134 }, 135 targetElement: this.el, 136 actionButton: { 137 // eslint-disable-next-line @wordpress/valid-sprintf 138 url: actionURL, 139 text: promotion.action_button.text, 140 classes: promotion.action_button.classes || ['elementor-button', 'go-pro'] 141 } 142 } 143 ); 144 145 } 146 }; 147 148 panel.elements.view = elementsView.extend( 149 { 150 childView: elementsView.prototype.childView.extend( qodeWidgetsPromoHandler ) 151 } 152 ); 153 154 panel.categories.view = categoriesView.extend( 155 { 156 childView: categoriesView.prototype.childView.extend( 157 { 158 childView: categoriesView.prototype.childView.prototype.childView.extend( qodeWidgetsPromoHandler ) 159 } 160 ) 161 } 162 ); 163 164 return panel; 165 } 166 ); 167 } 168 }, 169 }; 170 171})( 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.