Skip to content

Commit

Permalink
particle updated and upsale removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mahafuz committed Feb 25, 2019
1 parent fd72a03 commit 54ff976
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 268 deletions.
8 changes: 7 additions & 1 deletion assets/css/essential-addons-elementor.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*----------------------------*/
Expand Down
153 changes: 72 additions & 81 deletions assets/js/eael-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
8 changes: 7 additions & 1 deletion assets/sass/_particles.scss
Original file line number Diff line number Diff line change
@@ -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;
}
Loading

0 comments on commit 54ff976

Please sign in to comment.