mirror of
https://github.com/KevinMidboe/rohnenedre.git
synced 2025-12-08 20:39:02 +00:00
Initial commit. State 04.2021.
This commit is contained in:
7850
wp-content/themes/Divi/includes/builder/scripts/builder.js
Normal file
7850
wp-content/themes/Divi/includes/builder/scripts/builder.js
Normal file
File diff suppressed because it is too large
Load Diff
7
wp-content/themes/Divi/includes/builder/scripts/ext/jquery-ui-1.10.4.custom.min.js
vendored
Normal file
7
wp-content/themes/Divi/includes/builder/scripts/ext/jquery-ui-1.10.4.custom.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2145
wp-content/themes/Divi/includes/builder/scripts/ext/jquery-ui-timepicker-addon.js
vendored
Normal file
2145
wp-content/themes/Divi/includes/builder/scripts/ext/jquery-ui-timepicker-addon.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,848 @@
|
||||
/*
|
||||
* jQuery MiniColors: A tiny color picker built on jQuery
|
||||
*
|
||||
* Copyright: Cory LaViska for A Beautiful Site, LLC
|
||||
*
|
||||
* Contributions and bug reports: https://github.com/claviska/jquery-minicolors
|
||||
*
|
||||
* @license: http://opensource.org/licenses/MIT
|
||||
*
|
||||
*/
|
||||
if(jQuery) (function($) {
|
||||
|
||||
// Defaults
|
||||
$.minicolors = {
|
||||
defaults: {
|
||||
animationSpeed: 50,
|
||||
animationEasing: 'swing',
|
||||
change: null,
|
||||
changeDelay: 0,
|
||||
control: 'hue',
|
||||
dataUris: true,
|
||||
defaultValue: '',
|
||||
hide: null,
|
||||
hideSpeed: 100,
|
||||
inline: false,
|
||||
letterCase: 'lowercase',
|
||||
opacity: false,
|
||||
position: 'bottom left',
|
||||
show: null,
|
||||
showSpeed: 100,
|
||||
theme: 'default'
|
||||
}
|
||||
};
|
||||
|
||||
// Public methods
|
||||
$.extend($.fn, {
|
||||
minicolors: function(method, data) {
|
||||
|
||||
switch(method) {
|
||||
|
||||
// Destroy the control
|
||||
case 'destroy':
|
||||
$(this).each( function() {
|
||||
destroy($(this));
|
||||
});
|
||||
return $(this);
|
||||
|
||||
// Hide the color picker
|
||||
case 'hide':
|
||||
hide();
|
||||
return $(this);
|
||||
|
||||
// Get/set opacity
|
||||
case 'opacity':
|
||||
// Getter
|
||||
if( data === undefined ) {
|
||||
// Getter
|
||||
return $(this).attr('data-opacity');
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
updateFromInput($(this).attr('data-opacity', data));
|
||||
});
|
||||
}
|
||||
return $(this);
|
||||
|
||||
// Get an RGB(A) object based on the current color/opacity
|
||||
case 'rgbObject':
|
||||
return rgbObject($(this), method === 'rgbaObject');
|
||||
|
||||
// Get an RGB(A) string based on the current color/opacity
|
||||
case 'rgbString':
|
||||
case 'rgbaString':
|
||||
return rgbString($(this), method === 'rgbaString');
|
||||
|
||||
// Get/set settings on the fly
|
||||
case 'settings':
|
||||
if( data === undefined ) {
|
||||
return $(this).data('minicolors-settings');
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
var settings = $(this).data('minicolors-settings') || {};
|
||||
destroy($(this));
|
||||
$(this).minicolors($.extend(true, settings, data));
|
||||
});
|
||||
}
|
||||
return $(this);
|
||||
|
||||
// Show the color picker
|
||||
case 'show':
|
||||
show( $(this).eq(0) );
|
||||
return $(this);
|
||||
|
||||
// Get/set the hex color value
|
||||
case 'value':
|
||||
if( data === undefined ) {
|
||||
// Getter
|
||||
return $(this).val();
|
||||
} else {
|
||||
// Setter
|
||||
$(this).each( function() {
|
||||
updateFromInput($(this).val(data));
|
||||
});
|
||||
}
|
||||
return $(this);
|
||||
|
||||
// Initializes the control
|
||||
default:
|
||||
if( method !== 'create' ) data = method;
|
||||
$(this).each( function() {
|
||||
init($(this), data);
|
||||
});
|
||||
return $(this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize input elements
|
||||
function init(input, settings) {
|
||||
|
||||
var minicolors = $('<div class="minicolors" />'),
|
||||
defaults = $.minicolors.defaults;
|
||||
|
||||
// Do nothing if already initialized
|
||||
if( input.data('minicolors-initialized') ) return;
|
||||
|
||||
// Handle settings
|
||||
settings = $.extend(true, {}, defaults, settings);
|
||||
|
||||
// The wrapper
|
||||
minicolors
|
||||
.addClass('minicolors-theme-' + settings.theme)
|
||||
.toggleClass('minicolors-with-opacity', settings.opacity)
|
||||
.toggleClass('minicolors-no-data-uris', settings.dataUris !== true);
|
||||
|
||||
// Custom positioning
|
||||
if( settings.position !== undefined ) {
|
||||
$.each(settings.position.split(' '), function() {
|
||||
minicolors.addClass('minicolors-position-' + this);
|
||||
});
|
||||
}
|
||||
|
||||
// The input
|
||||
input
|
||||
.addClass('minicolors-input')
|
||||
.data('minicolors-initialized', false)
|
||||
.data('minicolors-settings', settings)
|
||||
.prop('size', 7)
|
||||
.wrap(minicolors)
|
||||
.after(
|
||||
'<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
|
||||
'<div class="minicolors-slider minicolors-sprite">' +
|
||||
'<div class="minicolors-picker"></div>' +
|
||||
'</div>' +
|
||||
'<div class="minicolors-opacity-slider minicolors-sprite">' +
|
||||
'<div class="minicolors-picker"></div>' +
|
||||
'</div>' +
|
||||
'<div class="minicolors-grid minicolors-sprite">' +
|
||||
'<div class="minicolors-grid-inner"></div>' +
|
||||
'<div class="minicolors-picker"><div></div></div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
);
|
||||
|
||||
// The swatch
|
||||
if( !settings.inline ) {
|
||||
input.after('<span class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></span>');
|
||||
input.next('.minicolors-swatch').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
input.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// Prevent text selection in IE
|
||||
input.parent().find('.minicolors-panel').on('selectstart', function() { return false; }).end();
|
||||
|
||||
// Inline controls
|
||||
if( settings.inline ) input.parent().addClass('minicolors-inline');
|
||||
|
||||
updateFromInput(input, false);
|
||||
|
||||
input.data('minicolors-initialized', true);
|
||||
|
||||
}
|
||||
|
||||
// Returns the input back to its original state
|
||||
function destroy(input) {
|
||||
|
||||
var minicolors = input.parent();
|
||||
|
||||
// Revert the input element
|
||||
input
|
||||
.removeData('minicolors-initialized')
|
||||
.removeData('minicolors-settings')
|
||||
.removeProp('size')
|
||||
.removeClass('minicolors-input');
|
||||
|
||||
// Remove the wrap and destroy whatever remains
|
||||
minicolors.before(input).remove();
|
||||
|
||||
}
|
||||
|
||||
// Shows the specified dropdown panel
|
||||
function show(input) {
|
||||
|
||||
var minicolors = input.parent(),
|
||||
panel = minicolors.find('.minicolors-panel'),
|
||||
settings = input.data('minicolors-settings');
|
||||
|
||||
// Do nothing if uninitialized, disabled, inline, or already open
|
||||
if( !input.data('minicolors-initialized') ||
|
||||
input.prop('disabled') ||
|
||||
minicolors.hasClass('minicolors-inline') ||
|
||||
minicolors.hasClass('minicolors-focus')
|
||||
) return;
|
||||
|
||||
hide();
|
||||
|
||||
minicolors.addClass('minicolors-focus');
|
||||
panel
|
||||
.stop(true, true)
|
||||
.fadeIn(settings.showSpeed, function() {
|
||||
if( settings.show ) settings.show.call(input.get(0));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Hides all dropdown panels
|
||||
function hide() {
|
||||
|
||||
$('.minicolors-focus').each( function() {
|
||||
|
||||
var minicolors = $(this),
|
||||
input = minicolors.find('.minicolors-input'),
|
||||
panel = minicolors.find('.minicolors-panel'),
|
||||
settings = input.data('minicolors-settings');
|
||||
|
||||
panel.fadeOut(settings.hideSpeed, function() {
|
||||
if( settings.hide ) settings.hide.call(input.get(0));
|
||||
minicolors.removeClass('minicolors-focus');
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Moves the selected picker
|
||||
function move(target, event, animate) {
|
||||
|
||||
var input = target.parents('.minicolors').find('.minicolors-input'),
|
||||
settings = input.data('minicolors-settings'),
|
||||
picker = target.find('[class$=-picker]'),
|
||||
offsetX = target.offset().left,
|
||||
offsetY = target.offset().top,
|
||||
x = Math.round(event.pageX - offsetX),
|
||||
y = Math.round(event.pageY - offsetY),
|
||||
duration = animate ? settings.animationSpeed : 0,
|
||||
wx, wy, r, phi;
|
||||
|
||||
// Touch support
|
||||
if( event.originalEvent.changedTouches ) {
|
||||
x = event.originalEvent.changedTouches[0].pageX - offsetX;
|
||||
y = event.originalEvent.changedTouches[0].pageY - offsetY;
|
||||
}
|
||||
|
||||
// Constrain picker to its container
|
||||
if( x < 0 ) x = 0;
|
||||
if( y < 0 ) y = 0;
|
||||
if( x > target.width() ) x = target.width();
|
||||
if( y > target.height() ) y = target.height();
|
||||
|
||||
// Constrain color wheel values to the wheel
|
||||
if( target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid') ) {
|
||||
wx = 75 - x;
|
||||
wy = 75 - y;
|
||||
r = Math.sqrt(wx * wx + wy * wy);
|
||||
phi = Math.atan2(wy, wx);
|
||||
if( phi < 0 ) phi += Math.PI * 2;
|
||||
if( r > 75 ) {
|
||||
r = 75;
|
||||
x = 75 - (75 * Math.cos(phi));
|
||||
y = 75 - (75 * Math.sin(phi));
|
||||
}
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
}
|
||||
|
||||
// Move the picker
|
||||
if( target.is('.minicolors-grid') ) {
|
||||
picker
|
||||
.stop(true)
|
||||
.animate({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
}, duration, settings.animationEasing, function() {
|
||||
updateFromControl(input, target);
|
||||
});
|
||||
} else {
|
||||
picker
|
||||
.stop(true)
|
||||
.animate({
|
||||
top: y + 'px'
|
||||
}, duration, settings.animationEasing, function() {
|
||||
updateFromControl(input, target);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sets the input based on the color picker values
|
||||
function updateFromControl(input, target) {
|
||||
|
||||
function getCoords(picker, container) {
|
||||
|
||||
var left, top;
|
||||
if( !picker.length || !container ) return null;
|
||||
left = picker.offset().left;
|
||||
top = picker.offset().top;
|
||||
|
||||
return {
|
||||
x: left - container.offset().left + (picker.outerWidth() / 2),
|
||||
y: top - container.offset().top + (picker.outerHeight() / 2)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var hue, saturation, brightness, x, y, r, phi,
|
||||
|
||||
hex = input.val(),
|
||||
opacity = input.attr('data-opacity'),
|
||||
|
||||
// Helpful references
|
||||
minicolors = input.parent(),
|
||||
settings = input.data('minicolors-settings'),
|
||||
swatch = minicolors.find('.minicolors-swatch'),
|
||||
|
||||
// Panel objects
|
||||
grid = minicolors.find('.minicolors-grid'),
|
||||
slider = minicolors.find('.minicolors-slider'),
|
||||
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
|
||||
|
||||
// Picker objects
|
||||
gridPicker = grid.find('[class$=-picker]'),
|
||||
sliderPicker = slider.find('[class$=-picker]'),
|
||||
opacityPicker = opacitySlider.find('[class$=-picker]'),
|
||||
|
||||
// Picker positions
|
||||
gridPos = getCoords(gridPicker, grid),
|
||||
sliderPos = getCoords(sliderPicker, slider),
|
||||
opacityPos = getCoords(opacityPicker, opacitySlider);
|
||||
|
||||
// Handle colors
|
||||
if( target.is('.minicolors-grid, .minicolors-slider') ) {
|
||||
|
||||
// Determine HSB values
|
||||
switch(settings.control) {
|
||||
|
||||
case 'wheel':
|
||||
// Calculate hue, saturation, and brightness
|
||||
x = (grid.width() / 2) - gridPos.x;
|
||||
y = (grid.height() / 2) - gridPos.y;
|
||||
r = Math.sqrt(x * x + y * y);
|
||||
phi = Math.atan2(y, x);
|
||||
if( phi < 0 ) phi += Math.PI * 2;
|
||||
if( r > 75 ) {
|
||||
r = 75;
|
||||
gridPos.x = 69 - (75 * Math.cos(phi));
|
||||
gridPos.y = 69 - (75 * Math.sin(phi));
|
||||
}
|
||||
saturation = keepWithin(r / 0.75, 0, 100);
|
||||
hue = keepWithin(phi * 180 / Math.PI, 0, 360);
|
||||
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
||||
break;
|
||||
|
||||
case 'saturation':
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
||||
saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
|
||||
break;
|
||||
|
||||
case 'brightness':
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
|
||||
saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Calculate hue, saturation, and brightness
|
||||
hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
|
||||
saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
|
||||
brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
|
||||
hex = hsb2hex({
|
||||
h: hue,
|
||||
s: saturation,
|
||||
b: brightness
|
||||
});
|
||||
|
||||
// Update UI
|
||||
grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Adjust case
|
||||
input.val( convertCase(hex, settings.letterCase) );
|
||||
|
||||
}
|
||||
|
||||
// Handle opacity
|
||||
if( target.is('.minicolors-opacity-slider') ) {
|
||||
if( settings.opacity ) {
|
||||
opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
|
||||
} else {
|
||||
opacity = 1;
|
||||
}
|
||||
if( settings.opacity ) input.attr('data-opacity', opacity);
|
||||
}
|
||||
|
||||
// Set swatch color
|
||||
swatch.find('SPAN').css({
|
||||
backgroundColor: hex,
|
||||
opacity: opacity
|
||||
});
|
||||
|
||||
// Handle change event
|
||||
doChange(input, hex, opacity);
|
||||
|
||||
}
|
||||
|
||||
// Sets the color picker values from the input
|
||||
function updateFromInput(input, preserveInputValue) {
|
||||
|
||||
var hex,
|
||||
hsb,
|
||||
opacity,
|
||||
x, y, r, phi,
|
||||
|
||||
// Helpful references
|
||||
minicolors = input.parent(),
|
||||
settings = input.data('minicolors-settings'),
|
||||
swatch = minicolors.find('.minicolors-swatch'),
|
||||
|
||||
// Panel objects
|
||||
grid = minicolors.find('.minicolors-grid'),
|
||||
slider = minicolors.find('.minicolors-slider'),
|
||||
opacitySlider = minicolors.find('.minicolors-opacity-slider'),
|
||||
|
||||
// Picker objects
|
||||
gridPicker = grid.find('[class$=-picker]'),
|
||||
sliderPicker = slider.find('[class$=-picker]'),
|
||||
opacityPicker = opacitySlider.find('[class$=-picker]');
|
||||
|
||||
// Determine hex/HSB values
|
||||
hex = convertCase(parseHex(input.val(), true), settings.letterCase);
|
||||
if( !hex ){
|
||||
hex = convertCase(parseHex(settings.defaultValue, true), settings.letterCase);
|
||||
}
|
||||
hsb = hex2hsb(hex);
|
||||
|
||||
// Update input value
|
||||
if( !preserveInputValue ) input.val(hex);
|
||||
|
||||
// Determine opacity value
|
||||
if( settings.opacity ) {
|
||||
// Get from data-opacity attribute and keep within 0-1 range
|
||||
opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
|
||||
if( isNaN(opacity) ) opacity = 1;
|
||||
input.attr('data-opacity', opacity);
|
||||
swatch.find('SPAN').css('opacity', opacity);
|
||||
|
||||
// Set opacity picker position
|
||||
y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
|
||||
opacityPicker.css('top', y + 'px');
|
||||
}
|
||||
|
||||
// Update swatch
|
||||
swatch.find('SPAN').css('backgroundColor', hex);
|
||||
|
||||
// Determine picker locations
|
||||
switch(settings.control) {
|
||||
|
||||
case 'wheel':
|
||||
// Set grid position
|
||||
r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
|
||||
phi = hsb.h * Math.PI / 180;
|
||||
x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
|
||||
y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = 150 - (hsb.b / (100 / grid.height()));
|
||||
if( hex === '' ) y = 0;
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update panel color
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
||||
break;
|
||||
|
||||
case 'saturation':
|
||||
// Set grid position
|
||||
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
|
||||
break;
|
||||
|
||||
case 'brightness':
|
||||
// Set grid position
|
||||
x = keepWithin((5 * hsb.h) / 12, 0, 150);
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update UI
|
||||
slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
|
||||
minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Set grid position
|
||||
x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
|
||||
y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
|
||||
gridPicker.css({
|
||||
top: y + 'px',
|
||||
left: x + 'px'
|
||||
});
|
||||
|
||||
// Set slider position
|
||||
y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
|
||||
sliderPicker.css('top', y + 'px');
|
||||
|
||||
// Update panel color
|
||||
grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Fire change event, but only if minicolors is fully initialized
|
||||
if( input.data('minicolors-initialized') ) {
|
||||
doChange(input, hex, opacity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Runs the change and changeDelay callbacks
|
||||
function doChange(input, hex, opacity) {
|
||||
|
||||
var settings = input.data('minicolors-settings'),
|
||||
lastChange = input.data('minicolors-lastChange');
|
||||
|
||||
// Only run if it actually changed
|
||||
if( !lastChange || lastChange.hex !== hex || lastChange.opacity !== opacity ) {
|
||||
|
||||
// Remember last-changed value
|
||||
input.data('minicolors-lastChange', {
|
||||
hex: hex,
|
||||
opacity: opacity
|
||||
});
|
||||
|
||||
// Fire change event
|
||||
if( settings.change ) {
|
||||
if( settings.changeDelay ) {
|
||||
// Call after a delay
|
||||
clearTimeout(input.data('minicolors-changeTimeout'));
|
||||
input.data('minicolors-changeTimeout', setTimeout( function() {
|
||||
settings.change.call(input.get(0), hex, opacity);
|
||||
}, settings.changeDelay));
|
||||
} else {
|
||||
// Call immediately
|
||||
settings.change.call(input.get(0), hex, opacity);
|
||||
}
|
||||
}
|
||||
input.trigger('change').trigger('input');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generates an RGB(A) object based on the input's value
|
||||
function rgbObject(input) {
|
||||
var hex = parseHex($(input).val(), true),
|
||||
rgb = hex2rgb(hex),
|
||||
opacity = $(input).attr('data-opacity');
|
||||
if( !rgb ) return null;
|
||||
if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
|
||||
return rgb;
|
||||
}
|
||||
|
||||
// Genearates an RGB(A) string based on the input's value
|
||||
function rgbString(input, alpha) {
|
||||
var hex = parseHex($(input).val(), true),
|
||||
rgb = hex2rgb(hex),
|
||||
opacity = $(input).attr('data-opacity');
|
||||
if( !rgb ) return null;
|
||||
if( opacity === undefined ) opacity = 1;
|
||||
if( alpha ) {
|
||||
return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
|
||||
} else {
|
||||
return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
|
||||
}
|
||||
}
|
||||
|
||||
// Converts to the letter case specified in settings
|
||||
function convertCase(string, letterCase) {
|
||||
return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
|
||||
}
|
||||
|
||||
// Parses a string and returns a valid hex string when possible
|
||||
function parseHex(string, expand) {
|
||||
string = string.replace(/[^A-F0-9]/ig, '');
|
||||
if( string.length !== 3 && string.length !== 6 ) return '';
|
||||
if( string.length === 3 && expand ) {
|
||||
string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
|
||||
}
|
||||
return '#' + string;
|
||||
}
|
||||
|
||||
// Keeps value within min and max
|
||||
function keepWithin(value, min, max) {
|
||||
if( value < min ) value = min;
|
||||
if( value > max ) value = max;
|
||||
return value;
|
||||
}
|
||||
|
||||
// Converts an HSB object to an RGB object
|
||||
function hsb2rgb(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)
|
||||
};
|
||||
}
|
||||
|
||||
// Converts an RGB object to a hex string
|
||||
function rgb2hex(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('');
|
||||
}
|
||||
|
||||
// Converts an HSB object to a hex string
|
||||
function hsb2hex(hsb) {
|
||||
return rgb2hex(hsb2rgb(hsb));
|
||||
}
|
||||
|
||||
// Converts a hex string to an HSB object
|
||||
function hex2hsb(hex) {
|
||||
var hsb = rgb2hsb(hex2rgb(hex));
|
||||
if( hsb.s === 0 ) hsb.h = 360;
|
||||
return hsb;
|
||||
}
|
||||
|
||||
// Converts an RGB object to an HSB object
|
||||
function rgb2hsb(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;
|
||||
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;
|
||||
}
|
||||
|
||||
// Converts a hex string to an RGB object
|
||||
function hex2rgb(hex) {
|
||||
hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {
|
||||
/* jshint ignore:start */
|
||||
r: hex >> 16,
|
||||
g: (hex & 0x00FF00) >> 8,
|
||||
b: (hex & 0x0000FF)
|
||||
/* jshint ignore:end */
|
||||
};
|
||||
}
|
||||
|
||||
// Handle events
|
||||
$(document)
|
||||
// Hide on clicks outside of the control
|
||||
.on('mousedown.minicolors touchstart.minicolors', function(event) {
|
||||
if( !$(event.target).parents().add(event.target).hasClass('minicolors') ) {
|
||||
hide();
|
||||
}
|
||||
})
|
||||
// Start moving
|
||||
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
|
||||
var target = $(this);
|
||||
event.preventDefault();
|
||||
$(document).data('minicolors-target', target);
|
||||
move(target, event, true);
|
||||
})
|
||||
// Move pickers
|
||||
.on('mousemove.minicolors touchmove.minicolors', function(event) {
|
||||
var target = $(document).data('minicolors-target');
|
||||
if( target ) move(target, event);
|
||||
})
|
||||
// Stop moving
|
||||
.on('mouseup.minicolors touchend.minicolors', function() {
|
||||
$(this).removeData('minicolors-target');
|
||||
})
|
||||
// Show panel when swatch is clicked
|
||||
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-swatch', function(event) {
|
||||
var input = $(this).parent().find('.minicolors-input');
|
||||
event.preventDefault();
|
||||
show(input);
|
||||
})
|
||||
// Show on focus
|
||||
.on('focus.minicolors', '.minicolors-input', function() {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
show(input);
|
||||
})
|
||||
// Fix hex on blur
|
||||
.on('blur.minicolors', '.minicolors-input', function() {
|
||||
var input = $(this),
|
||||
settings = input.data('minicolors-settings');
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
|
||||
// Parse Hex
|
||||
input.val(parseHex(input.val(), true));
|
||||
|
||||
// Is it blank?
|
||||
if( input.val() === '' ) input.val(parseHex(settings.defaultValue, true));
|
||||
|
||||
// Adjust case
|
||||
input.val( convertCase(input.val(), settings.letterCase) );
|
||||
|
||||
})
|
||||
// Handle keypresses
|
||||
.on('keydown.minicolors', '.minicolors-input', function(event) {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
switch(event.keyCode) {
|
||||
case 9: // tab
|
||||
hide();
|
||||
break;
|
||||
case 13: // enter
|
||||
case 27: // esc
|
||||
hide();
|
||||
input.blur();
|
||||
break;
|
||||
}
|
||||
})
|
||||
// Update on keyup
|
||||
.on('keyup.minicolors', '.minicolors-input', function() {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
updateFromInput(input, true);
|
||||
})
|
||||
// Update on paste
|
||||
.on('paste.minicolors', '.minicolors-input', function() {
|
||||
var input = $(this);
|
||||
if( !input.data('minicolors-initialized') ) return;
|
||||
setTimeout( function() {
|
||||
updateFromInput(input, true);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
1293
wp-content/themes/Divi/includes/builder/scripts/ext/jquery.validate.js
vendored
Normal file
1293
wp-content/themes/Divi/includes/builder/scripts/ext/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
( function($) {
|
||||
|
||||
$( document ).ready( function() {
|
||||
$( '.widget-liquid-right' ).append( et_pb_options.widget_info );
|
||||
|
||||
var $create_box = $( '#et_pb_widget_area_create' ),
|
||||
$widget_name_input = $create_box.find( '#et_pb_new_widget_area_name' ),
|
||||
$et_pb_sidebars = $( 'div[id^=et_pb_widget_area_]' );
|
||||
|
||||
$create_box.find( '.et_pb_create_widget_area' ).click( function( event ) {
|
||||
var $this_el = $(this);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( $widget_name_input.val() === '' ) return;
|
||||
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: et_pb_options.ajaxurl,
|
||||
data:
|
||||
{
|
||||
action : 'et_pb_add_widget_area',
|
||||
et_load_nonce : et_pb_options.et_load_nonce,
|
||||
et_widget_area_name : $widget_name_input.val()
|
||||
},
|
||||
success: function( data ){
|
||||
$this_el.siblings( '.et_pb_widget_area_result' ).hide().html( data ).slideToggle();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$et_pb_sidebars.each( function() {
|
||||
if ( $(this).is( '#et_pb_widget_area_create' ) || $(this).closest( '.inactive-sidebar' ).length ) return true;
|
||||
|
||||
$(this).closest('.widgets-holder-wrap').find('.sidebar-name h3').before( '<a href="#" class="et_pb_widget_area_remove">' + et_pb_options.delete_string + '</a>' );
|
||||
|
||||
$( '.et_pb_widget_area_remove' ).click( function( event ) {
|
||||
var $this_el = $(this);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: et_pb_options.ajaxurl,
|
||||
data:
|
||||
{
|
||||
action : 'et_pb_remove_widget_area',
|
||||
et_load_nonce : et_pb_options.et_load_nonce,
|
||||
et_widget_area_name : $this_el.closest( '.widgets-holder-wrap' ).find( 'div[id^=et_pb_widget_area_]' ).attr( 'id' )
|
||||
},
|
||||
success: function( data ){
|
||||
$( '#' + data ).closest( '.widgets-holder-wrap' ).remove();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
} )(jQuery);
|
||||
@@ -0,0 +1,339 @@
|
||||
/**
|
||||
* wp-color-picker-alpha
|
||||
*
|
||||
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
||||
* Only run in input and is defined data alpha in true
|
||||
*
|
||||
* Version: 1.1
|
||||
* https://github.com/23r9i0/wp-color-picker-alpha
|
||||
* Copyright (c) 2015 Sergio P.A. (23r9i0).
|
||||
* Licensed under the GPLv2 license.
|
||||
*/
|
||||
( function( $ ) {
|
||||
// Variable for some backgrounds
|
||||
var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==';
|
||||
// html stuff for wpColorPicker copy of the original color-picker.js
|
||||
var _before = '<a tabindex="0" class="wp-color-result" />',
|
||||
_after = '<div class="wp-picker-holder" />',
|
||||
_wrap = '<div class="wp-picker-container" />',
|
||||
_button = '<input type="button" class="button button-small hidden" />';
|
||||
|
||||
/**
|
||||
* Overwrite Color
|
||||
* for enable support rbga
|
||||
*/
|
||||
Color.fn.toString = function() {
|
||||
if ( this._alpha < 1 )
|
||||
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
|
||||
|
||||
var hex = parseInt( this._color, 10 ).toString( 16 );
|
||||
|
||||
if ( this.error )
|
||||
return '';
|
||||
|
||||
if ( hex.length < 6 ) {
|
||||
for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
}
|
||||
|
||||
return '#' + hex;
|
||||
};
|
||||
|
||||
/**
|
||||
* Overwrite wpColorPicker
|
||||
*/
|
||||
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
|
||||
_create: function() {
|
||||
// bail early for unsupported Iris.
|
||||
if ( ! $.support.iris ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this,
|
||||
el = self.element;
|
||||
|
||||
$.extend( self.options, el.data() );
|
||||
|
||||
// keep close bound so it can be attached to a body listener
|
||||
self.close = $.proxy( self.close, self );
|
||||
|
||||
self.initialValue = el.val();
|
||||
|
||||
// Set up HTML structure, hide things
|
||||
el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
|
||||
self.wrap = el.parent();
|
||||
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
|
||||
self.pickerContainer = $( _after ).insertAfter( el );
|
||||
self.button = $( _button );
|
||||
|
||||
if ( self.options.defaultColor ) {
|
||||
self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString );
|
||||
} else {
|
||||
self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear );
|
||||
}
|
||||
|
||||
el.wrap( '<span class="wp-picker-input-wrap" />' ).after(self.button);
|
||||
|
||||
el.iris( {
|
||||
target: self.pickerContainer,
|
||||
hide: self.options.hide,
|
||||
width: self.options.width,
|
||||
mode: self.options.mode,
|
||||
palettes: self.options.palettes,
|
||||
change: function( event, ui ) {
|
||||
if ( self.options.alpha ) {
|
||||
self.toggler.css( { 'background-image': 'url(' + image + ')' } ).html('<span />');
|
||||
self.toggler.find('span').css({
|
||||
'width': '100%',
|
||||
'height': '100%',
|
||||
'position': 'absolute',
|
||||
'top': 0,
|
||||
'left': 0,
|
||||
'border-top-left-radius': '3px',
|
||||
'border-bottom-left-radius': '3px',
|
||||
'background': ui.color.toString()
|
||||
});
|
||||
} else {
|
||||
self.toggler.css( { backgroundColor: ui.color.toString() } );
|
||||
}
|
||||
// check for a custom cb
|
||||
if ( $.isFunction( self.options.change ) ) {
|
||||
self.options.change.call( this, event, ui );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
el.val( self.initialValue );
|
||||
self._addListeners();
|
||||
if ( ! self.options.hide ) {
|
||||
self.toggler.click();
|
||||
}
|
||||
},
|
||||
_addListeners: function() {
|
||||
var self = this;
|
||||
|
||||
// prevent any clicks inside this widget from leaking to the top and closing it
|
||||
self.wrap.on( 'click.wpcolorpicker', function( event ) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
self.toggler.click( function(){
|
||||
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
|
||||
self.close();
|
||||
} else {
|
||||
self.open();
|
||||
}
|
||||
});
|
||||
|
||||
self.element.change( function( event ) {
|
||||
var me = $( this ),
|
||||
val = me.val();
|
||||
// Empty or Error = clear
|
||||
if ( val === '' || self.element.hasClass('iris-error') ) {
|
||||
if ( self.options.alpha ) {
|
||||
self.toggler.removeAttr('style');
|
||||
self.toggler.find('span').css( 'backgroundColor', '' );
|
||||
} else {
|
||||
self.toggler.css( 'backgroundColor', '' );
|
||||
}
|
||||
// fire clear callback if we have one
|
||||
if ( $.isFunction( self.options.clear ) ) {
|
||||
self.options.clear.call( this, event );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// open a keyboard-focused closed picker with space or enter
|
||||
self.toggler.on( 'keyup', function( event ) {
|
||||
if ( event.keyCode === 13 || event.keyCode === 32 ) {
|
||||
event.preventDefault();
|
||||
self.toggler.trigger( 'click' ).next().focus();
|
||||
}
|
||||
});
|
||||
|
||||
self.button.click( function( event ) {
|
||||
var me = $( this );
|
||||
if ( me.hasClass( 'wp-picker-clear' ) ) {
|
||||
self.element.val( '' );
|
||||
if ( self.options.alpha ) {
|
||||
self.toggler.removeAttr('style');
|
||||
self.toggler.find('span').css( 'backgroundColor', '' );
|
||||
} else {
|
||||
self.toggler.css( 'backgroundColor', '' );
|
||||
}
|
||||
if ( $.isFunction( self.options.clear ) ) {
|
||||
self.options.clear.call( this, event );
|
||||
}
|
||||
} else if ( me.hasClass( 'wp-picker-default' ) ) {
|
||||
self.element.val( self.options.defaultColor ).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Overwrite iris
|
||||
*/
|
||||
$.widget( 'a8c.iris', $.a8c.iris, {
|
||||
_create: function() {
|
||||
this._super();
|
||||
|
||||
// Global option for check is mode rbga is enabled
|
||||
this.options.alpha = this.element.data( 'alpha' ) || false;
|
||||
|
||||
// Is not input disabled
|
||||
if ( ! this.element.is( ':input' ) ) {
|
||||
this.options.alpha = false;
|
||||
}
|
||||
|
||||
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
|
||||
var self = this,
|
||||
el = self.element,
|
||||
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
|
||||
aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
|
||||
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
|
||||
controls = {
|
||||
aContainer: aContainer,
|
||||
aSlider: aSlider
|
||||
};
|
||||
|
||||
// Set default width for input reset
|
||||
self.options.defaultWidth = el.width();
|
||||
|
||||
// Update width for input
|
||||
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != 1 ) {
|
||||
el.width( parseInt( self.options.defaultWidth+100 ) );
|
||||
}
|
||||
|
||||
// Push new controls
|
||||
$.each( controls, function( k, v ){
|
||||
self.controls[k] = v;
|
||||
});
|
||||
|
||||
// Change size strip and add margin for sliders
|
||||
self.controls.square.css({'margin-right': '0'});
|
||||
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
|
||||
stripsMargin = emptyWidth/6,
|
||||
stripsWidth = (emptyWidth/2) - stripsMargin;
|
||||
|
||||
$.each( [ 'aContainer', 'strip' ], function( k, v ) {
|
||||
self.controls[v].width( stripsWidth ).css({ 'margin-left': stripsMargin + 'px' });
|
||||
});
|
||||
|
||||
// Add new slider
|
||||
self._initControls();
|
||||
|
||||
// For updated widget
|
||||
self._change();
|
||||
}
|
||||
},
|
||||
_initControls: function() {
|
||||
this._super();
|
||||
|
||||
if ( this.options.alpha ) {
|
||||
var self = this,
|
||||
controls = self.controls;
|
||||
|
||||
controls.aSlider.slider({
|
||||
orientation: 'vertical',
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1,
|
||||
value: parseInt( self._color._alpha*100 ),
|
||||
slide: function( event, ui ) {
|
||||
// Update alpha value
|
||||
self._color._alpha = parseFloat( ui.value/100 );
|
||||
self._change.apply( self, arguments );
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
_change: function() {
|
||||
this._super();
|
||||
var self = this,
|
||||
el = self.element;
|
||||
|
||||
if ( this.options.alpha ) {
|
||||
var controls = self.controls,
|
||||
alpha = parseInt( self._color._alpha*100 ),
|
||||
color = self._color.toRgb(),
|
||||
gradient = [
|
||||
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
|
||||
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
|
||||
],
|
||||
defaultWidth = self.options.defaultWidth,
|
||||
target = self.picker.closest('.wp-picker-container').find( '.wp-color-result' );
|
||||
|
||||
// Generate background slider alpha, only for CSS3 old browser fuck!! :)
|
||||
controls.aContainer.css({ 'background': 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' });
|
||||
|
||||
if ( target.hasClass('wp-picker-open') ) {
|
||||
// Update alpha value
|
||||
controls.aSlider.slider( 'value', alpha );
|
||||
|
||||
/**
|
||||
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
|
||||
* and change input width for view all value
|
||||
*/
|
||||
if ( self._color._alpha < 1 ) {
|
||||
var style = controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' );
|
||||
|
||||
controls.strip.attr( 'style', style );
|
||||
|
||||
el.width( parseInt( defaultWidth+100 ) );
|
||||
} else {
|
||||
el.width( defaultWidth );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var reset = el.data('reset-alpha') || false;
|
||||
if ( reset ) {
|
||||
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
|
||||
self._color._alpha = 1;
|
||||
self.active = 'external';
|
||||
self._change();
|
||||
});
|
||||
}
|
||||
},
|
||||
_addInputListeners: function( input ) {
|
||||
var self = this,
|
||||
debounceTimeout = 700, // originally set to 100, but some user perceive it as "jumps to random colors at third digit"
|
||||
callback = function( event ){
|
||||
var color = new Color( input.val() ),
|
||||
val = input.val();
|
||||
|
||||
input.removeClass( 'iris-error' );
|
||||
// we gave a bad color
|
||||
if ( color.error ) {
|
||||
// don't error on an empty input
|
||||
if ( val !== '' ) {
|
||||
input.addClass( 'iris-error' );
|
||||
}
|
||||
} else {
|
||||
if ( color.toString() !== self._color.toString() ) {
|
||||
// let's not do this on keyup for hex shortcodes
|
||||
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) ) {
|
||||
self._setOption( 'color', color.toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
|
||||
|
||||
// If we initialized hidden, show on first focus. The rest is up to you.
|
||||
if ( self.options.hide ) {
|
||||
input.one( 'focus', function() {
|
||||
self.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
} );
|
||||
}( jQuery ) );
|
||||
|
||||
// Auto Call plugin is class is color-picker
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
$( '.color-picker' ).wpColorPicker();
|
||||
} );
|
||||
4
wp-content/themes/Divi/includes/builder/scripts/ext/wp-color-picker-alpha.min.js
vendored
Normal file
4
wp-content/themes/Divi/includes/builder/scripts/ext/wp-color-picker-alpha.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,125 @@
|
||||
(function($){
|
||||
window.et_pb_smooth_scroll = function( $target, $top_section, speed, easing ) {
|
||||
var $window_width = $( window ).width();
|
||||
|
||||
if ( $( 'body' ).hasClass( 'et_fixed_nav' ) && $window_width > 980 ) {
|
||||
$menu_offset = $( '#top-header' ).outerHeight() + $( '#main-header' ).outerHeight() - 1;
|
||||
} else {
|
||||
$menu_offset = -1;
|
||||
}
|
||||
|
||||
if ( $ ('#wpadminbar').length && $window_width > 600 ) {
|
||||
$menu_offset += $( '#wpadminbar' ).outerHeight();
|
||||
}
|
||||
|
||||
//fix sidenav scroll to top
|
||||
if ( $top_section ) {
|
||||
$scroll_position = 0;
|
||||
} else {
|
||||
$scroll_position = $target.offset().top - $menu_offset;
|
||||
}
|
||||
|
||||
// set swing (animate's scrollTop default) as default value
|
||||
if( typeof easing === 'undefined' ){
|
||||
easing = 'swing';
|
||||
}
|
||||
|
||||
$( 'html, body' ).animate( { scrollTop : $scroll_position }, speed, easing );
|
||||
}
|
||||
|
||||
window.et_fix_video_wmode = function( video_wrapper ) {
|
||||
$( video_wrapper ).each( function() {
|
||||
if ( $(this).find( 'iframe' ).length ) {
|
||||
var $this_el = $(this).find( 'iframe' ),
|
||||
src_attr = $this_el.attr('src'),
|
||||
wmode_character = src_attr.indexOf( '?' ) == -1 ? '?' : '&',
|
||||
this_src = src_attr + wmode_character + 'wmode=opaque';
|
||||
|
||||
$this_el.attr('src', this_src);
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
window.et_pb_form_placeholders_init = function( $form ) {
|
||||
$form.find('input:text, textarea').each(function(index,domEle){
|
||||
var $et_current_input = jQuery(domEle),
|
||||
$et_comment_label = $et_current_input.siblings('label'),
|
||||
et_comment_label_value = $et_current_input.siblings('label').text();
|
||||
if ( $et_comment_label.length ) {
|
||||
$et_comment_label.hide();
|
||||
if ( $et_current_input.siblings('span.required') ) {
|
||||
et_comment_label_value += $et_current_input.siblings('span.required').text();
|
||||
$et_current_input.siblings('span.required').hide();
|
||||
}
|
||||
$et_current_input.val(et_comment_label_value);
|
||||
}
|
||||
}).bind('focus',function(){
|
||||
var et_label_text = jQuery(this).siblings('label').text();
|
||||
if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
|
||||
if (jQuery(this).val() === et_label_text) jQuery(this).val("");
|
||||
}).bind('blur',function(){
|
||||
var et_label_text = jQuery(this).siblings('label').text();
|
||||
if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
|
||||
if (jQuery(this).val() === "") jQuery(this).val( et_label_text );
|
||||
});
|
||||
}
|
||||
|
||||
window.et_duplicate_menu = function( menu, append_to, menu_id, menu_class ){
|
||||
append_to.each( function() {
|
||||
var $this_menu = $(this),
|
||||
$cloned_nav;
|
||||
|
||||
menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( $this_menu );
|
||||
$cloned_nav = $this_menu.find('> ul');
|
||||
$cloned_nav.find('.menu_slide').remove();
|
||||
$cloned_nav.find('li:first').addClass('et_first_mobile_item');
|
||||
|
||||
$cloned_nav.find( 'a' ).on( 'click', function(){
|
||||
$this_menu.trigger( 'click' );
|
||||
} );
|
||||
|
||||
$this_menu.on( 'click', function(){
|
||||
if ( $(this).hasClass('closed') ){
|
||||
$(this).removeClass( 'closed' ).addClass( 'opened' );
|
||||
$cloned_nav.slideDown( 500 );
|
||||
} else {
|
||||
$(this).removeClass( 'opened' ).addClass( 'closed' );
|
||||
$cloned_nav.slideUp( 500 );
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
|
||||
$this_menu.on( 'click', 'a', function(event){
|
||||
event.stopPropagation();
|
||||
} );
|
||||
} );
|
||||
|
||||
$('#mobile_menu .centered-inline-logo-wrap').remove();
|
||||
}
|
||||
|
||||
// remove placeholder text before form submission
|
||||
window.et_pb_remove_placeholder_text = function( $form ) {
|
||||
$form.find('input:text, textarea').each(function(index,domEle){
|
||||
var $et_current_input = jQuery(domEle),
|
||||
$et_label = $et_current_input.siblings('label'),
|
||||
et_label_value = $et_current_input.siblings('label').text();
|
||||
|
||||
if ( $et_label.length && $et_label.is(':hidden') ) {
|
||||
if ( $et_label.text() == $et_current_input.val() )
|
||||
$et_current_input.val( '' );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.et_fix_fullscreen_section = function() {
|
||||
var $et_window = $(window);
|
||||
|
||||
$( 'section.et_pb_fullscreen' ).each( function(){
|
||||
var $this_section = $( this );
|
||||
|
||||
$.proxy( et_calc_fullscreen_section, $this_section )();
|
||||
|
||||
$et_window.on( 'resize', $.proxy( et_calc_fullscreen_section, $this_section ) );
|
||||
});
|
||||
}
|
||||
})(jQuery)
|
||||
@@ -0,0 +1,56 @@
|
||||
(function($){
|
||||
// Turn of all hrefs which point to another page
|
||||
$('body').on( 'click', 'a', function( event ){
|
||||
var href = $(this).attr( 'href'),
|
||||
start = href.substr( 0, 1 );
|
||||
|
||||
// Stop the link if it points to another URL
|
||||
if ( start !== '#' && start !== '' ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Display notification
|
||||
$('.link-disabled').addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
// Prompt closing mechanism
|
||||
$('body').on( 'click', '.et_pb_prompt_proceed', function() {
|
||||
$('.link-disabled').removeClass('active');
|
||||
});
|
||||
|
||||
// Build preview screen
|
||||
ET_PageBuilder_Preview = function( e ) {
|
||||
// Create form on the fly
|
||||
var $form = $('<form id="preview-data-submission" method="POST"></form>'),
|
||||
value,
|
||||
data = e.data,
|
||||
msie = document.documentMode;
|
||||
|
||||
// Origins should be matched
|
||||
if ( e.origin !== et_preview_params.preview_origin ) {
|
||||
$('.et-pb-preview-loading').replaceWith( $('<h4 />', { 'style' : 'text-align: center;' } ).html( et_preview_params.alert_origin_not_matched ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// IE9 below fix. They have postMessage, but it has to be in string
|
||||
if ( typeof msie !== 'undefined' && msie < 10 ) {
|
||||
data = JSON.parse( data );
|
||||
}
|
||||
|
||||
// Loop postMessage data and append it to $form
|
||||
for ( name in data ) {
|
||||
$textarea = $('<textarea />', { name : name, style : "display: none; " }).val( data[name] );
|
||||
$textarea.appendTo( $form );
|
||||
}
|
||||
|
||||
$form.append( '<input type="submit" value="submit" style="display: none;" />' );
|
||||
|
||||
$form.appendTo( '.container' );
|
||||
|
||||
// Submit the form
|
||||
$('#preview-data-submission').submit();
|
||||
}
|
||||
|
||||
// listen to data passed from builder
|
||||
window.addEventListener( 'message', ET_PageBuilder_Preview, false );
|
||||
})(jQuery)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,363 @@
|
||||
/**!
|
||||
* easyPieChart
|
||||
* Lightweight plugin to render simple, animated and retina optimized pie charts
|
||||
*
|
||||
* @license
|
||||
* @author Robert Fleischmann <rendro87@gmail.com> (http://robert-fleischmann.de)
|
||||
* @version 2.1.5
|
||||
**/
|
||||
|
||||
(function(root, factory) {
|
||||
if(typeof exports === 'object') {
|
||||
module.exports = factory(require('jquery'));
|
||||
}
|
||||
else if(typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
}
|
||||
else {
|
||||
factory(root.jQuery);
|
||||
}
|
||||
}(this, function($) {
|
||||
|
||||
/**
|
||||
* Renderer to render the chart on a canvas object
|
||||
* @param {DOMElement} el DOM element to host the canvas (root of the plugin)
|
||||
* @param {object} options options object of the plugin
|
||||
*/
|
||||
var CanvasRenderer = function(el, options) {
|
||||
var cachedBackground;
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
el.appendChild(canvas);
|
||||
|
||||
if (typeof(G_vmlCanvasManager) !== 'undefined') {
|
||||
G_vmlCanvasManager.initElement(canvas);
|
||||
}
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = canvas.height = options.size;
|
||||
|
||||
// canvas on retina devices
|
||||
var scaleBy = 1;
|
||||
if (window.devicePixelRatio > 1) {
|
||||
scaleBy = window.devicePixelRatio;
|
||||
canvas.style.width = canvas.style.height = [options.size, 'px'].join('');
|
||||
canvas.width = canvas.height = options.size * scaleBy;
|
||||
ctx.scale(scaleBy, scaleBy);
|
||||
}
|
||||
|
||||
// move 0,0 coordinates to the center
|
||||
ctx.translate(options.size / 2, options.size / 2);
|
||||
|
||||
// rotate canvas -90deg
|
||||
ctx.rotate((-1 / 2 + options.rotate / 180) * Math.PI);
|
||||
|
||||
var radius = (options.size - options.lineWidth) / 2;
|
||||
if (options.scaleColor && options.scaleLength) {
|
||||
radius -= options.scaleLength + 2; // 2 is the distance between scale and bar
|
||||
}
|
||||
|
||||
// IE polyfill for Date
|
||||
Date.now = Date.now || function() {
|
||||
return +(new Date());
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw a circle around the center of the canvas
|
||||
* @param {strong} color Valid CSS color string
|
||||
* @param {number} lineWidth Width of the line in px
|
||||
* @param {number} percent Percentage to draw (float between -1 and 1)
|
||||
*/
|
||||
var drawCircle = function(color, lineWidth, percent, alpha ) {
|
||||
percent = Math.min(Math.max(-1, percent || 0), 1);
|
||||
var isNegative = percent <= 0 ? true : false;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, radius, 0, Math.PI * 2 * percent, isNegative);
|
||||
|
||||
ctx.strokeStyle = color;
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.lineWidth = lineWidth;
|
||||
|
||||
ctx.stroke();
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the scale of the chart
|
||||
*/
|
||||
var drawScale = function() {
|
||||
var offset;
|
||||
var length;
|
||||
|
||||
ctx.lineWidth = 1;
|
||||
ctx.fillStyle = options.scaleColor;
|
||||
|
||||
ctx.save();
|
||||
for (var i = 24; i > 0; --i) {
|
||||
if (i % 6 === 0) {
|
||||
length = options.scaleLength;
|
||||
offset = 0;
|
||||
} else {
|
||||
length = options.scaleLength * 0.6;
|
||||
offset = options.scaleLength - length;
|
||||
}
|
||||
ctx.fillRect(-options.size/2 + offset, 0, length, 1);
|
||||
ctx.rotate(Math.PI / 12);
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
/**
|
||||
* Request animation frame wrapper with polyfill
|
||||
* @return {function} Request animation frame method or timeout fallback
|
||||
*/
|
||||
var reqAnimationFrame = (function() {
|
||||
return window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
function(callback) {
|
||||
window.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* Draw the background of the plugin including the scale and the track
|
||||
*/
|
||||
var drawBackground = function() {
|
||||
if(options.scaleColor) drawScale();
|
||||
if(options.trackColor) drawCircle(options.trackColor, options.lineWidth, 1, options.trackAlpha );
|
||||
};
|
||||
|
||||
/**
|
||||
* Canvas accessor
|
||||
*/
|
||||
this.getCanvas = function() {
|
||||
return canvas;
|
||||
};
|
||||
|
||||
/**
|
||||
* Canvas 2D context 'ctx' accessor
|
||||
*/
|
||||
this.getCtx = function() {
|
||||
return ctx;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the complete canvas
|
||||
*/
|
||||
this.clear = function() {
|
||||
ctx.clearRect(options.size / -2, options.size / -2, options.size, options.size);
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the complete chart
|
||||
* @param {number} percent Percent shown by the chart between -100 and 100
|
||||
*/
|
||||
this.draw = function(percent) {
|
||||
// do we need to render a background
|
||||
if (!!options.scaleColor || !!options.trackColor) {
|
||||
// getImageData and putImageData are supported
|
||||
if (ctx.getImageData && ctx.putImageData) {
|
||||
if (!cachedBackground) {
|
||||
drawBackground();
|
||||
cachedBackground = ctx.getImageData(0, 0, options.size * scaleBy, options.size * scaleBy);
|
||||
} else {
|
||||
ctx.putImageData(cachedBackground, 0, 0);
|
||||
}
|
||||
} else {
|
||||
this.clear();
|
||||
drawBackground();
|
||||
}
|
||||
} else {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
ctx.lineCap = options.lineCap;
|
||||
|
||||
// if barcolor is a function execute it and pass the percent as a value
|
||||
var color;
|
||||
if (typeof(options.barColor) === 'function') {
|
||||
color = options.barColor(percent);
|
||||
} else {
|
||||
color = options.barColor;
|
||||
}
|
||||
|
||||
// draw bar
|
||||
drawCircle(color, options.lineWidth, percent / 100, options.barAlpha );
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Animate from some percent to some other percentage
|
||||
* @param {number} from Starting percentage
|
||||
* @param {number} to Final percentage
|
||||
*/
|
||||
this.animate = function(from, to) {
|
||||
var startTime = Date.now();
|
||||
options.onStart(from, to);
|
||||
var animation = function() {
|
||||
var process = Math.min(Date.now() - startTime, options.animate.duration);
|
||||
var currentValue = options.easing(this, process, from, to - from, options.animate.duration);
|
||||
this.draw(currentValue);
|
||||
options.onStep(from, to, currentValue);
|
||||
if (process >= options.animate.duration) {
|
||||
options.onStop(from, to);
|
||||
} else {
|
||||
reqAnimationFrame(animation);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
reqAnimationFrame(animation);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
var EasyPieChart = function(el, opts) {
|
||||
var defaultOptions = {
|
||||
barColor: '#ef1e25',
|
||||
barAlpha: 1.0,
|
||||
trackColor: '#f9f9f9',
|
||||
trackAlpha: 1.0,
|
||||
scaleColor: '#dfe0e0',
|
||||
scaleLength: 5,
|
||||
lineCap: 'round',
|
||||
lineWidth: 3,
|
||||
size: 110,
|
||||
rotate: 0,
|
||||
render: true,
|
||||
animate: {
|
||||
duration: 1000,
|
||||
enabled: true
|
||||
},
|
||||
easing: function (x, t, b, c, d) { // more can be found here: http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
t = t / (d/2);
|
||||
if (t < 1) {
|
||||
return c / 2 * t * t + b;
|
||||
}
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
onStart: function(from, to) {
|
||||
return;
|
||||
},
|
||||
onStep: function(from, to, currentValue) {
|
||||
return;
|
||||
},
|
||||
onStop: function(from, to) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// detect present renderer
|
||||
if (typeof(CanvasRenderer) !== 'undefined') {
|
||||
defaultOptions.renderer = CanvasRenderer;
|
||||
} else if (typeof(SVGRenderer) !== 'undefined') {
|
||||
defaultOptions.renderer = SVGRenderer;
|
||||
} else {
|
||||
throw new Error('Please load either the SVG- or the CanvasRenderer');
|
||||
}
|
||||
|
||||
var options = {};
|
||||
var currentValue = 0;
|
||||
|
||||
/**
|
||||
* Initialize the plugin by creating the options object and initialize rendering
|
||||
*/
|
||||
var init = function() {
|
||||
this.el = el;
|
||||
this.options = options;
|
||||
|
||||
// merge user options into default options
|
||||
for (var i in defaultOptions) {
|
||||
if (defaultOptions.hasOwnProperty(i)) {
|
||||
options[i] = opts && typeof(opts[i]) !== 'undefined' ? opts[i] : defaultOptions[i];
|
||||
if (typeof(options[i]) === 'function') {
|
||||
options[i] = options[i].bind(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check for jQuery easing
|
||||
if (typeof(options.easing) === 'string' && typeof(jQuery) !== 'undefined' && jQuery.isFunction(jQuery.easing[options.easing])) {
|
||||
options.easing = jQuery.easing[options.easing];
|
||||
} else {
|
||||
options.easing = defaultOptions.easing;
|
||||
}
|
||||
|
||||
// process earlier animate option to avoid bc breaks
|
||||
if (typeof(options.animate) === 'number') {
|
||||
options.animate = {
|
||||
duration: options.animate,
|
||||
enabled: true
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof(options.animate) === 'boolean' && !options.animate) {
|
||||
options.animate = {
|
||||
duration: 1000,
|
||||
enabled: options.animate
|
||||
};
|
||||
}
|
||||
|
||||
// create renderer
|
||||
this.renderer = new options.renderer(el, options);
|
||||
|
||||
// initial draw
|
||||
this.renderer.draw(currentValue);
|
||||
|
||||
// initial update
|
||||
if (el.dataset && el.dataset.percent) {
|
||||
this.update(parseFloat(el.dataset.percent));
|
||||
} else if (el.getAttribute && el.getAttribute('data-percent')) {
|
||||
this.update(parseFloat(el.getAttribute('data-percent')));
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Update the value of the chart
|
||||
* @param {number} newValue Number between 0 and 100
|
||||
* @return {object} Instance of the plugin for method chaining
|
||||
*/
|
||||
this.update = function(newValue) {
|
||||
newValue = parseFloat(newValue);
|
||||
if (options.animate.enabled) {
|
||||
this.renderer.animate(currentValue, newValue);
|
||||
} else {
|
||||
this.renderer.draw(newValue);
|
||||
}
|
||||
currentValue = newValue;
|
||||
return this;
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Disable animation
|
||||
* @return {object} Instance of the plugin for method chaining
|
||||
*/
|
||||
this.disableAnimation = function() {
|
||||
options.animate.enabled = false;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable animation
|
||||
* @return {object} Instance of the plugin for method chaining
|
||||
*/
|
||||
this.enableAnimation = function() {
|
||||
options.animate.enabled = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
$.fn.easyPieChart = function(options) {
|
||||
return this.each(function() {
|
||||
var instanceOptions;
|
||||
|
||||
if (!$.data(this, 'easyPieChart')) {
|
||||
instanceOptions = $.extend({}, options, $(this).data());
|
||||
$.data(this, 'easyPieChart', new EasyPieChart(this, instanceOptions));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,88 @@
|
||||
/*global jQuery */
|
||||
/*jshint multistr:true browser:true */
|
||||
/*!
|
||||
* FitVids 1.0
|
||||
*
|
||||
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
||||
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
||||
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
||||
*
|
||||
* Date: Thu Sept 01 18:00:00 2011 -0500
|
||||
*/
|
||||
|
||||
(function( $ ){
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.fitVids = function( options ) {
|
||||
var settings = {
|
||||
customSelector: null
|
||||
};
|
||||
|
||||
if(!document.getElementById('fit-vids-style')) {
|
||||
|
||||
var div = document.createElement('div'),
|
||||
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
|
||||
|
||||
div.className = 'fit-vids-style';
|
||||
div.id = 'fit-vids-style';
|
||||
div.style.display = 'none';
|
||||
div.innerHTML = '­<style> \
|
||||
.fluid-width-video-wrapper { \
|
||||
width: 100%; \
|
||||
position: relative; \
|
||||
padding: 0; \
|
||||
} \
|
||||
\
|
||||
.fluid-width-video-wrapper iframe, \
|
||||
.fluid-width-video-wrapper object, \
|
||||
.fluid-width-video-wrapper embed { \
|
||||
position: absolute; \
|
||||
top: 0; \
|
||||
left: 0; \
|
||||
width: 100%; \
|
||||
height: 100%; \
|
||||
} \
|
||||
</style>';
|
||||
|
||||
ref.parentNode.insertBefore(div,ref);
|
||||
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
$.extend( settings, options );
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var selectors = [
|
||||
"iframe[src*='player.vimeo.com']",
|
||||
"iframe[src*='youtube.com']",
|
||||
"iframe[src*='youtube-nocookie.com']",
|
||||
"iframe[src*='kickstarter.com'][src*='video.html']",
|
||||
"object",
|
||||
"embed"
|
||||
];
|
||||
|
||||
if (settings.customSelector) {
|
||||
selectors.push(settings.customSelector);
|
||||
}
|
||||
|
||||
var $allVideos = $(this).find(selectors.join(','));
|
||||
$allVideos = $allVideos.not("object object"); // SwfObj conflict patch
|
||||
|
||||
$allVideos.each(function(){
|
||||
var $this = $(this);
|
||||
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
||||
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
||||
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
||||
aspectRatio = height / width;
|
||||
if(!$this.attr('id')){
|
||||
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
|
||||
$this.attr('id', videoID);
|
||||
}
|
||||
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
|
||||
$this.removeAttr('height').removeAttr('width');
|
||||
});
|
||||
});
|
||||
};
|
||||
})( jQuery );
|
||||
@@ -0,0 +1,390 @@
|
||||
/*!
|
||||
* jQuery hashchange event - v1.3 - 7/21/2010
|
||||
* http://benalman.com/projects/jquery-hashchange-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
|
||||
// Script: jQuery hashchange event
|
||||
//
|
||||
// *Version: 1.3, Last updated: 7/21/2010*
|
||||
//
|
||||
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
|
||||
// GitHub - http://github.com/cowboy/jquery-hashchange/
|
||||
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
|
||||
// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped)
|
||||
//
|
||||
// About: License
|
||||
//
|
||||
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
||||
// Dual licensed under the MIT and GPL licenses.
|
||||
// http://benalman.com/about/license/
|
||||
//
|
||||
// About: Examples
|
||||
//
|
||||
// These working examples, complete with fully commented code, illustrate a few
|
||||
// ways in which this plugin can be used.
|
||||
//
|
||||
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
|
||||
// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
|
||||
//
|
||||
// About: Support and Testing
|
||||
//
|
||||
// Information about what version or versions of jQuery this plugin has been
|
||||
// tested with, what browsers it has been tested in, and where the unit tests
|
||||
// reside (so you can test it yourself).
|
||||
//
|
||||
// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
|
||||
// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
|
||||
// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
|
||||
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
|
||||
//
|
||||
// About: Known issues
|
||||
//
|
||||
// While this jQuery hashchange event implementation is quite stable and
|
||||
// robust, there are a few unfortunate browser bugs surrounding expected
|
||||
// hashchange event-based behaviors, independent of any JavaScript
|
||||
// window.onhashchange abstraction. See the following examples for more
|
||||
// information:
|
||||
//
|
||||
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
|
||||
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
|
||||
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
|
||||
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
|
||||
//
|
||||
// Also note that should a browser natively support the window.onhashchange
|
||||
// event, but not report that it does, the fallback polling loop will be used.
|
||||
//
|
||||
// About: Release History
|
||||
//
|
||||
// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
|
||||
// "removable" for mobile-only development. Added IE6/7 document.title
|
||||
// support. Attempted to make Iframe as hidden as possible by using
|
||||
// techniques from http://www.paciellogroup.com/blog/?p=604. Added
|
||||
// support for the "shortcut" format $(window).hashchange( fn ) and
|
||||
// $(window).hashchange() like jQuery provides for built-in events.
|
||||
// Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and
|
||||
// lowered its default value to 50. Added <jQuery.fn.hashchange.domain>
|
||||
// and <jQuery.fn.hashchange.src> properties plus document-domain.html
|
||||
// file to address access denied issues when setting document.domain in
|
||||
// IE6/7.
|
||||
// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
|
||||
// from a page on another domain would cause an error in Safari 4. Also,
|
||||
// IE6/7 Iframe is now inserted after the body (this actually works),
|
||||
// which prevents the page from scrolling when the event is first bound.
|
||||
// Event can also now be bound before DOM ready, but it won't be usable
|
||||
// before then in IE6/7.
|
||||
// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
|
||||
// where browser version is incorrectly reported as 8.0, despite
|
||||
// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
|
||||
// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
|
||||
// window.onhashchange functionality into a separate plugin for users
|
||||
// who want just the basic event & back button support, without all the
|
||||
// extra awesomeness that BBQ provides. This plugin will be included as
|
||||
// part of jQuery BBQ, but also be available separately.
|
||||
|
||||
(function($,window,undefined){
|
||||
'$:nomunge'; // Used by YUI compressor.
|
||||
|
||||
// Reused string.
|
||||
var str_hashchange = 'hashchange',
|
||||
|
||||
// Method / object references.
|
||||
doc = document,
|
||||
fake_onhashchange,
|
||||
special = $.event.special,
|
||||
|
||||
// Does the browser support window.onhashchange? Note that IE8 running in
|
||||
// IE7 compatibility mode reports true for 'onhashchange' in window, even
|
||||
// though the event isn't supported, so also test document.documentMode.
|
||||
doc_mode = doc.documentMode,
|
||||
supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
|
||||
|
||||
// Get location.hash (or what you'd expect location.hash to be) sans any
|
||||
// leading #. Thanks for making this necessary, Firefox!
|
||||
function get_fragment( url ) {
|
||||
url = url || location.href;
|
||||
return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
|
||||
};
|
||||
|
||||
// Method: jQuery.fn.hashchange
|
||||
//
|
||||
// Bind a handler to the window.onhashchange event or trigger all bound
|
||||
// window.onhashchange event handlers. This behavior is consistent with
|
||||
// jQuery's built-in event handlers.
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// > jQuery(window).hashchange( [ handler ] );
|
||||
//
|
||||
// Arguments:
|
||||
//
|
||||
// handler - (Function) Optional handler to be bound to the hashchange
|
||||
// event. This is a "shortcut" for the more verbose form:
|
||||
// jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
|
||||
// all bound window.onhashchange event handlers will be triggered. This
|
||||
// is a shortcut for the more verbose
|
||||
// jQuery(window).trigger( 'hashchange' ). These forms are described in
|
||||
// the <hashchange event> section.
|
||||
//
|
||||
// Returns:
|
||||
//
|
||||
// (jQuery) The initial jQuery collection of elements.
|
||||
|
||||
// Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
|
||||
// $(elem).hashchange() for triggering, like jQuery does for built-in events.
|
||||
$.fn[ str_hashchange ] = function( fn ) {
|
||||
return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
|
||||
};
|
||||
|
||||
// Property: jQuery.fn.hashchange.delay
|
||||
//
|
||||
// The numeric interval (in milliseconds) at which the <hashchange event>
|
||||
// polling loop executes. Defaults to 50.
|
||||
|
||||
// Property: jQuery.fn.hashchange.domain
|
||||
//
|
||||
// If you're setting document.domain in your JavaScript, and you want hash
|
||||
// history to work in IE6/7, not only must this property be set, but you must
|
||||
// also set document.domain BEFORE jQuery is loaded into the page. This
|
||||
// property is only applicable if you are supporting IE6/7 (or IE8 operating
|
||||
// in "IE7 compatibility" mode).
|
||||
//
|
||||
// In addition, the <jQuery.fn.hashchange.src> property must be set to the
|
||||
// path of the included "document-domain.html" file, which can be renamed or
|
||||
// modified if necessary (note that the document.domain specified must be the
|
||||
// same in both your main JavaScript as well as in this file).
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// jQuery.fn.hashchange.domain = document.domain;
|
||||
|
||||
// Property: jQuery.fn.hashchange.src
|
||||
//
|
||||
// If, for some reason, you need to specify an Iframe src file (for example,
|
||||
// when setting document.domain as in <jQuery.fn.hashchange.domain>), you can
|
||||
// do so using this property. Note that when using this property, history
|
||||
// won't be recorded in IE6/7 until the Iframe src file loads. This property
|
||||
// is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
|
||||
// compatibility" mode).
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// jQuery.fn.hashchange.src = 'path/to/file.html';
|
||||
|
||||
$.fn[ str_hashchange ].delay = 50;
|
||||
/*
|
||||
$.fn[ str_hashchange ].domain = null;
|
||||
$.fn[ str_hashchange ].src = null;
|
||||
*/
|
||||
|
||||
// Event: hashchange event
|
||||
//
|
||||
// Fired when location.hash changes. In browsers that support it, the native
|
||||
// HTML5 window.onhashchange event is used, otherwise a polling loop is
|
||||
// initialized, running every <jQuery.fn.hashchange.delay> milliseconds to
|
||||
// see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
|
||||
// compatibility" mode), a hidden Iframe is created to allow the back button
|
||||
// and hash-based history to work.
|
||||
//
|
||||
// Usage as described in <jQuery.fn.hashchange>:
|
||||
//
|
||||
// > // Bind an event handler.
|
||||
// > jQuery(window).hashchange( function(e) {
|
||||
// > var hash = location.hash;
|
||||
// > ...
|
||||
// > });
|
||||
// >
|
||||
// > // Manually trigger the event handler.
|
||||
// > jQuery(window).hashchange();
|
||||
//
|
||||
// A more verbose usage that allows for event namespacing:
|
||||
//
|
||||
// > // Bind an event handler.
|
||||
// > jQuery(window).bind( 'hashchange', function(e) {
|
||||
// > var hash = location.hash;
|
||||
// > ...
|
||||
// > });
|
||||
// >
|
||||
// > // Manually trigger the event handler.
|
||||
// > jQuery(window).trigger( 'hashchange' );
|
||||
//
|
||||
// Additional Notes:
|
||||
//
|
||||
// * The polling loop and Iframe are not created until at least one handler
|
||||
// is actually bound to the 'hashchange' event.
|
||||
// * If you need the bound handler(s) to execute immediately, in cases where
|
||||
// a location.hash exists on page load, via bookmark or page refresh for
|
||||
// example, use jQuery(window).hashchange() or the more verbose
|
||||
// jQuery(window).trigger( 'hashchange' ).
|
||||
// * The event can be bound before DOM ready, but since it won't be usable
|
||||
// before then in IE6/7 (due to the necessary Iframe), recommended usage is
|
||||
// to bind it inside a DOM ready handler.
|
||||
|
||||
// Override existing $.event.special.hashchange methods (allowing this plugin
|
||||
// to be defined after jQuery BBQ in BBQ's source code).
|
||||
special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
|
||||
|
||||
// Called only when the first 'hashchange' event is bound to window.
|
||||
setup: function() {
|
||||
// If window.onhashchange is supported natively, there's nothing to do..
|
||||
if ( supports_onhashchange ) { return false; }
|
||||
|
||||
// Otherwise, we need to create our own. And we don't want to call this
|
||||
// until the user binds to the event, just in case they never do, since it
|
||||
// will create a polling loop and possibly even a hidden Iframe.
|
||||
$( fake_onhashchange.start );
|
||||
},
|
||||
|
||||
// Called only when the last 'hashchange' event is unbound from window.
|
||||
teardown: function() {
|
||||
// If window.onhashchange is supported natively, there's nothing to do..
|
||||
if ( supports_onhashchange ) { return false; }
|
||||
|
||||
// Otherwise, we need to stop ours (if possible).
|
||||
$( fake_onhashchange.stop );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// fake_onhashchange does all the work of triggering the window.onhashchange
|
||||
// event for browsers that don't natively support it, including creating a
|
||||
// polling loop to watch for hash changes and in IE 6/7 creating a hidden
|
||||
// Iframe to enable back and forward.
|
||||
fake_onhashchange = (function(){
|
||||
var self = {},
|
||||
timeout_id,
|
||||
|
||||
// Remember the initial hash so it doesn't get triggered immediately.
|
||||
last_hash = get_fragment(),
|
||||
|
||||
fn_retval = function(val){ return val; },
|
||||
history_set = fn_retval,
|
||||
history_get = fn_retval;
|
||||
|
||||
// Start the polling loop.
|
||||
self.start = function() {
|
||||
timeout_id || poll();
|
||||
};
|
||||
|
||||
// Stop the polling loop.
|
||||
self.stop = function() {
|
||||
timeout_id && clearTimeout( timeout_id );
|
||||
timeout_id = undefined;
|
||||
};
|
||||
|
||||
// This polling loop checks every $.fn.hashchange.delay milliseconds to see
|
||||
// if location.hash has changed, and triggers the 'hashchange' event on
|
||||
// window when necessary.
|
||||
function poll() {
|
||||
var hash = get_fragment(),
|
||||
history_hash = history_get( last_hash );
|
||||
|
||||
if ( hash !== last_hash ) {
|
||||
history_set( last_hash = hash, history_hash );
|
||||
|
||||
$(window).trigger( str_hashchange );
|
||||
|
||||
} else if ( history_hash !== last_hash ) {
|
||||
location.href = location.href.replace( /#.*/, '' ) + history_hash;
|
||||
}
|
||||
|
||||
timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
|
||||
};
|
||||
|
||||
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
|
||||
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
$.browser.msie && !supports_onhashchange && (function(){
|
||||
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
|
||||
// when running in "IE7 compatibility" mode.
|
||||
|
||||
var iframe,
|
||||
iframe_src;
|
||||
|
||||
// When the event is bound and polling starts in IE 6/7, create a hidden
|
||||
// Iframe for history handling.
|
||||
self.start = function(){
|
||||
if ( !iframe ) {
|
||||
iframe_src = $.fn[ str_hashchange ].src;
|
||||
iframe_src = iframe_src && iframe_src + get_fragment();
|
||||
|
||||
// Create hidden Iframe. Attempt to make Iframe as hidden as possible
|
||||
// by using techniques from http://www.paciellogroup.com/blog/?p=604.
|
||||
iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
|
||||
|
||||
// When Iframe has completely loaded, initialize the history and
|
||||
// start polling.
|
||||
.one( 'load', function(){
|
||||
iframe_src || history_set( get_fragment() );
|
||||
poll();
|
||||
})
|
||||
|
||||
// Load Iframe src if specified, otherwise nothing.
|
||||
.attr( 'src', iframe_src || 'javascript:0' )
|
||||
|
||||
// Append Iframe after the end of the body to prevent unnecessary
|
||||
// initial page scrolling (yes, this works).
|
||||
.insertAfter( 'body' )[0].contentWindow;
|
||||
|
||||
// Whenever `document.title` changes, update the Iframe's title to
|
||||
// prettify the back/next history menu entries. Since IE sometimes
|
||||
// errors with "Unspecified error" the very first time this is set
|
||||
// (yes, very useful) wrap this with a try/catch block.
|
||||
doc.onpropertychange = function(){
|
||||
try {
|
||||
if ( event.propertyName === 'title' ) {
|
||||
iframe.document.title = doc.title;
|
||||
}
|
||||
} catch(e) {}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Override the "stop" method since an IE6/7 Iframe was created. Even
|
||||
// if there are no longer any bound event handlers, the polling loop
|
||||
// is still necessary for back/next to work at all!
|
||||
self.stop = fn_retval;
|
||||
|
||||
// Get history by looking at the hidden Iframe's location.hash.
|
||||
history_get = function() {
|
||||
return get_fragment( iframe.location.href );
|
||||
};
|
||||
|
||||
// Set a new history item by opening and then closing the Iframe
|
||||
// document, *then* setting its location.hash. If document.domain has
|
||||
// been set, update that as well.
|
||||
history_set = function( hash, history_hash ) {
|
||||
var iframe_doc = iframe.document,
|
||||
domain = $.fn[ str_hashchange ].domain;
|
||||
|
||||
if ( hash !== history_hash ) {
|
||||
// Update Iframe with any initial `document.title` that might be set.
|
||||
iframe_doc.title = doc.title;
|
||||
|
||||
// Opening the Iframe's document after it has been closed is what
|
||||
// actually adds a history entry.
|
||||
iframe_doc.open();
|
||||
|
||||
// Set document.domain for the Iframe document as well, if necessary.
|
||||
domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
|
||||
|
||||
iframe_doc.close();
|
||||
|
||||
// Update the Iframe's hash, for great justice.
|
||||
iframe.location.hash = hash;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
||||
})(jQuery,this);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,200 @@
|
||||
(function($){
|
||||
$( document ).ready( function() {
|
||||
var url = window.location.href,
|
||||
tab_link = url.split( 'edit.php' )[1];
|
||||
|
||||
if ( typeof tab_link !== 'undefined' ) {
|
||||
var $menu_items = $( '#toplevel_page_et_divi_library' ).find( '.wp-submenu li' );
|
||||
$menu_items.removeClass( 'current' );
|
||||
$menu_items.find( 'a' ).each( function() {
|
||||
var $this_el = $( this ),
|
||||
this_href = $this_el.attr( 'href' ),
|
||||
full_tab_link = 'edit.php' + tab_link;
|
||||
if ( -1 !== full_tab_link.indexOf( this_href ) ) {
|
||||
$this_el.closest( 'li' ).addClass( 'current' );
|
||||
}
|
||||
});
|
||||
$( '#toplevel_page_et_divi_library' ).removeClass( 'wp-not-current-submenu' ).addClass( 'wp-has-current-submenu' );
|
||||
$( 'a.toplevel_page_et_divi_library' ).removeClass( 'wp-not-current-submenu' ).addClass( 'wp-has-current-submenu wp-menu-open' );
|
||||
}
|
||||
|
||||
$( 'body' ).on( 'click', '.add-new-h2, a.page-title-action', function() {
|
||||
var all_cats = $.parseJSON( et_pb_new_template_options.layout_cats ),
|
||||
$modal = '',
|
||||
cats_selector = '<label>' + et_pb_new_template_options.cats_label + '</label>';
|
||||
|
||||
if( ! $.isEmptyObject( all_cats ) ) {
|
||||
cats_selector += '<div class="layout_cats_container">';
|
||||
|
||||
$.each( all_cats, function( i, single_cat ) {
|
||||
if ( ! $.isEmptyObject( single_cat ) ) {
|
||||
cats_selector += '<label>' + single_cat.name + '<input type="checkbox" value="' + single_cat.id + '"/></label>';
|
||||
}
|
||||
});
|
||||
|
||||
cats_selector += '</div>';
|
||||
}
|
||||
|
||||
cats_selector += '<input type="text" value="" id="et_pb_new_cat_name" class="regular-text">';
|
||||
|
||||
$modal = "<div class='et_pb_modal_overlay et_modal_on_top et_pb_new_template_modal'>\
|
||||
<div class='et_pb_prompt_modal'>\
|
||||
<h2>" + et_pb_new_template_options.modal_text + "</h2>\
|
||||
<div class='et_pb_prompt_modal_inside'>\
|
||||
<label>" + et_pb_new_template_options.modal_name + "</label> \
|
||||
<input type='text' value='' id='et_pb_new_template_name' class='regular-text'>\
|
||||
<label>" + et_pb_new_template_options.modal_type + "</label> \
|
||||
<select id='new_template_type'>\
|
||||
<option value='module'>" + et_pb_new_template_options.module_text + "</option>\
|
||||
<option value='fullwidth_module'>" + et_pb_new_template_options.fw_module_text + "</option>\
|
||||
<option value='row'>" + et_pb_new_template_options.row_text + "</option>\
|
||||
<option value='section'>" + et_pb_new_template_options.section_text + "</option>\
|
||||
<option value='fullwidth_section'>" + et_pb_new_template_options.fw_section_text + "</option>\
|
||||
<option value='specialty_section'>" + et_pb_new_template_options.sp_section_text + "</option>\
|
||||
<option value='layout'>" + et_pb_new_template_options.layout_text + "</option>\
|
||||
</select>\
|
||||
<div class='et_module_tabs_options'>\
|
||||
<label>" + et_pb_new_template_options.general_text + "<input type='checkbox' value='general' id='et_pb_template_general' checked /></label> \
|
||||
<label>" + et_pb_new_template_options.adv_text + "<input type='checkbox' value='advanced' id='et_pb_template_general' checked /></label> \
|
||||
<label>" + et_pb_new_template_options.css_text + "<input type='checkbox' value='css' id='et_pb_template_general' checked /></label> \
|
||||
<p class='et_pb_error_message_save_template' style='display: none;'>" + et_pb_new_template_options.tabs_error + "</p> \
|
||||
</div>\
|
||||
<label>" + et_pb_new_template_options.global_text + "<input type='checkbox' value='' id='et_pb_template_global'></label>\
|
||||
" + cats_selector + " \
|
||||
<input id='et_builder_layout_built_for_post_type' type='hidden' value='et_pb_layout'>\
|
||||
</div>\
|
||||
<a href='#' class='et_pb_prompt_dont_proceed et-pb-modal-close'></a>\
|
||||
<div class='et_pb_prompt_buttons'>\
|
||||
<br>\
|
||||
<span class='spinner'></span>\
|
||||
<input type='submit' class='et_pb_create_template button-primary et_pb_prompt_proceed'>\
|
||||
</div>";
|
||||
|
||||
$( 'body' ).append( $modal );
|
||||
return false;
|
||||
} );
|
||||
|
||||
$( 'body' ).on( 'click', '.et_pb_prompt_dont_proceed', function() {
|
||||
$( this ).closest( '.et_pb_modal_overlay' ).remove();
|
||||
} );
|
||||
|
||||
$( 'body' ).on( 'change', '#new_template_type', function() {
|
||||
var selected_type = $( this ).val();
|
||||
|
||||
if ( 'module' === selected_type || 'fullwidth_module' === selected_type ) {
|
||||
$( '.et_module_tabs_options' ).css( 'display', 'block' );
|
||||
} else {
|
||||
$( '.et_module_tabs_options' ).css( 'display', 'none' );
|
||||
}
|
||||
} );
|
||||
|
||||
$( 'body' ).on( 'click', '.et_pb_create_template:not(.clicked_button)', function() {
|
||||
var $this_button = $( this ),
|
||||
$this_form = $this_button.closest( '.et_pb_prompt_modal' ),
|
||||
template_name = $this_form.find( '#et_pb_new_template_name' ).val();
|
||||
|
||||
if ( '' === template_name ) {
|
||||
$this_form.find( '#et_pb_new_template_name' ).focus();
|
||||
} else {
|
||||
var template_shortcode = '',
|
||||
layout_scope = $this_form.find( $( '#et_pb_template_global' ) ).is( ':checked' ) ? 'global' : 'not_global',
|
||||
layout_type = $this_form.find( '#new_template_type' ).val(),
|
||||
module_width = 'regular',
|
||||
template_built_for_post_type = '',
|
||||
selected_tabs = '',
|
||||
selected_cats = '',
|
||||
new_cat = $this_form.find( '#et_pb_new_cat_name' ).val();
|
||||
|
||||
if ( 'module' === layout_type || 'fullwidth_module' === layout_type ) {
|
||||
if ( ! $( '.et_module_tabs_options input' ).is( ':checked' ) ) {
|
||||
$( '.et_pb_error_message_save_template' ).css( "display", "block" );
|
||||
return;
|
||||
} else {
|
||||
selected_tabs = '';
|
||||
|
||||
$( '.et_module_tabs_options input' ).each( function() {
|
||||
var this_input = $( this );
|
||||
|
||||
if ( this_input.is( ':checked' ) ) {
|
||||
selected_tabs += '' !== selected_tabs ? ',' + this_input.val() : this_input.val();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
selected_tabs = 'general,advanced,css' === selected_tabs ? 'all' : selected_tabs;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $( '.layout_cats_container input' ).is( ':checked' ) ) {
|
||||
|
||||
$( '.layout_cats_container input' ).each( function() {
|
||||
var this_input = $( this );
|
||||
|
||||
if ( this_input.is( ':checked' ) ) {
|
||||
selected_cats += '' !== selected_cats ? ',' + this_input.val() : this_input.val();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
switch ( layout_type ) {
|
||||
case 'row' :
|
||||
template_shortcode = '[et_pb_row template_type="row"][/et_pb_row]';
|
||||
break;
|
||||
case 'section' :
|
||||
template_shortcode = '[et_pb_section template_type="section"][et_pb_row][/et_pb_row][/et_pb_section]';
|
||||
break;
|
||||
case 'module' :
|
||||
template_shortcode = '[et_pb_module_placeholder selected_tabs="' + selected_tabs + '"]';
|
||||
break;
|
||||
case 'fullwidth_module' :
|
||||
template_shortcode = '[et_pb_fullwidth_module_placeholder selected_tabs="' + selected_tabs + '"]';
|
||||
module_width = 'fullwidth';
|
||||
layout_type = 'module';
|
||||
break;
|
||||
case 'fullwidth_section' :
|
||||
template_shortcode = '[et_pb_section template_type="section" fullwidth="on"][/et_pb_section]';
|
||||
layout_type = 'section';
|
||||
break;
|
||||
case 'specialty_section' :
|
||||
template_shortcode = '[et_pb_section template_type="section" specialty="on" skip_module="true" specialty_placeholder="true"][/et_pb_section]';
|
||||
layout_type = 'section';
|
||||
break;
|
||||
}
|
||||
|
||||
$this_button.addClass( 'clicked_button' );
|
||||
$this_button.closest( '.et_pb_prompt_buttons' ).find( '.spinner' ).addClass( 'et_pb_visible_spinner' );
|
||||
|
||||
$.ajax( {
|
||||
type: "POST",
|
||||
url: et_pb_new_template_options.ajaxurl,
|
||||
dataType: 'json',
|
||||
data:
|
||||
{
|
||||
action : 'et_pb_save_layout',
|
||||
et_load_nonce : et_pb_new_template_options.et_load_nonce,
|
||||
et_layout_name : template_name,
|
||||
et_layout_built_for_post_type: template_built_for_post_type,
|
||||
et_layout_content : template_shortcode,
|
||||
et_layout_scope : layout_scope,
|
||||
et_layout_type : layout_type,
|
||||
et_module_width : module_width,
|
||||
et_layout_cats : selected_cats,
|
||||
et_layout_new_cat : new_cat
|
||||
},
|
||||
success: function( data ) {
|
||||
window.location.href = decodeURIComponent( unescape( data.edit_link ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
$( '#et_show_export_section' ).click( function() {
|
||||
var this_link = $( this ),
|
||||
margin_value = this_link.hasClass( 'et_pb_opened' ) ? '-100%' : '0';
|
||||
|
||||
$( '.et_pb_export_section' ).animate( { marginTop: margin_value }, 500 );
|
||||
this_link.toggleClass( 'et_pb_opened' );
|
||||
});
|
||||
});
|
||||
})(jQuery)
|
||||
176
wp-content/themes/Divi/includes/builder/scripts/roles_admin.js
Normal file
176
wp-content/themes/Divi/includes/builder/scripts/roles_admin.js
Normal file
@@ -0,0 +1,176 @@
|
||||
(function($){
|
||||
$( document ).ready( function() {
|
||||
var $container = $( '.et_pb_roles_options_container' ),
|
||||
$yes_no_button_wrapper = $container.find( '.et_pb_yes_no_button_wrapper' ),
|
||||
$yes_no_button = $container.find( '.et_pb_yes_no_button' ),
|
||||
$yes_no_select = $container.find( 'select' ),
|
||||
$body = $( 'body' );
|
||||
|
||||
$yes_no_button_wrapper.each( function() {
|
||||
var $this_el = $( this ),
|
||||
$this_switcher = $this_el.find( '.et_pb_yes_no_button' ),
|
||||
selected_value = $this_el.find( 'select' ).val();
|
||||
|
||||
if ( 'on' === selected_value ) {
|
||||
$this_switcher.removeClass( 'et_pb_off_state' );
|
||||
$this_switcher.addClass( 'et_pb_on_state' );
|
||||
} else {
|
||||
$this_switcher.removeClass( 'et_pb_on_state' );
|
||||
$this_switcher.addClass( 'et_pb_off_state' );
|
||||
}
|
||||
});
|
||||
|
||||
$yes_no_button.click( function() {
|
||||
var $this_el = $( this ),
|
||||
$this_select = $this_el.closest( '.et_pb_yes_no_button_wrapper' ).find( 'select' );
|
||||
|
||||
if ( $this_el.hasClass( 'et_pb_off_state') ) {
|
||||
$this_el.removeClass( 'et_pb_off_state' );
|
||||
$this_el.addClass( 'et_pb_on_state' );
|
||||
$this_select.val( 'on' );
|
||||
} else {
|
||||
$this_el.removeClass( 'et_pb_on_state' );
|
||||
$this_el.addClass( 'et_pb_off_state' );
|
||||
$this_select.val( 'off' );
|
||||
}
|
||||
|
||||
$this_select.trigger( 'change' );
|
||||
});
|
||||
|
||||
$yes_no_select.change( function() {
|
||||
var $this_el = $( this ),
|
||||
$this_switcher = $this_el.closest( '.et_pb_yes_no_button_wrapper' ).find( '.et_pb_yes_no_button' ),
|
||||
new_value = $this_el.val();
|
||||
|
||||
if ( 'on' === new_value ) {
|
||||
$this_switcher.removeClass( 'et_pb_off_state' );
|
||||
$this_switcher.addClass( 'et_pb_on_state' );
|
||||
} else {
|
||||
$this_switcher.removeClass( 'et_pb_on_state' );
|
||||
$this_switcher.addClass( 'et_pb_off_state' );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$( '.et-pb-layout-buttons:not(.et-pb-layout-buttons-reset)' ).click( function() {
|
||||
var $clicked_tab = $( this ),
|
||||
open_tab = $clicked_tab.data( 'open_tab' );
|
||||
|
||||
$( '.et_pb_roles_options_container.active-container' ).css( { 'display' : 'block', 'opacity' : 1 } ).stop( true, true ).animate( { opacity : 0 }, 300, function() {
|
||||
var $this_container = $( this );
|
||||
$this_container.css( 'display', 'none' );
|
||||
$this_container.removeClass( 'active-container' );
|
||||
$( '.' + open_tab ).addClass( 'active-container' ).css( { 'display' : 'block', 'opacity' : 0 } ).stop( true, true ).animate( { opacity : 1 }, 300 );
|
||||
});
|
||||
|
||||
$( '.et-pb-layout-buttons' ).removeClass( 'et_pb_roles_active_menu' );
|
||||
|
||||
$clicked_tab.addClass( 'et_pb_roles_active_menu' );
|
||||
});
|
||||
|
||||
$( '#et_pb_save_roles' ).click( function() {
|
||||
var $all_options = $( '.et_pb_roles_container_all' ).find( 'form' ),
|
||||
all_options_array = {},
|
||||
options_combined = '';
|
||||
|
||||
$all_options.each( function() {
|
||||
var this_form = $( this ),
|
||||
form_id = this_form.data( 'role_id' ),
|
||||
form_settings = this_form.serialize();
|
||||
|
||||
all_options_array[form_id] = form_settings;
|
||||
});
|
||||
|
||||
options_combined = JSON.stringify( all_options_array );
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: et_pb_roles_options.ajaxurl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action : 'et_pb_save_role_settings',
|
||||
et_pb_options_all : options_combined,
|
||||
et_pb_save_roles_nonce : et_pb_roles_options.et_roles_nonce
|
||||
},
|
||||
beforeSend: function ( xhr ){
|
||||
$( '#et_pb_loading_animation' ).removeClass( 'et_pb_hide_loading' );
|
||||
$( '#et_pb_success_animation' ).removeClass( 'et_pb_active_success' );
|
||||
$( '#et_pb_loading_animation' ).show();
|
||||
},
|
||||
success: function( data ){
|
||||
$( '#et_pb_loading_animation' ).addClass( 'et_pb_hide_loading' );
|
||||
$( '#et_pb_success_animation' ).addClass( 'et_pb_active_success' ).show();
|
||||
|
||||
setTimeout( function(){
|
||||
$( '#et_pb_success_animation' ).fadeToggle();
|
||||
$( '#et_pb_loading_animation' ).fadeToggle();
|
||||
}, 1000 );
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
$( '.et_pb_toggle_all' ).click( function() {
|
||||
var $options_section = $( this ).closest( '.et_pb_roles_section_container' ),
|
||||
$toggles = $options_section.find( '.et-pb-main-setting' ),
|
||||
on_buttons_count = 0,
|
||||
off_buttons_count = 0;
|
||||
|
||||
$toggles.each( function() {
|
||||
if ( 'on' === $( this ).val() ) {
|
||||
on_buttons_count++;
|
||||
} else {
|
||||
off_buttons_count++;
|
||||
}
|
||||
});
|
||||
|
||||
if ( on_buttons_count >= off_buttons_count ) {
|
||||
$toggles.val( 'off' );
|
||||
} else {
|
||||
$toggles.val( 'on' );
|
||||
}
|
||||
|
||||
$toggles.change();
|
||||
});
|
||||
|
||||
$( '.et-pb-layout-buttons-reset' ).click( function() {
|
||||
var $confirm_modal =
|
||||
"<div class='et_pb_modal_overlay' data-action='reset_roles'>\
|
||||
<div class='et_pb_prompt_modal'>\
|
||||
<h3>" + et_pb_roles_options.modal_title + "</h3>\
|
||||
<p>" + et_pb_roles_options.modal_message + "</p>\
|
||||
<a href='#' class='et_pb_prompt_dont_proceed et-pb-modal-close'>\
|
||||
<span>" + et_pb_roles_options.modal_no + "<span>\
|
||||
</span></span></a>\
|
||||
<div class='et_pb_prompt_buttons'>\
|
||||
<a href='#' class='et_pb_prompt_proceed'>" + et_pb_roles_options.modal_yes + "</a>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>";
|
||||
|
||||
$( 'body' ).append( $confirm_modal );
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.et-pb-modal-close', function() {
|
||||
$( this ).closest( '.et_pb_modal_overlay' ).remove();
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.et_pb_prompt_proceed', function() {
|
||||
var $all_toggles = $( '.et-pb-main-setting' );
|
||||
|
||||
$all_toggles.val( 'on' );
|
||||
$all_toggles.change();
|
||||
|
||||
$( this ).closest( '.et_pb_modal_overlay' ).remove();
|
||||
});
|
||||
|
||||
$body.append( '<div id="et_pb_loading_animation"></div>' );
|
||||
$body.append( '<div id="et_pb_success_animation"></div>' );
|
||||
|
||||
$( '#et_pb_loading_animation' ).hide();
|
||||
$( '#et_pb_success_animation' ).hide();
|
||||
});
|
||||
})(jQuery)
|
||||
27
wp-content/themes/Divi/includes/builder/scripts/salvattore.min.js
vendored
Normal file
27
wp-content/themes/Divi/includes/builder/scripts/salvattore.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
wp-content/themes/Divi/includes/builder/scripts/waypoints.min.js
vendored
Normal file
8
wp-content/themes/Divi/includes/builder/scripts/waypoints.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user