Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
18
wp-content/themes/Divi/core/admin/js/checkbox.js
Normal file
18
wp-content/themes/Divi/core/admin/js/checkbox.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* jQuery custom checkboxes
|
||||
*
|
||||
* Copyright (c) 2008 Khavilo Dmitry (http://widowmaker.kiev.ua/checkbox/)
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* @version 1.3.0 Beta 1
|
||||
* @author Khavilo Dmitry
|
||||
* @mailto wm.morgun@gmail.com
|
||||
*
|
||||
* Modified to adapt the latest jQuery version (v3 above) included on WordPress 5.6:
|
||||
* - (2020-12-15) - jQuery hover method is deprecated.
|
||||
* - (2021-02-02) - jQuery :eq() selector is deprecated.
|
||||
* - (2021-02-03) - jQuery bind method is deprecated.
|
||||
* - (2021-02-04) - jQuery click event shorthand is deprecated.
|
||||
**/
|
||||
(function($){var i=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()};$.fn.checkbox=function(f){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}var g={cls:'jquery-checkbox',empty:clearpath};g=$.extend(g,f||{});var h=function(a){var b=a.checked;var c=a.disabled;var d=$(a);if(a.stateInterval)clearInterval(a.stateInterval);a.stateInterval=setInterval(function(){if(a.disabled!=c)d.trigger((c=!!a.disabled)?'disable':'enable');if(a.checked!=b)d.trigger((b=!!a.checked)?'check':'uncheck')},10);return d};return this.each(function(){var a=this;var b=h(a);if(a.wrapper)a.wrapper.remove();a.wrapper=$('<span class="'+g.cls+'"><span class="mark"><img src="'+g.empty+'" /></span></span>');a.wrapperInner=a.wrapper.children('span').eq(0);a.wrapper.on("mouseenter",function(e){a.wrapperInner.addClass(g.cls+'-hover');i(e)}).on("mouseleave",function(e){a.wrapperInner.removeClass(g.cls+'-hover');i(e)});b.css({position:'absolute',zIndex:-1,visibility:'hidden'}).after(a.wrapper);var c=false;if(b.attr('id')){c=$('label[for='+b.attr('id')+']');if(!c.length)c=false}if(!c){c=b.closest?b.closest('label'):b.parents('label').eq(0);if(!c.length)c=false}if(c){c.on("mouseenter",function(e){a.wrapper.trigger('mouseover',[e])}).on("mouseleave",function(e){a.wrapper.trigger('mouseout',[e])});c.on('click',function(e){b.trigger('click',[e]);i(e);return false})}a.wrapper.on('click',function(e){b.trigger('click',[e]);i(e);return false});b.on('click',function(e){i(e)});b.on('disable',function(){a.wrapperInner.addClass(g.cls+'-disabled')}).on('enable',function(){a.wrapperInner.removeClass(g.cls+'-disabled')});b.on('check',function(){a.wrapper.addClass(g.cls+'-checked')}).on('uncheck',function(){a.wrapper.removeClass(g.cls+'-checked')});$('img',a.wrapper).on('dragstart',function(){return false}).on('mousedown',function(){return false});if(window.getSelection)a.wrapper.css('MozUserSelect','none');if(a.checked)a.wrapper.addClass(g.cls+'-checked');if(a.disabled)a.wrapperInner.addClass(g.cls+'-disabled')})}})(jQuery);
|
489
wp-content/themes/Divi/core/admin/js/colorpicker.js
Normal file
489
wp-content/themes/Divi/core/admin/js/colorpicker.js
Normal file
@@ -0,0 +1,489 @@
|
||||
/**
|
||||
*
|
||||
* Color picker
|
||||
* Author: Stefan Petre www.eyecon.ro
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses
|
||||
*
|
||||
* Modified to adapt the latest jQuery version (v3 above) included on WordPress 5.6:
|
||||
* - (2021-02-05) - Number type value passed to css method is deprecated.
|
||||
* - (2021-02-05) - jQuery bind method is deprecated.
|
||||
* - (2021-02-05) - jQuery unbind method is deprecated.
|
||||
* - (2021-02-05) - jQuery focus method is deprecated.
|
||||
*/
|
||||
(function ($) {
|
||||
var ColorPicker = function () {
|
||||
var
|
||||
ids = {},
|
||||
inAction,
|
||||
charMin = 65,
|
||||
visible,
|
||||
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
|
||||
defaults = {
|
||||
eventName: 'click',
|
||||
onShow: function () {},
|
||||
onBeforeShow: function(){},
|
||||
onHide: function () {},
|
||||
onChange: function () {},
|
||||
onSubmit: function () {},
|
||||
color: 'ff0000',
|
||||
livePreview: true,
|
||||
flat: false
|
||||
},
|
||||
fillRGBFields = function (hsb, cal) {
|
||||
var rgb = HSBToRGB(hsb);
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(1).val(rgb.r).end()
|
||||
.eq(2).val(rgb.g).end()
|
||||
.eq(3).val(rgb.b).end();
|
||||
},
|
||||
fillHSBFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(4).val(hsb.h).end()
|
||||
.eq(5).val(hsb.s).end()
|
||||
.eq(6).val(hsb.b).end();
|
||||
},
|
||||
fillHexFields = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').fields
|
||||
.eq(0).val(HSBToHex(hsb)).end();
|
||||
},
|
||||
setSelector = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
|
||||
$(cal).data('colorpicker').selectorIndic.css({
|
||||
left: parseInt(150 * hsb.s/100, 10) + 'px',
|
||||
top: parseInt(150 * (100-hsb.b)/100, 10) + 'px',
|
||||
});
|
||||
},
|
||||
setHue = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10) + 'px');
|
||||
},
|
||||
setCurrentColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
setNewColor = function (hsb, cal) {
|
||||
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||
},
|
||||
keyDown = function (ev) {
|
||||
var pressedKey = ev.charCode || ev.keyCode || -1;
|
||||
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
|
||||
return false;
|
||||
}
|
||||
var cal = $(this).parent().parent();
|
||||
if (cal.data('colorpicker').livePreview === true) {
|
||||
change.apply(this);
|
||||
}
|
||||
},
|
||||
change = function (ev) {
|
||||
var cal = $(this).parent().parent(), col;
|
||||
if (this.parentNode.className.indexOf('_hex') > 0) {
|
||||
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
|
||||
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
||||
cal.data('colorpicker').color = col = fixHSB({
|
||||
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
|
||||
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
|
||||
});
|
||||
} else {
|
||||
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
|
||||
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
|
||||
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
|
||||
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
|
||||
}));
|
||||
}
|
||||
if (ev) {
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
}
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
||||
},
|
||||
blur = function (ev) {
|
||||
var cal = $(this).parent().parent();
|
||||
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
},
|
||||
focus = function () {
|
||||
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
|
||||
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||
$(this).parent().addClass('colorpicker_focus');
|
||||
},
|
||||
downIncrement = function (ev) {
|
||||
var field = $(this).parent().find('input').trigger('focus');
|
||||
var current = {
|
||||
el: $(this).parent().addClass('colorpicker_slider'),
|
||||
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
||||
y: ev.pageY,
|
||||
field: field,
|
||||
val: parseInt(field.val(), 10),
|
||||
preview: $(this).parent().parent().data('colorpicker').livePreview
|
||||
};
|
||||
$(document).on('mouseup', current, upIncrement);
|
||||
$(document).on('mousemove', current, moveIncrement);
|
||||
},
|
||||
moveIncrement = function (ev) {
|
||||
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
|
||||
if (ev.data.preview) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upIncrement = function (ev) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
ev.data.el.removeClass('colorpicker_slider').find('input').trigger('focus');
|
||||
$(document).off('mouseup', upIncrement);
|
||||
$(document).off('mousemove', moveIncrement);
|
||||
return false;
|
||||
},
|
||||
downHue = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
y: $(this).offset().top
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).on('mouseup', current, upHue);
|
||||
$(document).on('mousemove', current, moveHue);
|
||||
},
|
||||
moveHue = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(4)
|
||||
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upHue = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).off('mouseup', upHue);
|
||||
$(document).off('mousemove', moveHue);
|
||||
return false;
|
||||
},
|
||||
downSelector = function (ev) {
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
pos: $(this).offset()
|
||||
};
|
||||
current.preview = current.cal.data('colorpicker').livePreview;
|
||||
$(document).on('mouseup', current, upSelector);
|
||||
$(document).on('mousemove', current, moveSelector);
|
||||
},
|
||||
moveSelector = function (ev) {
|
||||
change.apply(
|
||||
ev.data.cal.data('colorpicker')
|
||||
.fields
|
||||
.eq(6)
|
||||
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
|
||||
.end()
|
||||
.eq(5)
|
||||
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upSelector = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||
$(document).off('mouseup', upSelector);
|
||||
$(document).off('mousemove', moveSelector);
|
||||
return false;
|
||||
},
|
||||
enterSubmit = function (ev) {
|
||||
$(this).addClass('colorpicker_focus');
|
||||
},
|
||||
leaveSubmit = function (ev) {
|
||||
$(this).removeClass('colorpicker_focus');
|
||||
},
|
||||
clickSubmit = function (ev) {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').color;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
setCurrentColor(col, cal.get(0));
|
||||
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
|
||||
},
|
||||
show = function (ev) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
|
||||
var pos = $(this).offset();
|
||||
var viewPort = getViewport();
|
||||
var top = pos.top + this.offsetHeight;
|
||||
var left = pos.left;
|
||||
if (top + 176 > viewPort.t + viewPort.h) {
|
||||
top -= this.offsetHeight + 176;
|
||||
}
|
||||
if (left + 356 > viewPort.l + viewPort.w) {
|
||||
left -= 356;
|
||||
}
|
||||
cal.css({left: left + 'px', top: top + 'px'});
|
||||
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
|
||||
cal.show();
|
||||
}
|
||||
$(document).on('mousedown', {cal: cal}, hide);
|
||||
return false;
|
||||
},
|
||||
hide = function (ev) {
|
||||
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
||||
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||
ev.data.cal.hide();
|
||||
}
|
||||
$(document).off('mousedown', hide);
|
||||
}
|
||||
},
|
||||
isChildOf = function(parentEl, el, container) {
|
||||
if (parentEl == el) {
|
||||
return true;
|
||||
}
|
||||
if (parentEl.contains) {
|
||||
return parentEl.contains(el);
|
||||
}
|
||||
if ( parentEl.compareDocumentPosition ) {
|
||||
return !!(parentEl.compareDocumentPosition(el) & 16);
|
||||
}
|
||||
var prEl = el.parentNode;
|
||||
while(prEl && prEl != container) {
|
||||
if (prEl == parentEl)
|
||||
return true;
|
||||
prEl = prEl.parentNode;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getViewport = function () {
|
||||
var m = document.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||
};
|
||||
},
|
||||
fixHSB = function (hsb) {
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, hsb.h)),
|
||||
s: Math.min(100, Math.max(0, hsb.s)),
|
||||
b: Math.min(100, Math.max(0, hsb.b))
|
||||
};
|
||||
},
|
||||
fixRGB = function (rgb) {
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, rgb.r)),
|
||||
g: Math.min(255, Math.max(0, rgb.g)),
|
||||
b: Math.min(255, Math.max(0, rgb.b))
|
||||
};
|
||||
},
|
||||
fixHex = function (hex) {
|
||||
var len = 6 - hex.length;
|
||||
if (len > 0) {
|
||||
var o = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
o.push('0');
|
||||
}
|
||||
o.push(hex);
|
||||
hex = o.join('');
|
||||
}
|
||||
return hex;
|
||||
},
|
||||
HexToRGB = function (hex) {
|
||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
||||
},
|
||||
HexToHSB = function (hex) {
|
||||
return RGBToHSB(HexToRGB(hex));
|
||||
},
|
||||
RGBToHSB = function (rgb) {
|
||||
var hsb = {
|
||||
h: 0,
|
||||
s: 0,
|
||||
b: 0
|
||||
};
|
||||
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||
var delta = max - min;
|
||||
hsb.b = max;
|
||||
if (max != 0) {
|
||||
|
||||
}
|
||||
hsb.s = max != 0 ? 255 * delta / max : 0;
|
||||
if (hsb.s != 0) {
|
||||
if (rgb.r == max) {
|
||||
hsb.h = (rgb.g - rgb.b) / delta;
|
||||
} else if (rgb.g == max) {
|
||||
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||
} else {
|
||||
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||
}
|
||||
} else {
|
||||
hsb.h = -1;
|
||||
}
|
||||
hsb.h *= 60;
|
||||
if (hsb.h < 0) {
|
||||
hsb.h += 360;
|
||||
}
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
},
|
||||
HSBToRGB = function (hsb) {
|
||||
var rgb = {};
|
||||
var h = Math.round(hsb.h);
|
||||
var s = Math.round(hsb.s*255/100);
|
||||
var v = Math.round(hsb.b*255/100);
|
||||
if(s == 0) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = (255-s)*v/255;
|
||||
var t3 = (t1-t2)*(h%60)/60;
|
||||
if(h==360) h = 0;
|
||||
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
|
||||
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
|
||||
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
|
||||
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
|
||||
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
|
||||
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
|
||||
else {rgb.r=0; rgb.g=0; rgb.b=0}
|
||||
}
|
||||
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
|
||||
},
|
||||
RGBToHex = function (rgb) {
|
||||
var hex = [
|
||||
rgb.r.toString(16),
|
||||
rgb.g.toString(16),
|
||||
rgb.b.toString(16)
|
||||
];
|
||||
$.each(hex, function (nr, val) {
|
||||
if (val.length == 1) {
|
||||
hex[nr] = '0' + val;
|
||||
}
|
||||
});
|
||||
return hex.join('');
|
||||
},
|
||||
HSBToHex = function (hsb) {
|
||||
return RGBToHex(HSBToRGB(hsb));
|
||||
},
|
||||
restoreOriginal = function () {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colorpicker').origColor;
|
||||
cal.data('colorpicker').color = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
};
|
||||
return {
|
||||
init: function (opt) {
|
||||
opt = $.extend({}, defaults, opt||{});
|
||||
if (typeof opt.color == 'string') {
|
||||
opt.color = HexToHSB(opt.color);
|
||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
||||
opt.color = RGBToHSB(opt.color);
|
||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
||||
opt.color = fixHSB(opt.color);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function () {
|
||||
if (!$(this).data('colorpickerId')) {
|
||||
var options = $.extend({}, opt);
|
||||
options.origColor = opt.color;
|
||||
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
||||
$(this).data('colorpickerId', id);
|
||||
var cal = $(tpl).attr('id', id);
|
||||
if (options.flat) {
|
||||
cal.appendTo(this).show();
|
||||
} else {
|
||||
cal.appendTo(document.body);
|
||||
}
|
||||
options.fields = cal
|
||||
.find('input')
|
||||
.on('keyup', keyDown)
|
||||
.on('change', change)
|
||||
.on('blur', blur)
|
||||
.on('focus', focus);
|
||||
cal
|
||||
.find('span').on('mousedown', downIncrement).end()
|
||||
.find('>div.colorpicker_current_color').on('click', restoreOriginal);
|
||||
options.selector = cal.find('div.colorpicker_color').on('mousedown', downSelector);
|
||||
options.selectorIndic = options.selector.find('div div');
|
||||
options.el = this;
|
||||
options.hue = cal.find('div.colorpicker_hue div');
|
||||
cal.find('div.colorpicker_hue').on('mousedown', downHue);
|
||||
options.newColor = cal.find('div.colorpicker_new_color');
|
||||
options.currentColor = cal.find('div.colorpicker_current_color');
|
||||
cal.data('colorpicker', options);
|
||||
cal.find('div.colorpicker_submit')
|
||||
.on('mouseenter', enterSubmit)
|
||||
.on('mouseleave', leaveSubmit)
|
||||
.on('click', clickSubmit);
|
||||
fillRGBFields(options.color, cal.get(0));
|
||||
fillHSBFields(options.color, cal.get(0));
|
||||
fillHexFields(options.color, cal.get(0));
|
||||
setHue(options.color, cal.get(0));
|
||||
setSelector(options.color, cal.get(0));
|
||||
setCurrentColor(options.color, cal.get(0));
|
||||
setNewColor(options.color, cal.get(0));
|
||||
if (options.flat) {
|
||||
cal.css({
|
||||
position: 'relative',
|
||||
display: 'block'
|
||||
});
|
||||
} else {
|
||||
$(this).on(options.eventName, show);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showPicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
show.apply(this);
|
||||
}
|
||||
});
|
||||
},
|
||||
hidePicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colorpickerId')) {
|
||||
$('#' + $(this).data('colorpickerId')).hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
setColor: function(col) {
|
||||
if (typeof col == 'string') {
|
||||
col = HexToHSB(col);
|
||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||
col = RGBToHSB(col);
|
||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||
col = fixHSB(col);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function(){
|
||||
if ($(this).data('colorpickerId')) {
|
||||
var cal = $('#' + $(this).data('colorpickerId'));
|
||||
cal.data('colorpicker').color = col;
|
||||
cal.data('colorpicker').origColor = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setCurrentColor(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
$.fn.extend({
|
||||
ColorPicker: ColorPicker.init,
|
||||
ColorPickerHide: ColorPicker.hidePicker,
|
||||
ColorPickerShow: ColorPicker.showPicker,
|
||||
ColorPickerSetColor: ColorPicker.setColor
|
||||
});
|
||||
})(jQuery)
|
50
wp-content/themes/Divi/core/admin/js/common.js
Normal file
50
wp-content/themes/Divi/core/admin/js/common.js
Normal file
@@ -0,0 +1,50 @@
|
||||
(function($){
|
||||
$(function(){
|
||||
var user_agent = navigator.userAgent;
|
||||
var is_opera_edge;
|
||||
var browser = user_agent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))/i) || [];
|
||||
var browser_name = '';
|
||||
var browser_class = '';
|
||||
|
||||
if ( /trident/i.test( browser[0] ) ) {
|
||||
browser_name = 'ie';
|
||||
} else if ( browser[0] === 'Chrome' ) {
|
||||
is_opera_edge = user_agent.match(/\b(OPR|Edge)/);
|
||||
|
||||
if ( is_opera_edge !== null ) {
|
||||
browser_name = is_opera_edge[0].replace('OPR', 'opera');
|
||||
}
|
||||
}
|
||||
|
||||
// use navigator.appName as browser name if we were unable to get it from user_agent
|
||||
if ( '' === browser_name ) {
|
||||
if ('standalone' in window.navigator && !window.navigator.standalone) {
|
||||
browser_name = 'uiwebview';
|
||||
} else {
|
||||
browser_name = browser[0] && '' !== browser[0] ? browser[0] : navigator.appName;
|
||||
}
|
||||
}
|
||||
|
||||
browser_name = browser_name.toLowerCase();
|
||||
|
||||
// convert browser name to class. Some classes do not match the browser name
|
||||
switch( browser_name ) {
|
||||
case 'msie' :
|
||||
browser_class = 'ie';
|
||||
break;
|
||||
case 'firefox' :
|
||||
browser_class = 'gecko';
|
||||
break;
|
||||
default :
|
||||
browser_class = browser_name;
|
||||
break;
|
||||
}
|
||||
|
||||
// add `iphone` class if browsing from iphone
|
||||
if ( user_agent.match(/iPhone/) ) {
|
||||
browser_class += ' iphone';
|
||||
}
|
||||
|
||||
$( 'body' ).addClass( browser_class );
|
||||
});
|
||||
})(jQuery);
|
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Compatibility Warning Scripts.
|
||||
*
|
||||
* The scripts below is used for overriding or modifying default WP template to show
|
||||
* warning about WP and PHP versions compatibility with user's environment.
|
||||
*
|
||||
* @see {ET_Core_Compatibility_Warning()}
|
||||
*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
// Bail early if there is no compatibility warning data.
|
||||
if (!window.et_compatibility_warning) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = et_compatibility_warning;
|
||||
|
||||
// A. Update Core.
|
||||
if (data.update_core_data) {
|
||||
if (data.update_core_data.plugins) {
|
||||
// Plugins - Override updates table body.
|
||||
var pluginsTableBody = window.wp.template('et-update-core-plugins-table-body');
|
||||
$('#update-plugins-table .plugins').html(pluginsTableBody(data.update_core_data));
|
||||
}
|
||||
|
||||
if (data.update_core_data.themes) {
|
||||
// Themes - Override updates table body.
|
||||
var themesTableBody = window.wp.template('et-update-core-themes-table-body');
|
||||
$('#update-themes-table .plugins').html(themesTableBody(data.update_core_data));
|
||||
}
|
||||
}
|
||||
|
||||
// B. Manage Themes.
|
||||
if (data.manage_themes_data) {
|
||||
// Themes List & Details - Remove default templates, so we can replace them later.
|
||||
$('#tmpl-theme').remove();
|
||||
$('#tmpl-theme-single').remove();
|
||||
}
|
||||
|
||||
// C. Theme Customizer.
|
||||
if (data.customizer_data) {
|
||||
// Active Theme - Disable publish button.
|
||||
if (true !== data.customizer_data.compatible_wp || true !== data.customizer_data.compatible_php) {
|
||||
var $save = $('#customize-controls #save');
|
||||
var $publishSettings = $('#customize-controls #publish-settings');
|
||||
|
||||
if ($publishSettings.length > 0) {
|
||||
$save.remove();
|
||||
$publishSettings
|
||||
.removeAttr('id')
|
||||
.attr('class', 'button button-primary disabled')
|
||||
.text(data.customizer_data.disabled_text);
|
||||
} else {
|
||||
$save
|
||||
.removeAttr('id')
|
||||
.attr('class', 'button button-primary disabled')
|
||||
.attr('value', data.customizer_data.disabled_text)
|
||||
.text(data.customizer_data.disabled_text);
|
||||
}
|
||||
}
|
||||
|
||||
// Themes List & Details - Remove default templates, so we can replace them later.
|
||||
$('#tmpl-customize-control-theme-content').remove();
|
||||
}
|
||||
})(jQuery);
|
212
wp-content/themes/Divi/core/admin/js/core.js
Normal file
212
wp-content/themes/Divi/core/admin/js/core.js
Normal file
@@ -0,0 +1,212 @@
|
||||
(function($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var top_window = window;
|
||||
var is_iframe = false;
|
||||
|
||||
if (window.top && window.top.__Cypress__) {
|
||||
if (window.parent === window.top) {
|
||||
top_window = window;
|
||||
is_iframe = false;
|
||||
|
||||
} else {
|
||||
top_window = window.parent;
|
||||
is_iframe = true;
|
||||
}
|
||||
|
||||
} else if (window.top) {
|
||||
top_window = window.top;
|
||||
is_iframe = window.top !== window.self;
|
||||
}
|
||||
|
||||
// Extend etCore since it is declared by localization.
|
||||
$.extend( etCore, {
|
||||
|
||||
init: function() {
|
||||
this.tabs();
|
||||
this.listen();
|
||||
},
|
||||
|
||||
$selector: function(selector) {
|
||||
return top_window.jQuery(selector);
|
||||
},
|
||||
|
||||
applyMaxHeight: function() {
|
||||
var $et_core_modal_overlay = this.$selector('.et-core-modal-overlay');
|
||||
var $et_core_modal = $et_core_modal_overlay.find('.et-core-modal');
|
||||
var overlay_height = $et_core_modal_overlay.innerHeight();
|
||||
var no_scroll_fix = !$et_core_modal_overlay.hasClass('et-core-modal-overlay-scroll-fix');
|
||||
var disabled_scrollbar_class = 'et-core-modal-disabled-scrollbar';
|
||||
var et_core_modal_height;
|
||||
|
||||
if ( ! $et_core_modal_overlay.length || ! $et_core_modal_overlay.hasClass('et-core-active') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (no_scroll_fix) {
|
||||
$et_core_modal_overlay.addClass( disabled_scrollbar_class );
|
||||
}
|
||||
|
||||
if ($et_core_modal_overlay.hasClass(disabled_scrollbar_class)) {
|
||||
et_core_modal_height = $et_core_modal.innerHeight();
|
||||
} else {
|
||||
var content_height = Math.max($et_core_modal.find('.et-core-modal-content > *').height());
|
||||
var header_height = $et_core_modal_overlay.find('.et-core-modal-header').outerHeight() || 0;
|
||||
var buttons_height = $et_core_modal_overlay.find('.et_pb_prompt_buttons').outerHeight() || 0;
|
||||
et_core_modal_height = header_height + buttons_height + content_height + 60 - 23;
|
||||
}
|
||||
|
||||
if ( et_core_modal_height > ( overlay_height * 0.6 ) ) {
|
||||
$et_core_modal_overlay.removeClass( disabled_scrollbar_class );
|
||||
|
||||
$et_core_modal.css( 'marginTop', '0' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$et_core_modal_overlay.addClass(disabled_scrollbar_class);
|
||||
$et_core_modal.css( 'marginTop', '-' + ( et_core_modal_height / 2 ) + 'px' );
|
||||
},
|
||||
|
||||
listen: function() {
|
||||
var $this = this;
|
||||
|
||||
$( document ).on( 'click', '[data-et-core-modal]', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $button = $(this),
|
||||
$overlay = $( $button.data( 'et-core-modal' ) );
|
||||
|
||||
if ( $button.hasClass( 'et-core-disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this.modalOpen($overlay);
|
||||
} );
|
||||
|
||||
$( document ).on( 'click', '[data-et-core-modal="close"], .et-core-modal-overlay', function( e ) {
|
||||
if ($(this).data('et-core-disable-closing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this.modalClose( e, this );
|
||||
} );
|
||||
|
||||
// Distroy listener to make sure it is only called once.
|
||||
$this.listen = function() {};
|
||||
},
|
||||
|
||||
modalOpen: function($overlay) {
|
||||
$overlay.addClass('et-core-active');
|
||||
$('body').addClass('et-core-nbfc');
|
||||
$(window).trigger('et-core-modal-active');
|
||||
},
|
||||
|
||||
modalClose: function( e, self ) {
|
||||
// Prevent default and propagation.
|
||||
if ( e && self ) {
|
||||
var $element = $( self );
|
||||
|
||||
if ( self !== e.target ) {
|
||||
return;
|
||||
} else {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
$( '.et-core-modal-overlay.et-core-active' ).addClass( 'et-core-closing' ).delay( 600 ).queue( function() {
|
||||
var $overlay = $( this );
|
||||
|
||||
$overlay.removeClass( 'et-core-active et-core-closing' ).dequeue();
|
||||
$( 'body' ).removeClass( 'et-core-nbfc');
|
||||
$overlay.find( '.et-core-modal' ).removeAttr( 'style' );
|
||||
} );
|
||||
},
|
||||
|
||||
modalTitle: function( text ) {
|
||||
$( '.et-core-modal-overlay.et-core-active .et-core-modal-title' ).html( text );
|
||||
},
|
||||
|
||||
modalContent: function( text, replace, remove, parent ) {
|
||||
var parent = parent ? parent + ' ' : '',
|
||||
$modal = $( '.et-core-modal-overlay.et-core-active' ),
|
||||
$content = $modal.find( parent + '.et-core-modal-content' ),
|
||||
tempContent = parent + '.et-core-modal-temp-content',
|
||||
contentHeight = $content.height();
|
||||
|
||||
if ( replace ) {
|
||||
$content.html( text );
|
||||
} else {
|
||||
var displayTempContent = function() {
|
||||
var removeContent = function( delay ) {
|
||||
$content.delay( delay ).queue( function() {
|
||||
$modal.find( tempContent ).fadeOut( 200, function() {
|
||||
$content.fadeIn( 200 );
|
||||
$( this ).remove();
|
||||
} );
|
||||
$( this ).dequeue();
|
||||
} );
|
||||
}
|
||||
|
||||
if ( true === remove ) {
|
||||
text = text + '<p><a class="et-core-modal-remove-temp-content" href="#">' + etCore.text.modalTempContentCheck + '</a></p>';
|
||||
}
|
||||
|
||||
$content.stop().fadeOut( 200, function() {
|
||||
$( this ).before( '<div class="et-core-modal-temp-content"><div>' + text + '</div></div>' );
|
||||
$modal.find( tempContent ).height( contentHeight ).hide().fadeIn( 200 );
|
||||
$modal.find('.et-core-modal-remove-temp-content').on('click', function(e) {
|
||||
removeContent(0);
|
||||
});
|
||||
} );
|
||||
|
||||
if ( $.isNumeric( remove ) ) {
|
||||
removeContent( remove );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $modal.find( tempContent ).length > 0 ) {
|
||||
$modal.find( tempContent ).fadeOut( 200, function() {
|
||||
$( this ).remove();
|
||||
displayTempContent();
|
||||
} );
|
||||
} else {
|
||||
displayTempContent();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tabs: function() {
|
||||
$( '[data-et-core-tabs]' ).tabs( {
|
||||
fx: {
|
||||
opacity: 'toggle',
|
||||
duration:'fast'
|
||||
},
|
||||
selected: 0,
|
||||
beforeActivate: function( event, ui ) {
|
||||
ui.newPanel.addClass( 'et-core-tabs-transition' );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
} );
|
||||
|
||||
setTimeout(function() {
|
||||
if ($('.wrap.woocommerce').length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(window).on('et-core-modal-active', function() {
|
||||
etCore.applyMaxHeight();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
etCore.init();
|
||||
});
|
||||
|
||||
$(window).on('resize', function() {
|
||||
etCore.applyMaxHeight();
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
10
wp-content/themes/Divi/core/admin/js/es6-promise.auto.min.js
vendored
Normal file
10
wp-content/themes/Divi/core/admin/js/es6-promise.auto.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
51
wp-content/themes/Divi/core/admin/js/eye.js
Normal file
51
wp-content/themes/Divi/core/admin/js/eye.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
*
|
||||
* Zoomimage
|
||||
* Author: Stefan Petre www.eyecon.ro
|
||||
*
|
||||
*/
|
||||
(function($){
|
||||
var EYE = window.EYE = function() {
|
||||
var _registered = {
|
||||
init: []
|
||||
};
|
||||
return {
|
||||
init: function() {
|
||||
$.each(_registered.init, function(nr, fn){
|
||||
fn.call();
|
||||
});
|
||||
},
|
||||
extend: function(prop) {
|
||||
for (var i in prop) {
|
||||
if (prop[i] != undefined) {
|
||||
this[i] = prop[i];
|
||||
}
|
||||
}
|
||||
},
|
||||
register: function(fn, type) {
|
||||
if (!_registered[type]) {
|
||||
_registered[type] = [];
|
||||
}
|
||||
_registered[type].push(fn);
|
||||
}
|
||||
};
|
||||
}();
|
||||
$(EYE.init);
|
||||
})(jQuery);
|
||||
|
||||
(function($){
|
||||
var initLayout = function() {
|
||||
$('#colorpickerHolder').ColorPicker({flat: true});
|
||||
$('.colorpopup').ColorPicker({
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
$(el).ColorPickerHide();
|
||||
},
|
||||
onBeforeShow: function () {
|
||||
$(this).ColorPickerSetColor(this.value);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
EYE.register(initLayout, 'init');
|
||||
})(jQuery);
|
47
wp-content/themes/Divi/core/admin/js/frame-helpers.js
Normal file
47
wp-content/themes/Divi/core/admin/js/frame-helpers.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ,-,-
|
||||
/ / |
|
||||
,-' _/ / /
|
||||
(-_ _,-' `Z_/
|
||||
"#: ,-'_,-. \ _
|
||||
#' _(_-'_()\ \" |
|
||||
,--_,--' |
|
||||
/ "" L-'\
|
||||
\,--^---v--v-._ / \ |
|
||||
\_________________,-' |
|
||||
\
|
||||
\
|
||||
\
|
||||
NOTE: The code in this file will be executed multiple times! */
|
||||
|
||||
let top_window = window;
|
||||
let is_iframe = false;
|
||||
let top;
|
||||
|
||||
try {
|
||||
// Have to access top window's prop (document) to trigger same-origin DOMException
|
||||
// so we can catch it and act accordingly.
|
||||
top = window.top.document ? window.top : false;
|
||||
} catch(e) {
|
||||
// Can't access top, it means we're inside a different domain iframe.
|
||||
top = false;
|
||||
}
|
||||
|
||||
if (top && top.__Cypress__) {
|
||||
if (window.parent === top) {
|
||||
top_window = window;
|
||||
is_iframe = false;
|
||||
|
||||
} else {
|
||||
top_window = window.parent;
|
||||
is_iframe = true;
|
||||
}
|
||||
|
||||
} else if (top) {
|
||||
top_window = top;
|
||||
is_iframe = top !== window.self;
|
||||
}
|
||||
|
||||
export {
|
||||
top_window,
|
||||
is_iframe,
|
||||
};
|
278
wp-content/themes/Divi/core/admin/js/functions-init.js
Normal file
278
wp-content/themes/Divi/core/admin/js/functions-init.js
Normal file
@@ -0,0 +1,278 @@
|
||||
/* <![CDATA[ */
|
||||
var clearpath = ePanelishSettings.clearpath;
|
||||
|
||||
jQuery(function($) {
|
||||
var editors = [];
|
||||
|
||||
function addEditorInstance( codeEditor, $element, config ) {
|
||||
if ( !$element || $element.length === 0 ) {
|
||||
return;
|
||||
}
|
||||
var instance = codeEditor.initialize( $element, {
|
||||
codemirror: config
|
||||
} );
|
||||
if ( instance && instance.codemirror ) {
|
||||
editors.push( instance.codemirror );
|
||||
}
|
||||
}
|
||||
|
||||
// Use WP 4.9 CodeMirror Editor for Custom CSS
|
||||
var codeEditor = window.wp && window.wp.codeEditor;
|
||||
if ( codeEditor && codeEditor.initialize && codeEditor.defaultSettings && codeEditor.defaultSettings.codemirror ) {
|
||||
|
||||
// User ET CodeMirror theme
|
||||
var configCSS = $.extend( {}, codeEditor.defaultSettings.codemirror, {
|
||||
theme: 'et'
|
||||
} );
|
||||
var configHTML = $.extend( {}, configCSS, {
|
||||
mode: 'htmlmixed'
|
||||
} );
|
||||
|
||||
if ( $( '#divi_custom_css' ).length > 0 ) {
|
||||
// Divi Theme
|
||||
addEditorInstance( codeEditor, $( '#divi_custom_css' ), configCSS );
|
||||
addEditorInstance( codeEditor, $( '#divi_integration_head' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#divi_integration_body' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#divi_integration_single_top' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#divi_integration_single_bottom' ), configHTML );
|
||||
} else if ( $( '#extra_custom_css' ).length > 0 ) {
|
||||
// Extra Theme
|
||||
addEditorInstance( codeEditor, $( '#extra_custom_css' ), configCSS );
|
||||
addEditorInstance( codeEditor, $( '#extra_integration_head' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#extra_integration_body' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#extra_integration_single_top' ), configHTML );
|
||||
addEditorInstance( codeEditor, $( '#extra_integration_single_bottom' ), configHTML );
|
||||
}
|
||||
}
|
||||
|
||||
var $palette_inputs = $( '.et_color_palette_main_input' );
|
||||
|
||||
$( '#epanel-content,#epanel-content > div' ).tabs( {
|
||||
fx: {
|
||||
opacity: 'toggle',
|
||||
duration: 'fast'
|
||||
},
|
||||
selected: 0,
|
||||
activate: function( event, ui ) {
|
||||
$epanel = $( '#epanel' );
|
||||
|
||||
if ( $epanel.hasClass( 'onload' ) ) {
|
||||
$epanel.removeClass( 'onload' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
$('.et-box-description').on('click', function(){
|
||||
var descheading = $( this ).parent( '.et-epanel-box' ).find( ".et-box-title h3" ).html();
|
||||
var desctext = $( this ).parent( '.et-epanel-box' ).find( ".et-box-title .et-box-descr" ).html();
|
||||
|
||||
$( 'body' ).append( "<div id='custom-lbox'><div class='et-box-desc'><div class='et-box-desc-top'>" + ePanelishSettings.help_label + "</div><div class='et-box-desc-content'><h3>" + descheading + "</h3>" + desctext + "<div class='et-lightbox-close'></div> </div> <div class='et-box-desc-bottom'></div> </div></div>" );
|
||||
|
||||
et_pb_center_modal( $( '.et-box-desc' ) );
|
||||
|
||||
$('.et-lightbox-close').on('click', function(){
|
||||
et_pb_close_modal( $( '#custom-lbox' ) );
|
||||
});
|
||||
});
|
||||
|
||||
$('.et-defaults-button.epanel-reset').on('click', function(e){
|
||||
e.preventDefault();
|
||||
$( ".reset-popup-overlay, .defaults-hover" ).addClass( 'active' );
|
||||
|
||||
et_pb_center_modal( $( '.defaults-hover' ) );
|
||||
});
|
||||
|
||||
$('.no').on('click', function(){
|
||||
et_pb_close_modal( $( '.reset-popup-overlay' ), 'no_remove' );
|
||||
|
||||
//clean the modal classes when animation complete
|
||||
setTimeout( function() {
|
||||
$( '.reset-popup-overlay, .defaults-hover' ).removeClass( 'active et_pb_modal_closing' );
|
||||
}, 600 );
|
||||
});
|
||||
|
||||
// ":not([safari])" is desirable but not necessary selector
|
||||
// ":not([safari])" is desirable but not necessary selector
|
||||
$( '#epanel input:checkbox:not([safari]):not(.yes_no_button)' ).checkbox();
|
||||
$( '#epanel input[safari]:checkbox:not(.yes_no_button)' ).checkbox( { cls: 'jquery-safari-checkbox' } );
|
||||
$( '#epanel input:radio:not(.yes_no_button)' ).checkbox();
|
||||
|
||||
// Yes - No button UI
|
||||
$( '.yes_no_button' ).each( function() {
|
||||
var $checkbox = $( this );
|
||||
var value = $checkbox.is( ':checked' );
|
||||
var state = value ? 'et_pb_on_state' : 'et_pb_off_state';
|
||||
var $template = $( $( '#epanel-yes-no-button-template' ).html() ).find( '.et_pb_yes_no_button' ).addClass( state );
|
||||
|
||||
$checkbox.hide().after( $template );
|
||||
} );
|
||||
|
||||
$( '.et-box-content' ).on( 'click', '.et_pb_yes_no_button', function( e ) {
|
||||
e.preventDefault();
|
||||
// Fix for nested .et-box-content triggering checkboxes multiple times.
|
||||
e.stopPropagation();
|
||||
|
||||
var $click_area = $( this );
|
||||
var $box_content = $click_area.closest( '.et-box-content' );
|
||||
var $checkbox = $box_content.find( 'input[type="checkbox"]' );
|
||||
var $state = $box_content.find( '.et_pb_yes_no_button' );
|
||||
|
||||
if ( $state.parent().next().hasClass( 'et_pb_clear_static_css' ) ) {
|
||||
$state = $state.add( $state.parent() );
|
||||
|
||||
if ( $checkbox.is( ':checked' ) ) {
|
||||
$box_content.parent().next().hide();
|
||||
} else {
|
||||
$box_content.parent().next().show();
|
||||
}
|
||||
}
|
||||
|
||||
$state.toggleClass( 'et_pb_on_state et_pb_off_state' );
|
||||
|
||||
if ( $checkbox.is( ':checked' ) ) {
|
||||
$checkbox.prop( 'checked', false );
|
||||
} else {
|
||||
$checkbox.prop( 'checked', true );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
var $save_message = $( "#epanel-ajax-saving" );
|
||||
|
||||
$('#epanel-save-top').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$( '#epanel-save' ).trigger( 'click' );
|
||||
});
|
||||
|
||||
$('#epanel-save').on('click', function() {
|
||||
epanel_save( false, true );
|
||||
return false;
|
||||
});
|
||||
|
||||
function epanel_save( callback, message ) {
|
||||
|
||||
// If CodeMirror is used
|
||||
if ( editors.length > 0 ) {
|
||||
$.each( editors, function( i, editor ) {
|
||||
if ( editor.save ) {
|
||||
// Make sure we store changes into original textarea
|
||||
editor.save();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
var options_fromform = $( '#main_options_form' ).formSerialize();
|
||||
var add_nonce = '&_ajax_nonce=' + ePanelishSettings.epanelish_nonce;
|
||||
|
||||
options_fromform += add_nonce;
|
||||
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: options_fromform,
|
||||
beforeSend: function( xhr ) {
|
||||
if ( message ) {
|
||||
$save_message.removeAttr( 'class' ).fadeIn( 'fast' );
|
||||
}
|
||||
},
|
||||
success: function( response ) {
|
||||
if ( message ) {
|
||||
$save_message.addClass( 'success-animation' );
|
||||
|
||||
setTimeout( function() {
|
||||
$save_message.fadeOut();
|
||||
}, 500 );
|
||||
}
|
||||
|
||||
if ( 'function' === typeof callback ) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function et_pb_close_modal( $overlay, no_overlay_remove ) {
|
||||
var $modal_container = $overlay;
|
||||
|
||||
// add class to apply the closing animation to modal
|
||||
$modal_container.addClass( 'et_pb_modal_closing' );
|
||||
|
||||
//remove the modal with overlay when animation complete
|
||||
setTimeout( function() {
|
||||
if ( 'no_remove' !== no_overlay_remove ) {
|
||||
$modal_container.remove();
|
||||
}
|
||||
}, 600 );
|
||||
}
|
||||
|
||||
if ( $palette_inputs.length ) {
|
||||
$palette_inputs.each( function() {
|
||||
var $this_input = $( this );
|
||||
var $palette_wrapper = $this_input.closest( '.et-box-content' );
|
||||
var $colorpalette_colorpickers = $palette_wrapper.find( '.input-colorpalette-colorpicker' );
|
||||
var colorpalette_colorpicker_index = 0;
|
||||
var saved_palette = $this_input.val().split( '|' );
|
||||
|
||||
$colorpalette_colorpickers.each( function() {
|
||||
var $colorpalette_colorpicker = $( this );
|
||||
var colorpalette_colorpicker_color = saved_palette[colorpalette_colorpicker_index];
|
||||
|
||||
$colorpalette_colorpicker.val( colorpalette_colorpicker_color ).wpColorPicker( {
|
||||
hide: false,
|
||||
default: $( this ).data( 'default-color' ),
|
||||
width: 313,
|
||||
palettes: false,
|
||||
change: function( event, ui ) {
|
||||
var $input = $( this );
|
||||
var data_index = $input.attr( 'data-index' );
|
||||
var $preview = $palette_wrapper.find( '.colorpalette-item-' + data_index + ' .color' );
|
||||
var color = ui.color.toString();
|
||||
|
||||
$input.val( color );
|
||||
$preview.css( { 'backgroundColor': color } );
|
||||
saved_palette[data_index - 1] = color;
|
||||
$this_input.val( saved_palette.join( '|' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
$colorpalette_colorpicker.trigger( 'change' );
|
||||
|
||||
colorpalette_colorpicker_index++;
|
||||
} );
|
||||
|
||||
$palette_wrapper.on( 'click', '.colorpalette-item', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $colorpalette_item = $( this );
|
||||
var data_index = $colorpalette_item.attr( 'data-index' );
|
||||
|
||||
// Hide other colorpalette colorpicker
|
||||
$palette_wrapper.find( '.colorpalette-colorpicker' ).removeClass( 'active' );
|
||||
|
||||
// Display selected colorpalette colorpicker
|
||||
$palette_wrapper.find( '.colorpalette-colorpicker[data-index="' + data_index + '"]' ).addClass( 'active' );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( typeof etCore !== 'undefined' && typeof etCore.portability !== 'undefined' ) {
|
||||
// Portability integration.
|
||||
etCore.portability.save = function( callback ) {
|
||||
epanel_save( callback, false );
|
||||
};
|
||||
}
|
||||
|
||||
function et_pb_center_modal( $modal ) {
|
||||
var modal_height = $modal.outerHeight();
|
||||
var modal_height_adjustment = (0 - (modal_height / 2)) + 'px';
|
||||
|
||||
$modal.css( {
|
||||
top: '50%',
|
||||
bottom: 'auto',
|
||||
marginTop: modal_height_adjustment
|
||||
} );
|
||||
}
|
||||
|
||||
} );
|
||||
/* ]]> */
|
1
wp-content/themes/Divi/core/admin/js/page-resource-fallback.min.js
vendored
Normal file
1
wp-content/themes/Divi/core/admin/js/page-resource-fallback.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function et_core_page_resource_fallback(a,b){"undefined"===typeof b&&(b=a.sheet.cssRules&&0===a.sheet.cssRules.length);b&&(a.onerror=null,a.onload=null,a.href?a.href=et_site_url+"/?et_core_page_resource="+a.id+et_post_id:a.src&&(a.src=et_site_url+"/?et_core_page_resource="+a.id+et_post_id))}
|
5
wp-content/themes/Divi/core/admin/js/popper.min.js
vendored
Normal file
5
wp-content/themes/Divi/core/admin/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1108
wp-content/themes/Divi/core/admin/js/portability.js
Normal file
1108
wp-content/themes/Divi/core/admin/js/portability.js
Normal file
File diff suppressed because it is too large
Load Diff
66
wp-content/themes/Divi/core/admin/js/recaptcha.js
Normal file
66
wp-content/themes/Divi/core/admin/js/recaptcha.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* NOTE: A minified copy of this script will be generated by grunt. Only the minified file will be included in zipped releases.
|
||||
*
|
||||
* @file Handles reCAPTCHA on the frontend.
|
||||
* @since 4.0.7
|
||||
*/
|
||||
|
||||
|
||||
(function($) {
|
||||
window.etCore = window.etCore || {};
|
||||
window.etCore.api = window.etCore.api || {};
|
||||
window.etCore.api.spam = window.etCore.api.spam || {};
|
||||
|
||||
/**
|
||||
* Recaptcha
|
||||
*
|
||||
* @since??
|
||||
*
|
||||
* @memberof window.etCore.api.spam
|
||||
*/
|
||||
window.etCore.api.spam.recaptcha = $.extend( et_core_api_spam_recaptcha, {
|
||||
|
||||
_bindMethods: function(target) {
|
||||
Object.keys(target).forEach(function(prop) {
|
||||
if (target.hasOwnProperty(prop) && 'function' === typeof target[prop]) {
|
||||
target[prop] = target[prop].bind(target);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
init: function() {
|
||||
this._bindMethods(this);
|
||||
|
||||
if (this.isEnabled()) {
|
||||
// Execute the default page-level action
|
||||
window.grecaptcha && grecaptcha.execute(this.site_key, this.page_action);
|
||||
}
|
||||
},
|
||||
|
||||
isEnabled: function() {
|
||||
return !! (this.site_key && window.grecaptcha);
|
||||
},
|
||||
|
||||
/**
|
||||
* Score an interaction to determine whether or not it's a bot.
|
||||
*
|
||||
* @since 4.0.7
|
||||
*
|
||||
* @param {string} action The name of the action being performed.
|
||||
*
|
||||
* @return {Promise<string>} Interaction token to be verified on server.
|
||||
*/
|
||||
interaction: function(action) {
|
||||
if (! this.isEnabled()) {
|
||||
return Promise.resolve('');
|
||||
}
|
||||
|
||||
return grecaptcha.execute(this.site_key, { action: action });
|
||||
}
|
||||
} );
|
||||
|
||||
window.grecaptcha && grecaptcha.ready(function() {
|
||||
window.etCore.api.spam.recaptcha.init();
|
||||
});
|
||||
|
||||
})(jQuery);
|
567
wp-content/themes/Divi/core/admin/js/support-center.js
Normal file
567
wp-content/themes/Divi/core/admin/js/support-center.js
Normal file
@@ -0,0 +1,567 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
var docPlayer;
|
||||
var resizeTimer;
|
||||
var showHideDelay = 300;
|
||||
var removeDelay = 500;
|
||||
var logViewers = [];
|
||||
var supportUserID = etSupportCenter.supportUserID || null;
|
||||
var debugLogViewer = window.wp && window.wp.codeEditor;
|
||||
var $save_message = $('#epanel-ajax-saving');
|
||||
var $etSystemStatusTable = $('.et_system_status');
|
||||
var $etSupportUserToggle = $('.et_support_user_toggle .et_pb_yes_no_button');
|
||||
var $et_documentation_videos_list_li = $('.et_documentation_videos_list li');
|
||||
var $modalSafeModeWarningTemplate = $('#et-ajax-safe-mode-template').html();
|
||||
|
||||
function confirmClipboardCopy() {
|
||||
$save_message.addClass('success-animation').fadeIn('fast');
|
||||
$save_message.fadeOut('slow');
|
||||
}
|
||||
|
||||
// Remote Access: Toggle ET Support User On/Off
|
||||
function supportUserActivationToggle($toggle, newState, silentMode) {
|
||||
|
||||
// If Silent Mode is `true` then we'll run AJAX without rendering display changes
|
||||
silentMode = silentMode || false;
|
||||
|
||||
if (typeof newState === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var postData = {
|
||||
action: 'et_support_user_update',
|
||||
nonce: etSupportCenter.nonce
|
||||
};
|
||||
|
||||
switch (newState) {
|
||||
case 'activate':
|
||||
postData.support_update = 'activate';
|
||||
break;
|
||||
case 'deactivate':
|
||||
postData.support_update = 'deactivate';
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Ajax toggle ET Support User
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
dataType: 'json',
|
||||
url: etSupportCenter.ajaxURL,
|
||||
action: 'support_user_update_via_ajax',
|
||||
beforeSend: function(xhr) {
|
||||
// Don't execute DOM changes in Silent Mode
|
||||
if (silentMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.et-remote-access-error').first().hide(showHideDelay);
|
||||
$save_message.addClass('et_loading').removeClass('success-animation');
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function(response) {
|
||||
// Don't execute DOM changes in Silent Mode
|
||||
if (silentMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$save_message.removeClass('et_loading').removeClass('success-animation');
|
||||
|
||||
setTimeout(function() {
|
||||
$save_message.fadeOut('slow');
|
||||
}, removeDelay);
|
||||
var $msgExpiry = $('.et-support-user-expiry').first();
|
||||
if ('activate' === postData.support_update) {
|
||||
if (response.error) {
|
||||
$('.et-remote-access-error').first().text(response.error).show(showHideDelay);
|
||||
return;
|
||||
}
|
||||
$('#et-remote-access-error').remove();
|
||||
$toggle.removeClass('et_pb_off_state').addClass('et_pb_on_state');
|
||||
$msgExpiry.attr('data-expiry', response.expiry);
|
||||
supportUserTimeToExpiry();
|
||||
$msgExpiry.show(showHideDelay);
|
||||
$('.et-support-user-elevated').show(showHideDelay);
|
||||
$('.card.et_remote_access .et_card_cta').append(
|
||||
$('<a>')
|
||||
.attr({
|
||||
'class': 'copy_support_token',
|
||||
'data-token': response.token
|
||||
})
|
||||
.text('Copy Support Token')
|
||||
);
|
||||
} else if ('deactivate' === postData.support_update) {
|
||||
// First switch & hide the "elevated" toggle
|
||||
// (not a click event because we don't need to trigger AJAX)
|
||||
$('.et-support-user-elevated').hide(showHideDelay);
|
||||
$('.et_support_user_elevated_toggle .et_pb_yes_no_button').removeClass('et_pb_on_state').addClass('et_pb_off_state');
|
||||
// Now clean up the Remote Access toggle
|
||||
$msgExpiry.hide(showHideDelay);
|
||||
$toggle.removeClass('et_pb_on_state').addClass('et_pb_off_state');
|
||||
$('.copy_support_token').fadeOut('slow');
|
||||
setTimeout(function() {
|
||||
$('.copy_support_token').remove();
|
||||
}, removeDelay);
|
||||
}
|
||||
$save_message.addClass('success-animation');
|
||||
}
|
||||
}).fail(function(data) {
|
||||
console.log(data.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
// Remote Access: Calculate of Time To Auto-Deactivation
|
||||
function supportUserTimeToExpiry() {
|
||||
if (! $('.et_support_user_toggle .et_pb_on_state').length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $supportUserExpiry = $('.et-support-user-expiry').first();
|
||||
var expiry = parseInt($supportUserExpiry.attr('data-expiry'));
|
||||
var timeToExpiry = (expiry - (new Date().getTime() / 1000));
|
||||
var $timer = $supportUserExpiry.find('.support-user-time-to-expiry').first();
|
||||
var timerContent = '';
|
||||
var days = 0;
|
||||
var hours = 0;
|
||||
var minutes = 0;
|
||||
|
||||
if (30 >= timeToExpiry) {
|
||||
// Don't bother calculating; expiration will happen before the next check, so let's trigger deactivation now.
|
||||
$timer.html('0 minutes');
|
||||
// Go ahead and turn off the user (don't need to wait for WP Cron)
|
||||
$etSupportUserToggle.trigger('click');
|
||||
return;
|
||||
}
|
||||
|
||||
days = parseInt(timeToExpiry / 86400);
|
||||
days = days > 0 ? days : 0;
|
||||
timeToExpiry = timeToExpiry % 86400;
|
||||
|
||||
hours = parseInt(timeToExpiry / 3600);
|
||||
hours = hours > 0 ? hours : 0;
|
||||
timeToExpiry = timeToExpiry % 3600;
|
||||
|
||||
minutes = parseInt(timeToExpiry / 60);
|
||||
minutes = minutes > 0 ? minutes : 0;
|
||||
|
||||
if (0 < days) {
|
||||
timerContent = timerContent + days + (1 < days ? ' days, ' : ' day, ');
|
||||
}
|
||||
|
||||
if (0 < hours) {
|
||||
timerContent = timerContent + hours + (1 < hours ? ' hours, ' : ' hour, ');
|
||||
}
|
||||
|
||||
timerContent = timerContent + minutes + (1 !== minutes ? ' minutes' : ' minute');
|
||||
|
||||
$timer.html(timerContent);
|
||||
}
|
||||
|
||||
// Documentation: Recalculate video dimensions (typically on viewport resize)
|
||||
function et_core_correct_video_proportions() {
|
||||
var parentHeight = (parseInt($('.et_docs_videos').first().width()) * .5625) + 'px';
|
||||
$('.et_docs_videos .wrapper').css('max-height', parentHeight);
|
||||
$('.et_docs_videos iframe').css('max-height', parentHeight);
|
||||
}
|
||||
|
||||
// Documentation: Initialize YouTube Iframe player
|
||||
function loadYouTubeIframe() {
|
||||
if (('undefined' !== typeof YT) && YT && YT.Player) {
|
||||
// Default video: 'Getting Started With The Divi Builder'
|
||||
var firstVideo = 'T-Oe01_J62c';
|
||||
var $firstVideoItem = $('.et_docs_videos li:first-of-type');
|
||||
|
||||
// If the Documentation videos list has YouTube IDs, grab the first one
|
||||
if ($firstVideoItem.length > 0 && $firstVideoItem[0].hasAttribute('data-ytid')) {
|
||||
firstVideo = $firstVideoItem.attr('data-ytid');
|
||||
}
|
||||
|
||||
docPlayer = new YT.Player('et_documentation_player', {
|
||||
videoId: firstVideo,
|
||||
height: '360',
|
||||
width: '640',
|
||||
showinfo: 0,
|
||||
controls: 0,
|
||||
rel: 0
|
||||
});
|
||||
et_core_correct_video_proportions();
|
||||
} else {
|
||||
setTimeout(loadYouTubeIframe, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Safe Mode: Activate/Deactivate
|
||||
function toggleETSafeMode($toggle) {
|
||||
var postData = {
|
||||
action: 'et_safe_mode_update',
|
||||
nonce: etSupportCenter.nonce
|
||||
};
|
||||
|
||||
if ($toggle.hasClass('et_pb_off_state')) {
|
||||
postData.support_update = 'activate';
|
||||
} else if ($toggle.hasClass('et_pb_on_state') || $toggle.hasClass('et-safe-mode-indicator') || $toggle.hasClass('et-core-modal-action')) {
|
||||
postData.support_update = 'deactivate';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('activate' === postData.support_update) {
|
||||
var safeModeProduct = $toggle.parents('#et_card_safe_mode').data('et-product');
|
||||
|
||||
// Continue only if the product is in our allowlist
|
||||
switch (safeModeProduct) {
|
||||
case 'divi_builder_plugin':
|
||||
case 'divi_theme':
|
||||
case 'extra_theme':
|
||||
case 'monarch_plugin':
|
||||
case 'bloom_plugin':
|
||||
postData.product = safeModeProduct;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Ajax toggle Safe Mode
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
dataType: 'json',
|
||||
url: etSupportCenter.ajaxURL,
|
||||
action: 'safe_mode_update_via_ajax',
|
||||
beforeSend: function(xhr) {
|
||||
$('.et-core-safe-mode-block-modal').removeClass('et-core-active');
|
||||
$save_message.addClass('et_loading').removeClass('success-animation');
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function(response) {
|
||||
$save_message.removeClass('et_loading').addClass('success-animation');
|
||||
var $msgExpiry = $('.et-support-user-expiry').first();
|
||||
if ('activate' === postData.support_update) {
|
||||
$('.et_safe_mode_toggle .et_pb_yes_no_button').removeClass('et_pb_off_state').addClass('et_pb_on_state');
|
||||
} else if ('deactivate' === postData.support_update) {
|
||||
$('.et_safe_mode_toggle .et_pb_yes_no_button').removeClass('et_pb_on_state').addClass('et_pb_off_state');
|
||||
$('.et-safe-mode-indicator').fadeOut('slow');
|
||||
setTimeout(function() {
|
||||
$('.et-safe-mode-indicator').remove();
|
||||
$('.wp-admin').removeClass('et-safe-mode-active');
|
||||
}, removeDelay);
|
||||
}
|
||||
setTimeout(function() {
|
||||
$save_message.fadeOut('slow');
|
||||
window.location.reload(true);
|
||||
}, removeDelay);
|
||||
}
|
||||
}).fail(function(data) {
|
||||
console.log(data.responseText);
|
||||
$save_message.fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
// Safe Mode: Interrupt Actions when Safe Mode is Active
|
||||
function preventActionWhenSafeModeActive() {
|
||||
$('body').append($modalSafeModeWarningTemplate);
|
||||
$('.et-core-safe-mode-block-modal').addClass('et-core-active');
|
||||
$(window).trigger('et-core-modal-active');
|
||||
}
|
||||
|
||||
// Logs: Add CodeMirror Instance with Custom Formatting Rules
|
||||
function addLogViewerInstance(codeEditor, $element, config) {
|
||||
if (! $element || $element.length === 0) {
|
||||
return;
|
||||
}
|
||||
var instance = codeEditor.initialize($element, {
|
||||
codemirror: config,
|
||||
});
|
||||
if (instance && instance.codemirror) {
|
||||
logViewers.push(instance.codemirror);
|
||||
}
|
||||
}
|
||||
|
||||
// Dismiss Card in the Support Center
|
||||
function dismissCard($button) {
|
||||
const postData = {
|
||||
action: 'et_dismiss_support_center_card',
|
||||
nonce: etSupportCenter.nonce,
|
||||
product: $button.data('product'),
|
||||
card_key: $button.data('key'),
|
||||
};
|
||||
|
||||
// Dismiss the Card via AJAX
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
dataType: 'json',
|
||||
url: etSupportCenter.ajaxURL,
|
||||
beforeSend: function(xhr) {
|
||||
$button.prop('disabled', true);
|
||||
$save_message.addClass('et_loading').removeClass('success-animation');
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function(response) {
|
||||
$button.parent().remove();
|
||||
$save_message.removeClass('et_loading').addClass('success-animation');
|
||||
|
||||
setTimeout(function() {
|
||||
$save_message.fadeOut('slow');
|
||||
}, removeDelay);
|
||||
},
|
||||
}).fail(function(data) {
|
||||
$button.prop('disabled', false);
|
||||
console.log(data.responseText);
|
||||
$save_message.fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
$(window).on('resize', function() {
|
||||
resizeTimer = _.debounce(et_core_correct_video_proportions(), showHideDelay);
|
||||
});
|
||||
|
||||
$(function() {
|
||||
/**
|
||||
* Support Center :: System Status
|
||||
*/
|
||||
|
||||
// System Status: display message if all checks passed
|
||||
if (0 === $('.et-system-status-report').children(':not(.et_system_status_pass)').length) {
|
||||
$('.et-system-status-congratulations').show(showHideDelay);
|
||||
}
|
||||
|
||||
// System Status: Show Full Report
|
||||
$('.full_report_show').on('click', function() {
|
||||
$etSystemStatusTable.find('.et_system_status_pass').show(showHideDelay);
|
||||
$etSystemStatusTable.removeClass('summary').addClass('full');
|
||||
});
|
||||
|
||||
// System Status: Show Summary Report
|
||||
$('.full_report_hide').on('click', function() {
|
||||
$etSystemStatusTable.find('.et_system_status_pass').hide(showHideDelay);
|
||||
$etSystemStatusTable.addClass('summary').removeClass('full');
|
||||
});
|
||||
|
||||
// System Status: Copy Full Report to Clipboard
|
||||
$('.full_report_copy').on('click', function() {
|
||||
$('#et_system_status_plain').trigger('select');
|
||||
document.execCommand('copy');
|
||||
confirmClipboardCopy();
|
||||
});
|
||||
|
||||
/**
|
||||
* Support Center :: Remote Access
|
||||
*/
|
||||
if ($('.card.et_remote_access').length > 0) {
|
||||
// Remote Access: Initial Calculation of Time To Auto-Deactivation
|
||||
supportUserTimeToExpiry();
|
||||
|
||||
// Remote Access: Recalculate Time To Auto-Deactivation (every 30 seconds)
|
||||
setInterval(supportUserTimeToExpiry, 30000);
|
||||
|
||||
// Remote Access: Display Auto-Deactivation Countdown
|
||||
if ($etSupportUserToggle.hasClass('et_pb_on_state')) {
|
||||
$('.et-support-user-expiry').first().show(0);
|
||||
} else {
|
||||
// If the Support User account toggle is off, send a quick AJAX request to verify the account is deactivated
|
||||
supportUserActivationToggle($etSupportUserToggle, 'deactivate', true);
|
||||
}
|
||||
|
||||
// Remote Access: Activate/Deactivate
|
||||
$etSupportUserToggle.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($etSupportUserToggle.hasClass('et_pb_off_state')) {
|
||||
supportUserActivationToggle($(this), 'activate');
|
||||
} else if ($etSupportUserToggle.hasClass('et_pb_on_state')) {
|
||||
supportUserActivationToggle($(this), 'deactivate');
|
||||
}
|
||||
});
|
||||
|
||||
// Remote Access: Elevate/Reset Divi Support user role
|
||||
$('.et_support_user_elevated_toggle .et_pb_yes_no_button').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $toggle = $(this);
|
||||
|
||||
var postData = {
|
||||
action: 'et_support_user_update',
|
||||
nonce: etSupportCenter.nonce
|
||||
};
|
||||
|
||||
if ($toggle.hasClass('et_pb_off_state')) {
|
||||
postData.support_update = 'elevate';
|
||||
} else if ($toggle.hasClass('et_pb_on_state')) {
|
||||
postData.support_update = 'activate';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ajax toggle ET Support User Admin Mode
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
dataType: 'json',
|
||||
url: etSupportCenter.ajaxURL,
|
||||
action: 'support_user_update_via_ajax',
|
||||
beforeSend: function(xhr) {
|
||||
$save_message.addClass('et_loading').removeClass('success-animation');
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function(response) {
|
||||
$save_message.removeClass('et_loading').removeClass('success-animation');
|
||||
|
||||
setTimeout(function() {
|
||||
$save_message.fadeOut('slow');
|
||||
}, removeDelay);
|
||||
if ('elevate' === postData.support_update) {
|
||||
$toggle.removeClass('et_pb_off_state').addClass('et_pb_on_state');
|
||||
} else if ('activate' === postData.support_update) {
|
||||
$toggle.removeClass('et_pb_on_state').addClass('et_pb_off_state');
|
||||
}
|
||||
$save_message.addClass('success-animation');
|
||||
}
|
||||
}).fail(function(data) {
|
||||
console.log(data.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// Remote Access: Copy Support Token to clipboard
|
||||
$('body').on('click', '.copy_support_token', function() {
|
||||
var token = $(this).attr('data-token');
|
||||
var $temp = $('<input>');
|
||||
$('body').append($temp);
|
||||
$temp.val(token).trigger('select');
|
||||
document.execCommand('copy');
|
||||
$temp.remove();
|
||||
confirmClipboardCopy();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Support Center :: Documentation & Help
|
||||
*/
|
||||
if ($('body').find('[data-et-page="wp-admin-support-center"]').length > 0) {
|
||||
// Load the IFrame Player API code asynchronously.
|
||||
var tag = document.createElement('script');
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
var firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
loadYouTubeIframe();
|
||||
}
|
||||
|
||||
// Documentation & Help: YouTube Video Navigation
|
||||
$et_documentation_videos_list_li.on('click', function() {
|
||||
var $active = $(this);
|
||||
|
||||
$et_documentation_videos_list_li.removeClass('active');
|
||||
$active.addClass('active');
|
||||
|
||||
docPlayer.cueVideoById($active.attr('data-ytid'), 0, 'large');
|
||||
});
|
||||
|
||||
/**
|
||||
* Support Center :: Safe Mode
|
||||
*/
|
||||
|
||||
if ($save_message.length === 0) {
|
||||
$('body.wp-admin').append(
|
||||
$('<div>').attr({ 'id': 'et-ajax-saving', 'class': 'et_loading' }).append(
|
||||
$('<img>').attr({ 'src': etSupportCenter.ajaxLoaderImg, 'alt': 'loading', 'id': 'loading' })
|
||||
)
|
||||
);
|
||||
$save_message = $('#et-ajax-saving');
|
||||
}
|
||||
|
||||
// Safe Mode: Activate/Deactivate
|
||||
$('body').on('click', '.et-safe-mode-indicator', function(e) {
|
||||
e.preventDefault();
|
||||
var $toggle = $(this);
|
||||
toggleETSafeMode($toggle);
|
||||
});
|
||||
$('body').on('click', '.et_safe_mode_toggle .et_pb_yes_no_button', function(e) {
|
||||
e.preventDefault();
|
||||
var $toggle = $(this);
|
||||
toggleETSafeMode($toggle);
|
||||
});
|
||||
$('body').on('click', '.et-core-safe-mode-block-modal .et-core-modal-action', function(e) {
|
||||
e.preventDefault();
|
||||
var $toggle = $(this);
|
||||
toggleETSafeMode($toggle);
|
||||
});
|
||||
|
||||
// Safe Mode: Interrupt Plugin/Theme Toggles
|
||||
$('body.et-safe-mode-active').on('click', '.theme .activate', function(e) {
|
||||
e.preventDefault();
|
||||
preventActionWhenSafeModeActive();
|
||||
});
|
||||
$('body.et-safe-mode-active').on('click', '.plugins .activate a', function(e) {
|
||||
e.preventDefault();
|
||||
preventActionWhenSafeModeActive();
|
||||
});
|
||||
$('body.et-safe-mode-active').on('click', '.plugins .deactivate a', function(e) {
|
||||
e.preventDefault();
|
||||
preventActionWhenSafeModeActive();
|
||||
});
|
||||
$('body.et-safe-mode-active.plugins-php').on('click', '.page-title-action', function(e) {
|
||||
e.preventDefault();
|
||||
preventActionWhenSafeModeActive();
|
||||
});
|
||||
|
||||
// Safe Mode: Close Interrupt
|
||||
$('body').on('click', '>.et-core-safe-mode-block-modal .et-core-modal-close', function(e) {
|
||||
e.preventDefault();
|
||||
$('body>.et-core-safe-mode-block-modal').remove();
|
||||
});
|
||||
|
||||
/**
|
||||
* Support Center :: Logs
|
||||
*/
|
||||
|
||||
// Logs: Initialize CodeMirror Rendering of Log File
|
||||
if (debugLogViewer && debugLogViewer.initialize && debugLogViewer.defaultSettings && debugLogViewer.defaultSettings.codemirror) {
|
||||
|
||||
// User ET CodeMirror theme
|
||||
var configDebugLog = $.extend({}, debugLogViewer.defaultSettings.codemirror, {
|
||||
indentUnit: 2,
|
||||
tabSize: 2,
|
||||
mode: 'nginx',
|
||||
theme: 'et',
|
||||
scrollbarStyle: 'native',
|
||||
readOnly: true,
|
||||
lineWrapping: true
|
||||
});
|
||||
|
||||
if ($('#et_logs_display').length > 0) {
|
||||
// Divi Theme
|
||||
addLogViewerInstance(debugLogViewer, $('#et_logs_display'), configDebugLog);
|
||||
}
|
||||
}
|
||||
|
||||
// Logs: Copy Full WP_DEBUG Log to Clipboard
|
||||
$('.copy_debug_log').on('click', function() {
|
||||
$('#et_logs_recent').trigger('select');
|
||||
document.execCommand('copy');
|
||||
confirmClipboardCopy();
|
||||
});
|
||||
|
||||
/**
|
||||
* Support Center :: Divi Hosting Card
|
||||
*/
|
||||
|
||||
// Dismiss Card from the Support Center
|
||||
$('.card.has-dismiss-button').on('click', '.et-dismiss-button', function(e) {
|
||||
const $toggle = $(this);
|
||||
|
||||
dismissCard($toggle);
|
||||
});
|
||||
|
||||
// Initialize Tippy when it's available
|
||||
if (typeof tippy !== 'undefined') {
|
||||
tippy('[data-tippy-content]', {
|
||||
arrow: tippy.roundArrow,
|
||||
theme: 'et-tippy',
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
5
wp-content/themes/Divi/core/admin/js/tippy.min.js
vendored
Normal file
5
wp-content/themes/Divi/core/admin/js/tippy.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
86
wp-content/themes/Divi/core/admin/js/version-rollback.js
Normal file
86
wp-content/themes/Divi/core/admin/js/version-rollback.js
Normal file
@@ -0,0 +1,86 @@
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
window.etCore.versionRollback = {
|
||||
boot: function() {
|
||||
var _this = this;
|
||||
|
||||
$(document).on('click', '.et-core-version-rollback-confirm', function (e) {
|
||||
var $a = $(this);
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
_this.rollback($a.attr('href'));
|
||||
});
|
||||
},
|
||||
|
||||
disableActions: function() {
|
||||
$('.et-core-version-rollback-modal .et-core-modal-action').addClass('et-core-disabled');
|
||||
},
|
||||
|
||||
enableActions: function() {
|
||||
$('.et-core-version-rollback-modal .et-core-modal-action').removeClass('et-core-disabled');
|
||||
},
|
||||
|
||||
removeActions: function() {
|
||||
$('.et-core-version-rollback-modal .et-core-modal-action').remove();
|
||||
$('.et-core-version-rollback-modal').addClass('et-core-modal-actionless');
|
||||
},
|
||||
|
||||
rollback: function(url) {
|
||||
var success = (function(response) {
|
||||
etCore.modalContent( '<div class="et-core-loader et-core-loader-success"></div>', false, false, '#et-core-version-rollback-modal-content' );
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
}, 2000);
|
||||
}).bind(this);
|
||||
|
||||
var error = (function(response) {
|
||||
var data;
|
||||
if ( response.responseJSON !== undefined ) {
|
||||
data = response.responseJSON.data;
|
||||
} else {
|
||||
data = {
|
||||
errorIsUnrecoverable: false,
|
||||
error: etCoreVersionRollbackI18n.unknownError
|
||||
};
|
||||
}
|
||||
|
||||
var removeTempContent = true;
|
||||
etCore.modalContent( '<div class="et-core-loader et-core-loader-fail"></div>', false, 2000, '#et-core-version-rollback-modal-content' );
|
||||
|
||||
if (undefined !== typeof data.errorIsUnrecoverable && data.errorIsUnrecoverable) {
|
||||
removeTempContent = false;
|
||||
this.removeActions();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
var content = $('<div></div>').append($('<p></p>').html(data.error)).html();
|
||||
etCore.modalContent(content, true, removeTempContent, '#et-core-version-rollback-modal-content');
|
||||
}, 2000)
|
||||
}).bind(this);
|
||||
|
||||
var complete = (function(response) {
|
||||
this.enableActions();
|
||||
}).bind(this);
|
||||
|
||||
this.disableActions();
|
||||
etCore.modalContent( '<div class="et-core-loader"></div>', false, false, '#et-core-version-rollback-modal-content' );
|
||||
|
||||
// The URL already includes action and nonce.
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
success: success,
|
||||
error: error,
|
||||
complete: complete
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
window.etCore.versionRollback.boot();
|
||||
});
|
||||
|
||||
})(jQuery);
|
4
wp-content/themes/Divi/core/admin/js/wp-color-picker-alpha.min.js
vendored
Normal file
4
wp-content/themes/Divi/core/admin/js/wp-color-picker-alpha.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user