From 54ff9763ef78a3f135ebffbf396a80418e46e68c Mon Sep 17 00:00:00 2001 From: Mahfuz Date: Mon, 25 Feb 2019 14:24:42 +0600 Subject: [PATCH] particle updated and upsale removed --- assets/css/essential-addons-elementor.css | 8 +- assets/js/eael-scripts.js | 153 +++++----- assets/sass/_particles.scss | 8 +- .../eael-particle-section.php | 275 +++++++----------- includes/class-wpdev-notices.php | 16 - 5 files changed, 192 insertions(+), 268 deletions(-) diff --git a/assets/css/essential-addons-elementor.css b/assets/css/essential-addons-elementor.css index 1b2268a00..0991c02b7 100755 --- a/assets/css/essential-addons-elementor.css +++ b/assets/css/essential-addons-elementor.css @@ -7540,10 +7540,16 @@ a.eael-gallery-load-more, a.eael-gallery-load-more:hover { transform: none; } } -.elementor-section.eael-particles-section .elementor-container { +.elementor-section.eael-particles-section .elementor-container, +.elementor-section .elementor-container { z-index: 99; } +.elementor-section.eael-particles-section > canvas { + position: absolute; + top: 0; +} + /*----------------------------*/ /* 35. Feature List /*----------------------------*/ diff --git a/assets/js/eael-scripts.js b/assets/js/eael-scripts.js index 3d4e79882..56563368d 100755 --- a/assets/js/eael-scripts.js +++ b/assets/js/eael-scripts.js @@ -650,92 +650,83 @@ /*=================================*/ /* 36. Section Particles /*=================================*/ - var EaelParticlesHandler = function($scope,$){ - var target = $scope, - sectionId = target.data('id'), - editMode = elementorFrontend.isEditMode(), - settings; + var EaelParticlesHandler = function ($scope, $) { + var sectionId = $scope.data('id'), + editMode = elementorFrontend.isEditMode(), + theme = $scope.data('theme'), + settings; - - if ( editMode ) { - settings = generateEditorSettings( sectionId ); - } - - if (!editMode || ! settings ) { - return false; - } - - if(settings.switch == 'yes') { - target.addClass('eael-particles-section'); - if(settings.themeSource === 'presets' || settings.themeSource === 'custom' && '' !== settings.selected_theme) { - generateParticles(); - } - } else { - target.removeClass('eael-particles-section'); - } - - - function generateEditorSettings(targetId){ - var editorElements = null, - sectionData = {}, - settings = {}; - - if ( ! window.elementor.hasOwnProperty( 'elements' ) ) { - return false; - } - - editorElements = window.elementor.elements; - - if ( ! editorElements.models ) { - return false; - } - - $.each(editorElements.models,function(index,elem){ - if( targetId == elem.id){ - sectionData = elem.attributes.settings.attributes; - - } else if( elem.id == target.closest( '.elementor-top-section' ).data( 'id' ) ) { - $.each(elem.attributes.elements.models,function(index,col){ - $.each(col.attributes.elements.models,function(index,subSec){ - sectionData = subSec.attributes.settings.attributes; - }); - }); - } - }); - - settings.switch = sectionData[ 'eael_particle_switch' ]; - settings.zIndex = sectionData[ 'eael_particles_zindex' ]; - settings.themeSource = sectionData['eael_particle_theme_from']; + $scope.addClass('eael-particles-section'); + if (editMode) { + var editorElements = null, + particleArgs = {}, + settings = {}; - if(settings.themeSource == 'presets') { - settings.selected_theme = (ParticleThemesData[sectionData[ 'eael_particle_preset_themes' ]]); - } + if (!window.elementor.hasOwnProperty('elements')) { + return false; + } - if( (settings.themeSource == 'custom') && ('' !== sectionData[ 'eael_particles_custom_style' ]) ){ - settings.selected_theme = sectionData[ 'eael_particles_custom_style' ]; - } - - if ( 0 !== settings.length ) { - return settings; - } + editorElements = window.elementor.elements; - return false; - } - - function generateParticles(){ - target.attr('id','eael-section-particles-'+ sectionId); - if(typeof particlesJS !== 'undefined' && $.isFunction(particlesJS)) { - particlesJS("eael-section-particles-" + sectionId, JSON.parse(settings.selected_theme)); - target.children('canvas.particles-js-canvas-el').css({ - zIndex: settings.zIndex, - position: 'absolute', - top:0 - }); - } - } - - }; + if (!editorElements.models) { + return false; + } + + $.each(editorElements.models, function (i, el) { + if (sectionId == el.id) { + particleArgs = el.attributes.settings.attributes; + + } else if (el.id == $scope.closest('.elementor-top-section').data('id')) { + $.each(el.attributes.elements.models, function (i, col) { + $.each(col.attributes.elements.models, function (i, subSec) { + particleArgs = subSec.attributes.settings.attributes; + }); + }); + } + }); + + settings.switch = particleArgs['eael_particle_switch']; + settings.themeSource = particleArgs['eael_particle_theme_from']; + + if (settings.themeSource == 'presets') { + settings.selected_theme = (ParticleThemesData[particleArgs['eael_particle_preset_themes']]); + } + + if ((settings.themeSource == 'custom') && ('' !== particleArgs['eael_particles_custom_style'])) { + settings.selected_theme = particleArgs['eael_particles_custom_style']; + } + + if (0 !== settings.length) { + settings = settings; + } + } else { + if (theme !== '') { + particlesJS('eael-section-particles-' + sectionId, theme); + } + } + + if (!editMode || !settings) { + return false; + } + + if (settings.switch == 'yes') { + + if (settings.themeSource === 'presets' || settings.themeSource === 'custom' && '' !== settings.selected_theme) { + $scope.attr('id', 'eael-section-particles-' + sectionId); + if (typeof particlesJS !== 'undefined' && $.isFunction(particlesJS)) { + particlesJS("eael-section-particles-" + sectionId, JSON.parse(settings.selected_theme)); + $scope.children('canvas.particles-js-canvas-el').css({ + position: 'absolute', + top: 0 + }); + } + } + } else { + $scope.removeClass('eael-particles-section'); + } + + }; $(window).on('elementor/frontend/init', function () { if(elementorFrontend.isEditMode()) { diff --git a/assets/sass/_particles.scss b/assets/sass/_particles.scss index c3de9dcc1..74abc47ff 100755 --- a/assets/sass/_particles.scss +++ b/assets/sass/_particles.scss @@ -1,3 +1,9 @@ -.elementor-section.eael-particles-section .elementor-container { +.elementor-section.eael-particles-section .elementor-container, +.elementor-section .elementor-container { z-index: 99; } + +.elementor-section.eael-particles-section > canvas{ + position: absolute; + top:0; +} \ No newline at end of file diff --git a/extensions/eael-particle-section/eael-particle-section.php b/extensions/eael-particle-section/eael-particle-section.php index 55d805b69..e5d2fcea0 100755 --- a/extensions/eael-particle-section/eael-particle-section.php +++ b/extensions/eael-particle-section/eael-particle-section.php @@ -7,186 +7,123 @@ use Elementor\Element_Base; use Elementor\Widget_Base; -class EAEL_Particle_Section extends Module_Base { - - public function __construct() { - parent::__construct(); - - add_action( 'elementor/frontend/section/before_render',array( $this,'before_render') ); - - add_action('elementor/element/section/section_layout/after_section_end',array($this,'register_controls'),10 ); - - add_action( 'elementor/frontend/section/after_render',array( $this,'after_render') ); - } - - public function get_name() { - return 'eael-particles'; - } - - public function register_controls( $element ) { - - $element->start_controls_section( - 'eael_particles_section', - [ - 'label' => 'EA Particles', - 'tab' => Controls_Manager::TAB_LAYOUT +add_action( 'elementor/frontend/section/before_render', 'before_render' ); +add_action('elementor/element/section/section_layout/after_section_end', 'register_controls',10 ); + +function register_controls( $element ) { + + $element->start_controls_section( + 'eael_particles_section', + [ + 'label' => 'EA Particles', + 'tab' => Controls_Manager::TAB_LAYOUT + ] + ); + + $element->add_control( + 'eael_particle_switch', + [ + 'label' => __( 'Enable Particles', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SWITCHER, + ] + ); + + $element->add_control( + 'eael_particle_theme_from', + [ + 'label' => __( 'Theme Source', 'essential-addons-elementor' ), + 'type' => Controls_Manager::CHOOSE, + 'options' => [ + 'presets' => [ + 'title' => __( 'Defaults', 'essential-addons-elementor' ), + 'icon' => 'fa fa-list', + ], + 'custom' => [ + 'title' => __( 'Custom', 'essential-addons-elementor' ), + 'icon' => 'fa fa-edit', + ], + ], + 'condition' => [ + 'eael_particle_switch' => 'yes' + ], + 'default' => 'presets' + ] + ); + + $element->add_control( + 'eael_particle_preset_themes', + [ + 'label' => esc_html__( 'Preset Themes', 'essential-addons-elementor' ), + 'type' => Controls_Manager::SELECT, + 'label_block' => true, + 'options' => [ + 11 => __( 'Default', 'essential-addons-elementor' ), + 'nasa' => __( 'Nasa', 'essential-addons-elementor' ), + 'bubble' => __( 'Bubble', 'essential-addons-elementor' ), + 'snow' => __( 'Snow', 'essential-addons-elementor' ), + 'nyan_cat' => __( 'Nyan Cat', 'essential-addons-elementor' ) + ], + 'default' => 11, + 'condition' => [ + 'eael_particle_theme_from' => 'presets', + 'eael_particle_switch' => 'yes' ] - ); - - $element->add_control( - 'eael_particle_switch', - [ - 'label' => __( 'Enable Particles', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SWITCHER, + ] + ); + + $element->add_control( + 'eael_particles_custom_style', + [ + 'label' => __( 'Custom Style', 'essential-addons-elementor' ), + 'type' => Controls_Manager::TEXTAREA, + 'description' => __( 'You can generate custom particles JSON code from Here!. Simply just past the JSON code above. For more queries Click Here!', 'essential-addons-elementor' ), + 'condition' => [ + 'eael_particle_theme_from' => 'custom', + 'eael_particle_switch' => 'yes' ] - ); - - $element->add_control( - 'eael_particle_area_zindex', - [ - 'label' => __( 'Z-index', 'essential-addons-elementor' ), - 'type' => Controls_Manager::NUMBER, - 'default' => 0, - 'condition' => [ - 'eael_particle_switch' => 'yes' - ] + ] + ); + + $element->add_control( + 'eael_particle_section_notice', + [ + 'raw' => __( 'You need to configure a Background Type to see this in full effect. You can do this by switching to the Style Tab.', 'essential-addons-elementor' ), + 'type' => Controls_Manager::RAW_HTML, + 'condition' => [ + 'eael_particle_theme_from' => 'custom', + 'eael_particle_switch' => 'yes' ] - ); + ] + ); + + $element->end_controls_section(); - $element->add_control( - 'eael_particle_theme_from', - [ - 'label' => __( 'Theme Source', 'essential-addons-elementor' ), - 'type' => Controls_Manager::CHOOSE, - 'options' => [ - 'presets' => [ - 'title' => __( 'Defaults', 'essential-addons-elementor' ), - 'icon' => 'fa fa-list', - ], - 'custom' => [ - 'title' => __( 'Custom', 'essential-addons-elementor' ), - 'icon' => 'fa fa-edit', - ], - ], - 'condition' => [ - 'eael_particle_switch' => 'yes' - ], - 'default' => 'presets' - ] - ); +} - $element->add_control( - 'eael_particle_preset_themes', - [ - 'label' => esc_html__( 'Preset Themes', 'essential-addons-elementor' ), - 'type' => Controls_Manager::SELECT, - 'label_block' => true, - 'options' => [ - 11 => __( 'Default', 'essential-addons-elementor' ), - 'nasa' => __( 'Nasa', 'essential-addons-elementor' ), - 'bubble' => __( 'Bubble', 'essential-addons-elementor' ), - 'snow' => __( 'Snow', 'essential-addons-elementor' ), - 'nyan_cat' => __( 'Nyan Cat', 'essential-addons-elementor' ) - ], - 'default' => 11, - 'condition' => [ - 'eael_particle_theme_from' => 'presets', - 'eael_particle_switch' => 'yes' - ] - ] - ); - - $element->add_control( - 'eael_particles_custom_style', - [ - 'label' => __( 'Custom Style', 'essential-addons-elementor' ), - 'type' => Controls_Manager::TEXTAREA, - 'description' => __( 'You can generate custom particles JSON code from Here!. Simply just past the JSON code above. For more queries Click Here!', 'essential-addons-elementor' ), - 'condition' => [ - 'eael_particle_theme_from' => 'custom', - 'eael_particle_switch' => 'yes' - ] - ] - ); +function before_render( $element ) { + $settings = $element->get_settings_for_display(); - $element->add_control( - 'eael_particle_section_notice', - [ - 'raw' => __( 'You need to configure a Background Type to see this in full effect. You can do this by switching to the Style Tab.', 'essential-addons-elementor' ), - 'type' => Controls_Manager::RAW_HTML, - 'condition' => [ - 'eael_particle_theme_from' => 'custom', - 'eael_particle_switch' => 'yes' - ] - ] - ); - - $element->end_controls_section(); + if( $settings['eael_particle_switch'] == 'yes' ){ - } + $element->add_render_attribute( + '_wrapper','id', + 'eael-section-particles-' . $element->get_id() + ); - public function before_render( $element ) { - - if( $element->get_settings('eael_particle_switch') == 'yes' ){ - $element->add_render_attribute( - '_wrapper','id', - 'eael-section-particles-' . $element->get_id() - ); - + $preset_themes = include('particle-themes.php'); + if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'presets') { + $theme = $preset_themes[ $settings['eael_particle_preset_themes'] ]; + $element->add_render_attribute('_wrapper', 'data-theme', $theme); } - - } - public function after_render( $element ) { - - $data = $element->get_data(); - $settings = $element->get_settings_for_display(); - $type = $data['elType']; - $zindex = ! empty( $settings['eael_particle_area_zindex'] ) ? $settings['eael_particle_area_zindex'] : 0; - - if( ('section' == $type) && ($element->get_settings('eael_particle_switch') == 'yes') ){ - - $preset_themes = include('particle-themes.php'); - if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'presets') { - $theme = $preset_themes[ $settings['eael_particle_preset_themes'] ]; - } - - if( isset($settings['eael_particle_theme_from']) && $settings['eael_particle_theme_from'] == 'custom') { - $theme = $settings['eael_particles_custom_style']; - } - - ?> - - - - add_render_attribute('_wrapper', 'data-theme', $settings['eael_particles_custom_style']); } - } - - + } + } - -EAEL_Particle_Section::instance(); \ No newline at end of file diff --git a/includes/class-wpdev-notices.php b/includes/class-wpdev-notices.php index 540f16189..780bc19c3 100755 --- a/includes/class-wpdev-notices.php +++ b/includes/class-wpdev-notices.php @@ -831,15 +831,6 @@ public function upsale_button_script(){ ) ]; -/** - * This is upsale notice settings - * classes for wrapper, - * Message message for showing. - */ -$notice->classes( 'upsale', 'notice is-dismissible' ); -$notice->message( 'upsale', '

'. __( 'Get the missing Drag & Drop Post Calendar feature for WordPress for Free!', 'essential-addons-elementor' ) .'

' ); -$notice->thumbnail( 'upsale', plugins_url( 'admin/assets/images/wpsp-logo.svg', ESSENTIAL_ADDONS_BASENAME ) ); - /** * This is review message and thumbnail. */ @@ -857,19 +848,12 @@ public function upsale_button_script(){ */ $notice->maybe_later_time = '7 Day'; -$notice->upsale_args = array( - 'slug' => 'wp-scheduled-posts', - 'page_slug' => 'wpsp-schedule-calendar', - 'file' => 'wp-scheduled-posts.php' -); - $notice->text_domain = 'essential-addons-elementor'; $notice->options_args = array( 'notice_will_show' => [ 'opt_in' => $notice->timestamp, 'review' => $notice->makeTime( $notice->timestamp, '4 Day' ), // after 4 days - 'upsale' => $notice->makeTime( $notice->timestamp, '2 Hour' ), // will be after 2 hours ] );