1'use strict'; 2 3/** 4 * Used to handle : 5 * Click of Non-Installed Plugins 6 * Show Upsell Popup 7 * Unbind Drag & Drop 8 9*/ 10 11let SbElementorHandler = window.SbElementorHandler || ( function( _document, window, $ ) { 12 13 const smashBalloonPlugins = sbHandler.smashPlugins; 14 15 let app = { 16 17 init: function() { 18 app.events(); 19 }, 20 21 events: function() { 22 23 $( window ).on('elementor/frontend/init', function () { 24 app.disableInactiveSmashWidgets(); 25 setTimeout(function(){ 26 elementor.panel.$el.on('click', function () { 27 app.disableInactiveSmashWidgets(); 28 }); 29 }, 300) 30 }); 31 32 }, 33 34 disableInactiveSmashWidgets : function(){ 35 setTimeout(function(){ 36 for (const pluginName in smashBalloonPlugins) { 37 let plugin = smashBalloonPlugins[pluginName], 38 pluginWidget = elementor.panel.$el.find("#elementor-panel-category-smash-balloon").find('.sb-elem-inactive.sb-elem-'+pluginName).parents('.elementor-element-wrapper').find('.elementor-element'); 39 40 pluginWidget.attr('draggable', false); 41 pluginWidget.on('click', function(){ 42 app.createUpsellPopup( pluginName ); 43 }); 44 } 45 }, 500) 46 }, 47 48 createUpsellPopup : function( pluginName ){ 49 let plugin = smashBalloonPlugins[pluginName], 50 spinnerIcon = '<svg x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>', 51 upsellPopupOutput = 52 '<div class="sb-source-ctn sb-fs-boss sb-center-boss">\ 53 <div class="sb-source-popup sb-popup-inside sb-install-plugin-modal">\ 54 <div class="sb-popup-cls">\ 55 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\ 56 <path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="#141B38"/>\ 57 </svg>\ 58 </div>\ 59 <div class="sb-install-plugin-body sb-fs">\ 60 <div class="sb-install-plugin-header">\ 61 <div class="sb-plugin-image">' + plugin["icon"] + '\ 62 <svg class="sb-plugin-cta-logo" width="26" height="33" viewBox="0 0 26 33" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M25.5608 15.2708C25.5608 6.86286 20.0495 0.046814 13.2486 0.046814C6.44763 0.046814 0.933838 6.86286 0.933838 15.2708C0.933838 23.3312 5.98416 29.9079 12.3795 30.4596L11.6995 32.6132L15.9639 32.2505L14.4677 30.4218C20.6943 29.6661 25.5608 23.1725 25.5608 15.2708Z" fill="#FE544F"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.1843 5.39911L16.7768 11.5131L22.9165 11.6894L18.4752 15.8189L21.983 20.8926L16.0735 19.7817L14.282 25.6913L11.5618 20.3993L6.0693 22.916L8.18218 17.2428L2.82544 14.5409L8.55968 12.6968L6.97737 7.04787L12.4024 10.1407L16.1843 5.39911Z" fill="white"/></svg>\ 63 </div>\ 64 <div class="sb-plugin-name">\ 65 <strong>Requires</strong>\ 66 <h3>\ 67 ' + pluginName + '\ 68 <span>Free</span>\ 69 </h3>\ 70 </div>\ 71 </div>\ 72 <div class="sb-install-plugin-content">\ 73 <p>' + plugin["description"] + '</p>\ 74 <button class="sb-install-plugin-btn sb-btn-orange sb-plugin-btn" data-plugin="'+plugin['download_plugin']+'">\ 75 <span class="sb-install-plugin-spinner" style="display:none">'+spinnerIcon+'</span>\ 76 Install\ 77 </button>\ 78 <button class="sb-install-refresh-btn sb-btn-blue sb-plugin-btn" style="display:none">\ 79 Refresh The Page\ 80 </button>\ 81 </div>\ 82 </div>\ 83 </div>\ 84 </div>'; 85 if($(window.parent.document.body).find('.sb-center-boss').length === 0){ 86 $(window.parent.document.body).append(upsellPopupOutput); 87 } 88 $(window.parent.document.body).find('.sb-install-plugin-btn').on('click', function(){ 89 let downloadPlugin = $(this).attr('data-plugin'); 90 $(this).find('.sb-install-plugin-spinner').show(); 91 app.installPlugin(downloadPlugin); 92 }); 93 94 $(window.parent.document.body).find('.sb-install-refresh-btn').on('click', function(){ 95 window.parent.location.reload(); 96 }); 97 98 $(window.parent.document.body).find('.sb-popup-cls').on('click', function(){ 99 app.closeUpsellPopup(); 100 }); 101 }, 102 closeUpsellPopup : function(){ 103 $(window.parent.document.body).find('.sb-center-boss').remove(); 104 }, 105 106 installPlugin : function(downloadPlugin){ 107 let data = new FormData(); 108 data.append( 'action', 'sbi_install_addon' ); 109 data.append( 'nonce', sbHandler.nonce ); 110 data.append( 'plugin', downloadPlugin ); 111 data.append( 'type', 'plugin' ); 112 fetch(sbHandler.ajax_handler, { 113 method: "POST", 114 credentials: 'same-origin', 115 body: data 116 }) 117 .then(response => response.json()) 118 .then(data => { 119 $(window.parent.document.body).find('.sb-install-plugin-btn').hide(); 120 if( data.success == true ) { 121 $(window.parent.document.body).find('.sb-install-refresh-btn').show(); 122 123 } 124 125 }); 126 } 127 128 }; 129 130 131 return app; 132 133}( document, window, jQuery ) ); 134 135SbElementorHandler.init();
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.