| Linux webm007.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 Path : /home/eglisebaa/www/wp-content/themes/hallelujah/plugins/elementor/ |
| Current File : /home/eglisebaa/www/wp-content/themes/hallelujah/plugins/elementor/elementor-editor.js |
/* global jQuery:false, elementor:false */
jQuery( document ).ready(
function() {
"use strict";
// Add color_style to the titles
hallelujah_add_filter('trx_addons_filter_sc_classes', function(classes, settings) {
if (typeof settings.color_style != 'undefined') {
classes += ' color_style_' + settings.color_style;
}
return classes;
});
// Reload preview after any page setting is changed
if (window.elementor !== undefined) {
var timer = null;
var save_options = _.throttle( function() { elementor.saver.doAutoSave(); }, 3000, {leading: false} );
jQuery( '#elementor-panel' )
.on( 'input change', '[data-setting*="hallelujah_options_"]', function (e) {
var tab = jQuery( '.elementor-panel-navigation-tab.elementor-active' ),
tab_name = tab.length > 0 ? tab.data( 'tab' ) : '',
section = jQuery( this ).parents( '.elementor-control' ).prevAll( '.elementor-control-type-section' ),
section_classes = section.length > 0 ? section.attr( 'class' ).split( ' ' ) : [],
section_name = '';
for (var i = 0; i < section_classes.length; i++) {
if (section_classes[i].indexOf( 'elementor-control-section_' ) >= 0) {
section_name = section_classes[i].replace( 'elementor-control-', '' );
break;
}
}
// Trigger Elementor's save procedure
save_options(); // Save options after 3sec
//elementor.saver.doAutoSave(); // Save immediately
// Refresh Preview area and restore active tab
if (tab.length > 0 && section_name !== '') {
if (timer !== null) {
clearTimeout( timer );
}
timer = setTimeout(
function() {
elementor.reloadPreview();
elementor.once(
'preview:loaded', function() {
// Restore panel with the 'Page settings'
var panel = elementor.getPanelView();
panel.setPage( 'page_settings' );
// Trigger 'click' on the last opened tab (if not first)
tab = jQuery( '.elementor-panel-navigation-tab[data-tab="' + tab_name + '"]' );
if (tab.length > 0 && tab.parent().find( '.elementor-panel-navigation-tab' ).eq( 0 ).data( 'tab' ) != tab_name) {
tab.find( 'a' ).trigger( 'click' );
}
// Trigger 'click' on the last opened section (if not first)
section = jQuery( '.elementor-control-' + section_name );
if (section.length > 0 && ! section.parent().find( '.elementor-control' ).eq( 0 ).hasClass( 'elementor-control-' + section_name )) {
section.trigger( 'click' );
}
}
);
}, 4500
); // Reload page after the AJAX-call 'Save page options' appear (Elementor call save options after 3000ms)
}
// Refresh link 'xxx_post_editor'
var link = jQuery( this ).parents( '.elementor-control' ).find( 'a.hallelujah_post_editor' );
if ( link.length > 0 ) {
hallelujah_change_post_edit_link_elementor( link );
}
} )
.on( 'click', '.hallelujah_post_editor', function(e) {
hallelujah_change_post_edit_link_elementor( jQuery(this) );
if (jQuery(this).hasClass('hallelujah_hidden' )) {
e.preventDefault();
return false;
}
});
}
function hallelujah_change_post_edit_link_elementor(a) {
if (a.length > 0) {
var sel = a.parents('.elementor-control').find('select'),
val = sel.val();
if (sel.length == 0 || val == null || val == 'inherit') {
a.addClass( 'hallelujah_hidden' );
} else {
var id = ('' + val).split( '-' ).pop();
a.attr( 'href', a.attr( 'href' ).replace( /post=[0-9]{1,5}/, "post=" + id ) );
if (id == 0 || id == 'none') {
a.addClass( 'hallelujah_hidden' );
} else {
a.removeClass( 'hallelujah_hidden' );
}
}
}
}
}
);