Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/core/admin/js
File: core.js
(function($) {
[0] Fix | Delete
[1] Fix | Delete
"use strict";
[2] Fix | Delete
[3] Fix | Delete
var top_window = window;
[4] Fix | Delete
var is_iframe = false;
[5] Fix | Delete
[6] Fix | Delete
if (window.top && window.top.__Cypress__) {
[7] Fix | Delete
if (window.parent === window.top) {
[8] Fix | Delete
top_window = window;
[9] Fix | Delete
is_iframe = false;
[10] Fix | Delete
[11] Fix | Delete
} else {
[12] Fix | Delete
top_window = window.parent;
[13] Fix | Delete
is_iframe = true;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
} else if (window.top) {
[17] Fix | Delete
top_window = window.top;
[18] Fix | Delete
is_iframe = window.top !== window.self;
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
// Extend etCore since it is declared by localization.
[22] Fix | Delete
$.extend( etCore, {
[23] Fix | Delete
[24] Fix | Delete
init: function() {
[25] Fix | Delete
this.tabs();
[26] Fix | Delete
this.listen();
[27] Fix | Delete
},
[28] Fix | Delete
[29] Fix | Delete
$selector: function(selector) {
[30] Fix | Delete
return top_window.jQuery(selector);
[31] Fix | Delete
},
[32] Fix | Delete
[33] Fix | Delete
applyMaxHeight: function() {
[34] Fix | Delete
var $et_core_modal_overlay = this.$selector('.et-core-modal-overlay');
[35] Fix | Delete
var $et_core_modal = $et_core_modal_overlay.find('.et-core-modal');
[36] Fix | Delete
var overlay_height = $et_core_modal_overlay.innerHeight();
[37] Fix | Delete
var no_scroll_fix = !$et_core_modal_overlay.hasClass('et-core-modal-overlay-scroll-fix');
[38] Fix | Delete
var disabled_scrollbar_class = 'et-core-modal-disabled-scrollbar';
[39] Fix | Delete
var et_core_modal_height;
[40] Fix | Delete
[41] Fix | Delete
if ( ! $et_core_modal_overlay.length || ! $et_core_modal_overlay.hasClass('et-core-active') ) {
[42] Fix | Delete
return;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
if (no_scroll_fix) {
[46] Fix | Delete
$et_core_modal_overlay.addClass( disabled_scrollbar_class );
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
if ($et_core_modal_overlay.hasClass(disabled_scrollbar_class)) {
[50] Fix | Delete
et_core_modal_height = $et_core_modal.innerHeight();
[51] Fix | Delete
} else {
[52] Fix | Delete
var content_height = Math.max($et_core_modal.find('.et-core-modal-content > *').height());
[53] Fix | Delete
var header_height = $et_core_modal_overlay.find('.et-core-modal-header').outerHeight() || 0;
[54] Fix | Delete
var buttons_height = $et_core_modal_overlay.find('.et_pb_prompt_buttons').outerHeight() || 0;
[55] Fix | Delete
et_core_modal_height = header_height + buttons_height + content_height + 60 - 23;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
if ( et_core_modal_height > ( overlay_height * 0.6 ) ) {
[59] Fix | Delete
$et_core_modal_overlay.removeClass( disabled_scrollbar_class );
[60] Fix | Delete
[61] Fix | Delete
$et_core_modal.css( 'marginTop', '0' );
[62] Fix | Delete
[63] Fix | Delete
return;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
$et_core_modal_overlay.addClass(disabled_scrollbar_class);
[67] Fix | Delete
$et_core_modal.css( 'marginTop', '-' + ( et_core_modal_height / 2 ) + 'px' );
[68] Fix | Delete
},
[69] Fix | Delete
[70] Fix | Delete
listen: function() {
[71] Fix | Delete
var $this = this;
[72] Fix | Delete
[73] Fix | Delete
$( document ).on( 'click', '[data-et-core-modal]', function( e ) {
[74] Fix | Delete
e.preventDefault();
[75] Fix | Delete
[76] Fix | Delete
var $button = $(this),
[77] Fix | Delete
$overlay = $( $button.data( 'et-core-modal' ) );
[78] Fix | Delete
[79] Fix | Delete
if ( $button.hasClass( 'et-core-disabled' ) ) {
[80] Fix | Delete
return;
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
$this.modalOpen($overlay);
[84] Fix | Delete
} );
[85] Fix | Delete
[86] Fix | Delete
$( document ).on( 'click', '[data-et-core-modal="close"], .et-core-modal-overlay', function( e ) {
[87] Fix | Delete
if ($(this).data('et-core-disable-closing')) {
[88] Fix | Delete
return;
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
$this.modalClose( e, this );
[92] Fix | Delete
} );
[93] Fix | Delete
[94] Fix | Delete
// Distroy listener to make sure it is only called once.
[95] Fix | Delete
$this.listen = function() {};
[96] Fix | Delete
},
[97] Fix | Delete
[98] Fix | Delete
modalOpen: function($overlay) {
[99] Fix | Delete
$overlay.addClass('et-core-active');
[100] Fix | Delete
$('body').addClass('et-core-nbfc');
[101] Fix | Delete
$(window).trigger('et-core-modal-active');
[102] Fix | Delete
},
[103] Fix | Delete
[104] Fix | Delete
modalClose: function( e, self ) {
[105] Fix | Delete
// Prevent default and propagation.
[106] Fix | Delete
if ( e && self ) {
[107] Fix | Delete
var $element = $( self );
[108] Fix | Delete
[109] Fix | Delete
if ( self !== e.target ) {
[110] Fix | Delete
return;
[111] Fix | Delete
} else {
[112] Fix | Delete
e.preventDefault();
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
$( '.et-core-modal-overlay.et-core-active' ).addClass( 'et-core-closing' ).delay( 600 ).queue( function() {
[117] Fix | Delete
var $overlay = $( this );
[118] Fix | Delete
[119] Fix | Delete
$overlay.removeClass( 'et-core-active et-core-closing' ).dequeue();
[120] Fix | Delete
$( 'body' ).removeClass( 'et-core-nbfc');
[121] Fix | Delete
$overlay.find( '.et-core-modal' ).removeAttr( 'style' );
[122] Fix | Delete
} );
[123] Fix | Delete
},
[124] Fix | Delete
[125] Fix | Delete
modalTitle: function( text ) {
[126] Fix | Delete
$( '.et-core-modal-overlay.et-core-active .et-core-modal-title' ).html( text );
[127] Fix | Delete
},
[128] Fix | Delete
[129] Fix | Delete
modalContent: function( text, replace, remove, parent ) {
[130] Fix | Delete
var parent = parent ? parent + ' ' : '',
[131] Fix | Delete
$modal = $( '.et-core-modal-overlay.et-core-active' ),
[132] Fix | Delete
$content = $modal.find( parent + '.et-core-modal-content' ),
[133] Fix | Delete
tempContent = parent + '.et-core-modal-temp-content',
[134] Fix | Delete
contentHeight = $content.height();
[135] Fix | Delete
[136] Fix | Delete
if ( replace ) {
[137] Fix | Delete
$content.html( text );
[138] Fix | Delete
} else {
[139] Fix | Delete
var displayTempContent = function() {
[140] Fix | Delete
var removeContent = function( delay ) {
[141] Fix | Delete
$content.delay( delay ).queue( function() {
[142] Fix | Delete
$modal.find( tempContent ).fadeOut( 200, function() {
[143] Fix | Delete
$content.fadeIn( 200 );
[144] Fix | Delete
$( this ).remove();
[145] Fix | Delete
} );
[146] Fix | Delete
$( this ).dequeue();
[147] Fix | Delete
} );
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
if ( true === remove ) {
[151] Fix | Delete
text = text + '<p><a class="et-core-modal-remove-temp-content" href="#">' + etCore.text.modalTempContentCheck + '</a></p>';
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
$content.stop().fadeOut( 200, function() {
[155] Fix | Delete
$( this ).before( '<div class="et-core-modal-temp-content"><div>' + text + '</div></div>' );
[156] Fix | Delete
$modal.find( tempContent ).height( contentHeight ).hide().fadeIn( 200 );
[157] Fix | Delete
$modal.find( '.et-core-modal-remove-temp-content' ).click( function( e ) {
[158] Fix | Delete
removeContent( 0 );
[159] Fix | Delete
} );
[160] Fix | Delete
} );
[161] Fix | Delete
[162] Fix | Delete
if ( $.isNumeric( remove ) ) {
[163] Fix | Delete
removeContent( remove );
[164] Fix | Delete
}
[165] Fix | Delete
}
[166] Fix | Delete
[167] Fix | Delete
if ( $modal.find( tempContent ).length > 0 ) {
[168] Fix | Delete
$modal.find( tempContent ).fadeOut( 200, function() {
[169] Fix | Delete
$( this ).remove();
[170] Fix | Delete
displayTempContent();
[171] Fix | Delete
} );
[172] Fix | Delete
} else {
[173] Fix | Delete
displayTempContent();
[174] Fix | Delete
}
[175] Fix | Delete
}
[176] Fix | Delete
},
[177] Fix | Delete
[178] Fix | Delete
tabs: function() {
[179] Fix | Delete
$( '[data-et-core-tabs]' ).tabs( {
[180] Fix | Delete
fx: {
[181] Fix | Delete
opacity: 'toggle',
[182] Fix | Delete
duration:'fast'
[183] Fix | Delete
},
[184] Fix | Delete
selected: 0,
[185] Fix | Delete
beforeActivate: function( event, ui ) {
[186] Fix | Delete
ui.newPanel.addClass( 'et-core-tabs-transition' );
[187] Fix | Delete
}
[188] Fix | Delete
} );
[189] Fix | Delete
},
[190] Fix | Delete
[191] Fix | Delete
} );
[192] Fix | Delete
[193] Fix | Delete
setTimeout(function() {
[194] Fix | Delete
if ($('.wrap.woocommerce').length) {
[195] Fix | Delete
return;
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
$(window).on('et-core-modal-active', function() {
[199] Fix | Delete
etCore.applyMaxHeight();
[200] Fix | Delete
});
[201] Fix | Delete
[202] Fix | Delete
$(document).ready(function() {
[203] Fix | Delete
etCore.init();
[204] Fix | Delete
});
[205] Fix | Delete
[206] Fix | Delete
$(window).resize(function() {
[207] Fix | Delete
etCore.applyMaxHeight();
[208] Fix | Delete
});
[209] Fix | Delete
});
[210] Fix | Delete
})(jQuery);
[211] Fix | Delete
[212] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function