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