diff --git a/Gruntfile.js b/Gruntfile.js
index 38c36bf9..92fbc24a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -139,7 +139,6 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks('grunt-contrib-uglify');
-
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
diff --git a/assets/css/customizer.css b/assets/css/customizer.css
index 56a50e3a..0c69e909 100644
--- a/assets/css/customizer.css
+++ b/assets/css/customizer.css
@@ -565,3 +565,14 @@ body .wp-full-overlay{
text-indent: 0;
text-align: center;
}
+
+.onepress-c-heading {
+ padding: 5px 12px;
+ background: #BBBBBB;
+ margin: 10px -12px 2px;
+ text-transform: uppercase;
+ letter-spacing: 2px;
+ font-weight: 500;
+ font-size: 12px;
+ color: #FFFFFF;
+}
\ No newline at end of file
diff --git a/assets/js/customizer-liveview.js b/assets/js/customizer-liveview.js
index cee4a318..e0cb8b19 100644
--- a/assets/js/customizer-liveview.js
+++ b/assets/js/customizer-liveview.js
@@ -77,10 +77,20 @@
} );
} );
- $( window ).resize( function(){
- var css_code = $( '#onepress-style-inline-css' ).html();
+ function update_css( ){
+ var css_code = $( '#onepress-style-inline-css' ).html();
// Fix Chrome Lost CSS When resize ??
- $( '#onepress-style-inline-css' ).html( css_code );
+ $( '#onepress-style-inline-css' ).replaceWith( '' );
+
+ }
+
+ // When preview ready
+ wp.customize.bind( 'preview-ready', function() {
+ update_css();
+ });
+
+ $( window ).resize( function(){
+ update_css();
});
diff --git a/assets/js/customizer.js b/assets/js/customizer.js
index 0d6bfe60..8f17df90 100644
--- a/assets/js/customizer.js
+++ b/assets/js/customizer.js
@@ -1,18 +1,19 @@
-( function( api ) {
+(function (api) {
// Extends our custom "example-1" section.
- api.sectionConstructor['onepress-plus'] = api.Section.extend( {
+ api.sectionConstructor['onepress-plus'] = api.Section.extend({
// No events for this type of section.
- attachEvents: function () {},
+ attachEvents: function () {
+ },
// Always make the section active.
isContextuallyActive: function () {
return true;
}
- } );
+ });
-} )( wp.customize );
+})(wp.customize);
/*
@@ -22,10 +23,10 @@
(function ($) {
$.deparam = function (params, coerce) {
var obj = {},
- coerce_types = { 'true': !0, 'false': !1, 'null': null };
+ coerce_types = {'true': !0, 'false': !1, 'null': null};
// Iterate over all name=value pairs.
- $.each(params.replace(/\+/g, ' ').split('&'), function (j,v) {
+ $.each(params.replace(/\+/g, ' ').split('&'), function (j, v) {
var param = v.split('='),
key = decodeURIComponent(param[0]),
val,
@@ -59,13 +60,13 @@
// Coerce values.
if (coerce) {
- val = val && !isNaN(val) ? +val // number
- : val === 'undefined' ? undefined // undefined
+ val = val && !isNaN(val) ? +val // number
+ : val === 'undefined' ? undefined // undefined
: coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
: val; // string
}
- if ( keys_last ) {
+ if (keys_last) {
// Complex key, build deep object structure based on a few rules:
// * The 'cur' pointer starts at the object top-level.
// * [] = array push (n is set to array length), [n] = array if n is
@@ -78,7 +79,7 @@
for (; i <= keys_last; i++) {
key = keys[i] === '' ? cur.length : keys[i];
cur = cur[key] = i < keys_last
- ? cur[key] || (keys[i+1] && isNaN(keys[i+1]) ? {} : [])
+ ? cur[key] || (keys[i + 1] && isNaN(keys[i + 1]) ? {} : [])
: val;
}
@@ -88,7 +89,7 @@
if ($.isArray(obj[key])) {
// val is already an array, so push on the next value.
- obj[key].push( val );
+ obj[key].push(val);
} else if (obj[key] !== undefined) {
// val isn't an array, but since a second value has been specified,
@@ -114,174 +115,175 @@
})(jQuery);
-
// COLOR ALPHA -----------------------------
/**
* Alpha Color Picker JS
*/
-( function( $ ) {
-
- /**
- * Override the stock color.js toString() method to add support for
- * outputting RGBa or Hex.
- */
- Color.prototype.toString = function( flag ) {
-
- // If our no-alpha flag has been passed in, output RGBa value with 100% opacity.
- // This is used to set the background color on the opacity slider during color changes.
- if ( 'no-alpha' == flag ) {
- return this.toCSS( 'rgba', '1' ).replace( /\s+/g, '' );
- }
-
- // If we have a proper opacity value, output RGBa.
- if ( 1 > this._alpha ) {
- return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
- }
-
- // Proceed with stock color.js hex output.
- 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;
- };
-
- /**
- * Given an RGBa, RGB, or hex color value, return the alpha channel value.
- */
- function acp_get_alpha_value_from_color( value ) {
- var alphaVal;
-
- // Remove all spaces from the passed in value to help our RGBa regex.
- value = value.replace( / /g, '' );
-
- if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) {
- alphaVal = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[1] ).toFixed(2) * 100;
- alphaVal = parseInt( alphaVal );
- } else {
- alphaVal = 100;
- }
-
- return alphaVal;
- }
-
- /**
- * Force update the alpha value of the color picker object and maybe the alpha slider.
- */
- function acp_update_alpha_value_on_color_input( alpha, $input, $alphaSlider, update_slider ) {
- var iris, colorPicker, color;
-
- iris = $input.data( 'a8cIris' );
- colorPicker = $input.data( 'wpWpColorPicker' );
-
- // Set the alpha value on the Iris object.
- iris._color._alpha = alpha;
-
- // Store the new color value.
- color = iris._color.toString();
-
- // Set the value of the input.
- $input.val( color );
- $input.trigger( 'color_change' );
-
- // Update the background color of the color picker.
- colorPicker.toggler.css({
- 'background-color': color
- });
-
- // Maybe update the alpha slider itself.
- if ( update_slider ) {
- acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
- }
-
- // Update the color value of the color picker object.
- $input.wpColorPicker( 'color', color );
- }
-
- /**
- * Update the slider handle position and label.
- */
- function acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ) {
- $alphaSlider.slider( 'value', alpha );
- $alphaSlider.find( '.ui-slider-handle' ).text( alpha.toString() );
- }
-
- $.fn.alphaColorPicker = function() {
-
- return this.each( function() {
-
- // Scope the vars.
- var $input, startingColor, paletteInput, showOpacity, defaultColor, palette,
- colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions;
-
- // Store the input.
- $input = $( this );
-
- // We must wrap the input now in order to get our a top level class
- // around the HTML added by wpColorPicker().
- $input.wrap( '
' );
-
- // Get some data off the input.
- paletteInput = $input.attr( 'data-palette' ) || 'true';
- showOpacity = $input.attr( 'data-show-opacity' ) || 'true';
- defaultColor = $input.attr( 'data-default-color' ) || '';
-
- // Process the palette.
- if ( paletteInput.indexOf( '|' ) !== -1 ) {
- palette = paletteInput.split( '|' );
- } else if ( 'false' == paletteInput ) {
- palette = false;
- } else {
- palette = true;
- }
-
- // Get a clean starting value for the option.
- startingColor = $input.val().replace( /\s+/g, '' );
- //startingColor = $input.val().replace( '#', '' );
- //console.log( startingColor );
-
- // If we don't yet have a value, use the default color.
- if ( '' == startingColor ) {
- startingColor = defaultColor;
- }
-
- // Set up the options that we'll pass to wpColorPicker().
- colorPickerOptions = {
- change: function( event, ui ) {
- var key, value, alpha, $transparency;
-
- key = $input.attr( 'data-customize-setting-link' );
- value = $input.wpColorPicker( 'color' );
-
- // Set the opacity value on the slider handle when the default color button is clicked.
- if ( defaultColor == value ) {
- alpha = acp_get_alpha_value_from_color( value );
- $alphaSlider.find( '.ui-slider-handle' ).text( alpha );
- }
-
- // If we're in the Customizer, send an ajax request to wp.customize
- // to trigger the Save action.
- if ( typeof wp.customize != 'undefined' ) {
- wp.customize( key, function( obj ) {
- obj.set( value );
- });
- }
-
- $transparency = $container.find( '.transparency' );
-
- // Always show the background color of the opacity slider at 100% opacity.
- $transparency.css( 'background-color', ui.color.toString( 'no-alpha' ) );
- $input.trigger( 'color_change' );
- },
- clear: function(){
- var key = $input.attr( 'data-customize-setting-link' ) || '';
- if( key && key !== '' ) {
+(function ($) {
+
+ /**
+ * Override the stock color.js toString() method to add support for
+ * outputting RGBa or Hex.
+ */
+ Color.prototype.toString = function (flag) {
+
+ // If our no-alpha flag has been passed in, output RGBa value with 100% opacity.
+ // This is used to set the background color on the opacity slider during color changes.
+ if ('no-alpha' == flag) {
+ return this.toCSS('rgba', '1').replace(/\s+/g, '');
+ }
+
+ // If we have a proper opacity value, output RGBa.
+ if (1 > this._alpha) {
+ return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
+ }
+
+ // Proceed with stock color.js hex output.
+ 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;
+ };
+
+ /**
+ * Given an RGBa, RGB, or hex color value, return the alpha channel value.
+ */
+ function acp_get_alpha_value_from_color(value) {
+ var alphaVal;
+
+ // Remove all spaces from the passed in value to help our RGBa regex.
+ value = value.replace(/ /g, '');
+
+ if (value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)) {
+ alphaVal = parseFloat(value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]).toFixed(2) * 100;
+ alphaVal = parseInt(alphaVal);
+ } else {
+ alphaVal = 100;
+ }
+
+ return alphaVal;
+ }
+
+ /**
+ * Force update the alpha value of the color picker object and maybe the alpha slider.
+ */
+ function acp_update_alpha_value_on_color_input(alpha, $input, $alphaSlider, update_slider) {
+ var iris, colorPicker, color;
+
+ iris = $input.data('a8cIris');
+ colorPicker = $input.data('wpWpColorPicker');
+
+ // Set the alpha value on the Iris object.
+ iris._color._alpha = alpha;
+
+ // Store the new color value.
+ color = iris._color.toString();
+
+ // Set the value of the input.
+ $input.val(color);
+ $input.trigger('color_change');
+
+ // Update the background color of the color picker.
+ colorPicker.toggler.css({
+ 'background-color': color
+ });
+
+ // Maybe update the alpha slider itself.
+ if (update_slider) {
+ acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider);
+ }
+
+ // Update the color value of the color picker object.
+ $input.wpColorPicker('color', color);
+ }
+
+ /**
+ * Update the slider handle position and label.
+ */
+ function acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider) {
+ $alphaSlider.slider('value', alpha);
+ $alphaSlider.find('.ui-slider-handle').text(alpha.toString());
+ }
+
+ $.fn.alphaColorPicker = function () {
+
+ return this.each(function () {
+
+ // Scope the vars.
+ var $input, startingColor, paletteInput, showOpacity, defaultColor, palette,
+ colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions;
+
+ // Store the input.
+ $input = $(this);
+
+ // We must wrap the input now in order to get our a top level class
+ // around the HTML added by wpColorPicker().
+ $input.wrap('');
+
+ // Get some data off the input.
+ paletteInput = $input.attr('data-palette') || 'true';
+ showOpacity = $input.attr('data-show-opacity') || 'true';
+ defaultColor = $input.attr('data-default-color') || '';
+
+ // Process the palette.
+ if (paletteInput.indexOf('|') !== -1) {
+ palette = paletteInput.split('|');
+ } else if ('false' == paletteInput) {
+ palette = false;
+ } else {
+ palette = true;
+ }
+
+ // Get a clean starting value for the option.
+ startingColor = $input.val().replace(/\s+/g, '');
+ //startingColor = $input.val().replace( '#', '' );
+ //console.log( startingColor );
+
+ // If we don't yet have a value, use the default color.
+ if ('' == startingColor) {
+ startingColor = defaultColor;
+ }
+
+ // Set up the options that we'll pass to wpColorPicker().
+ colorPickerOptions = {
+ change: function (event, ui) {
+ var key, value, alpha, $transparency;
+
+ key = $input.attr('data-customize-setting-link');
+ value = $input.wpColorPicker('color');
+
+ // Set the opacity value on the slider handle when the default color button is clicked.
+ if (defaultColor == value) {
+ alpha = acp_get_alpha_value_from_color(value);
+ $alphaSlider.find('.ui-slider-handle').text(alpha);
+ }
+
+ // If we're in the Customizer, send an ajax request to wp.customize
+ // to trigger the Save action.
+ if (typeof wp.customize != 'undefined') {
+ wp.customize(key, function (obj) {
+ obj.set(value);
+ });
+ }
+
+ $transparency = $container.find('.transparency');
+
+ // Always show the background color of the opacity slider at 100% opacity.
+ $transparency.css('background-color', ui.color.toString('no-alpha'));
+ $input.trigger('color_change');
+ },
+ clear: function () {
+ var key = $input.attr('data-customize-setting-link') || '';
+ if (key && key !== '') {
if (typeof wp.customize != 'undefined') {
wp.customize(key, function (obj) {
obj.set('');
@@ -289,263 +291,264 @@
}
}
$input.val('');
- $input.trigger( 'color_change' );
+ $input.trigger('color_change');
+ },
+ palettes: palette // Use the passed in palette.
+ };
+
+ // Create the colorpicker.
+ $input.wpColorPicker(colorPickerOptions);
+
+ $container = $input.parents('.wp-picker-container:first');
+
+ // Insert our opacity slider.
+ $('
' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '
').appendTo($container.find('.wp-picker-holder'));
+
+ $alphaSlider = $container.find('.alpha-slider');
+
+ // If starting value is in format RGBa, grab the alpha channel.
+ alphaVal = acp_get_alpha_value_from_color(startingColor);
+
+ // Set up jQuery UI slider() options.
+ sliderOptions = {
+ create: function (event, ui) {
+ var value = $(this).slider('value');
+
+ // Set up initial values.
+ $(this).find('.ui-slider-handle').text(value);
+ $(this).siblings('.transparency ').css('background-color', startingColor);
},
- palettes: palette // Use the passed in palette.
- };
-
- // Create the colorpicker.
- $input.wpColorPicker( colorPickerOptions );
-
- $container = $input.parents( '.wp-picker-container:first' );
-
- // Insert our opacity slider.
- $( '
' +
- '' +
- '' +
- '' +
- '' +
- '
' ).appendTo( $container.find( '.wp-picker-holder' ) );
-
- $alphaSlider = $container.find( '.alpha-slider' );
-
- // If starting value is in format RGBa, grab the alpha channel.
- alphaVal = acp_get_alpha_value_from_color( startingColor );
-
- // Set up jQuery UI slider() options.
- sliderOptions = {
- create: function( event, ui ) {
- var value = $( this ).slider( 'value' );
-
- // Set up initial values.
- $( this ).find( '.ui-slider-handle' ).text( value );
- $( this ).siblings( '.transparency ').css( 'background-color', startingColor );
- },
- value: alphaVal,
- range: 'max',
- step: 1,
- min: 0,
- max: 100,
- animate: 300
- };
-
- // Initialize jQuery UI slider with our options.
- $alphaSlider.slider( sliderOptions );
-
- // Maybe show the opacity on the handle.
- if ( 'true' == showOpacity ) {
- $alphaSlider.find( '.ui-slider-handle' ).addClass( 'show-opacity' );
- }
-
- // Bind event handlers for the click zones.
- $container.find( '.min-click-zone' ).on( 'click', function() {
- acp_update_alpha_value_on_color_input( 0, $input, $alphaSlider, true );
- });
- $container.find( '.max-click-zone' ).on( 'click', function() {
- acp_update_alpha_value_on_color_input( 100, $input, $alphaSlider, true );
- });
-
- // Bind event handler for clicking on a palette color.
- $container.find( '.iris-palette' ).on( 'click', function() {
- var color, alpha;
-
- color = $( this ).css( 'background-color' );
- alpha = acp_get_alpha_value_from_color( color );
-
- acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
-
- // Sometimes Iris doesn't set a perfect background-color on the palette,
- // for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039).
- // To compensante for this we round the opacity value on RGBa colors here
- // and save it a second time to the color picker object.
- if ( alpha != 100 ) {
- color = color.replace( /[^,]+(?=\))/, ( alpha / 100 ).toFixed( 2 ) );
- }
-
- $input.wpColorPicker( 'color', color );
- });
-
- // Bind event handler for clicking on the 'Default' button.
- $container.find( '.button.wp-picker-default' ).on( 'click', function() {
- var alpha = acp_get_alpha_value_from_color( defaultColor );
-
- acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
- });
-
- // Bind event handler for typing or pasting into the input.
- $input.on( 'input', function() {
- var value = $( this ).val();
- var alpha = acp_get_alpha_value_from_color( value );
-
- acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
- });
-
- // Update all the things when the slider is interacted with.
- $alphaSlider.slider().on( 'slide', function( event, ui ) {
- var alpha = parseFloat( ui.value ) / 100.0;
-
- acp_update_alpha_value_on_color_input( alpha, $input, $alphaSlider, false );
-
- // Change value shown on slider handle.
- $( this ).find( '.ui-slider-handle' ).text( ui.value );
- });
- });
- }
-
-}( jQuery ));
+ value: alphaVal,
+ range: 'max',
+ step: 1,
+ min: 0,
+ max: 100,
+ animate: 300
+ };
+
+ // Initialize jQuery UI slider with our options.
+ $alphaSlider.slider(sliderOptions);
+
+ // Maybe show the opacity on the handle.
+ if ('true' == showOpacity) {
+ $alphaSlider.find('.ui-slider-handle').addClass('show-opacity');
+ }
+
+ // Bind event handlers for the click zones.
+ $container.find('.min-click-zone').on('click', function () {
+ acp_update_alpha_value_on_color_input(0, $input, $alphaSlider, true);
+ });
+ $container.find('.max-click-zone').on('click', function () {
+ acp_update_alpha_value_on_color_input(100, $input, $alphaSlider, true);
+ });
+
+ // Bind event handler for clicking on a palette color.
+ $container.find('.iris-palette').on('click', function () {
+ var color, alpha;
+
+ color = $(this).css('background-color');
+ alpha = acp_get_alpha_value_from_color(color);
+
+ acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider);
+
+ // Sometimes Iris doesn't set a perfect background-color on the palette,
+ // for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039).
+ // To compensante for this we round the opacity value on RGBa colors here
+ // and save it a second time to the color picker object.
+ if (alpha != 100) {
+ color = color.replace(/[^,]+(?=\))/, (alpha / 100).toFixed(2));
+ }
+
+ $input.wpColorPicker('color', color);
+ });
+
+ // Bind event handler for clicking on the 'Default' button.
+ $container.find('.button.wp-picker-default').on('click', function () {
+ var alpha = acp_get_alpha_value_from_color(defaultColor);
+
+ acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider);
+ });
+
+ // Bind event handler for typing or pasting into the input.
+ $input.on('input', function () {
+ var value = $(this).val();
+ var alpha = acp_get_alpha_value_from_color(value);
+
+ acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider);
+ });
+
+ // Update all the things when the slider is interacted with.
+ $alphaSlider.slider().on('slide', function (event, ui) {
+ var alpha = parseFloat(ui.value) / 100.0;
+
+ acp_update_alpha_value_on_color_input(alpha, $input, $alphaSlider, false);
+
+ // Change value shown on slider handle.
+ $(this).find('.ui-slider-handle').text(ui.value);
+ });
+ });
+ }
+
+}(jQuery));
// WP COLOR ALPHA customizer -----------------------------
-( function( api , $ ) {
- api.controlConstructor['alpha-color'] = api.Control.extend({
- ready: function() {
- var control = this;
- $( '.alpha-color-control', control.container ).alphaColorPicker( {
- clear: function(event, ui){
+(function (api, $) {
+ api.controlConstructor['alpha-color'] = api.Control.extend({
+ ready: function () {
+ var control = this;
+ $('.alpha-color-control', control.container).alphaColorPicker({
+ clear: function (event, ui) {
- }
- });
- }
+ }
+ });
+ }
- });
+ });
-} )( wp.customize, jQuery );
+})(wp.customize, jQuery);
// WP REPEATERABLE Customizer -----------------------------
-( function( api , $ ) {
+(function (api, $) {
- api.controlConstructor['repeatable'] = api.Control.extend( {
- ready: function() {
- var control = this;
- setTimeout( function(){
+ api.controlConstructor['repeatable'] = api.Control.extend({
+ ready: function () {
+ var control = this;
+ setTimeout(function () {
control._init();
- } , 2500 );
- },
-
- eval: function(valueIs, valueShould, operator) {
-
- switch( operator ) {
- case 'not_in':
- valueShould = valueShould.split(',');
- if ( $.inArray( valueIs , valueShould ) < 0 ){
- return true;
- } else {
- return false;
- }
- break;
- case 'in':
- valueShould = valueShould.split(',');
- if ( $.inArray( valueIs , valueShould ) > -1 ){
- return true;
- } else {
- return false;
- }
- break;
- case '!=':
- return valueIs != valueShould;
- case '<=':
- return valueIs <= valueShould;
- case '<':
- return valueIs < valueShould;
- case '>=':
- return valueIs >= valueShould;
- case '>':
- return valueIs > valueShould;
- case '==':case '=':
- return valueIs == valueShould;
- break;
- }
- },
-
- compare: function( value1, cond, value2 ){
+ }, 2500);
+ },
+
+ eval: function (valueIs, valueShould, operator) {
+
+ switch (operator) {
+ case 'not_in':
+ valueShould = valueShould.split(',');
+ if ($.inArray(valueIs, valueShould) < 0) {
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case 'in':
+ valueShould = valueShould.split(',');
+ if ($.inArray(valueIs, valueShould) > -1) {
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case '!=':
+ return valueIs != valueShould;
+ case '<=':
+ return valueIs <= valueShould;
+ case '<':
+ return valueIs < valueShould;
+ case '>=':
+ return valueIs >= valueShould;
+ case '>':
+ return valueIs > valueShould;
+ case '==':
+ case '=':
+ return valueIs == valueShould;
+ break;
+ }
+ },
+
+ compare: function (value1, cond, value2) {
var equal = false;
var _v;
- switch ( cond ) {
+ switch (cond) {
case '===':
- equal = ( value1 === value2 ) ? true : false;
+ equal = (value1 === value2) ? true : false;
break;
case 'in':
return value2.indexOf(value1) == -1 ? false : true;
break;
case '>':
- equal = ( value1 > value2 ) ? true : false;
+ equal = (value1 > value2) ? true : false;
break;
case '<':
- equal = ( value1 < value2 ) ? true : false;
+ equal = (value1 < value2) ? true : false;
break;
case '!=':
- equal = ( value1 != value2 ) ? true : false;
+ equal = (value1 != value2) ? true : false;
break;
case 'empty':
- _v = _.clone( value1 );
- if ( _.isObject( _v ) || _.isArray( _v ) ) {
- _.each( _v, function ( v, i ) {
- if ( _.isEmpty( v ) ) {
- delete _v[ i ];
+ _v = _.clone(value1);
+ if (_.isObject(_v) || _.isArray(_v)) {
+ _.each(_v, function (v, i) {
+ if (_.isEmpty(v)) {
+ delete _v[i];
}
- } );
+ });
- equal = _.isEmpty( _v ) ? true: false;
+ equal = _.isEmpty(_v) ? true : false;
} else {
- equal = _.isNull( _v ) || _v == '' ? true : false;
+ equal = _.isNull(_v) || _v == '' ? true : false;
}
break;
case 'not_empty':
- _v = _.clone( value1 );
- if ( _.isObject( _v ) || _.isArray( _v ) ) {
- _.each( _v, function ( v, i ) {
- if ( _.isEmpty( v ) ) {
- delete _v[ i ];
+ _v = _.clone(value1);
+ if (_.isObject(_v) || _.isArray(_v)) {
+ _.each(_v, function (v, i) {
+ if (_.isEmpty(v)) {
+ delete _v[i];
}
- } )
+ })
}
- equal = _.isEmpty( _v ) ? false : true;
+ equal = _.isEmpty(_v) ? false : true;
break;
default:
- equal = ( value1 == value2 ) ? true : false;
+ equal = (value1 == value2) ? true : false;
}
return equal;
},
- multiple_compare: function( list, values ){
+ multiple_compare: function (list, values) {
var control = this;
var check = true;
try {
- var test = list[0];
+ var test = list[0];
check = true;
- if ( _.isString( test ) ) {
+ if (_.isString(test)) {
check = false;
var cond = list[1];
var cond_val = list[2];
var value;
- if ( ! _.isUndefined( values[ test ] ) ) {
- value = values[ test ];
- check = control.compare( value, cond, cond_val );
+ if (!_.isUndefined(values[test])) {
+ value = values[test];
+ check = control.compare(value, cond, cond_val);
}
- } else if ( _.isArray( test ) ) {
- check = true;
- _.each( list, function( req ) {
+ } else if (_.isArray(test)) {
+ check = true;
+ _.each(list, function (req) {
var cond_key = req[0];
var cond_cond = req[1];
var cond_val = req[2];
- var t_val = values[ cond_key ];
+ var t_val = values[cond_key];
- if ( _.isUndefined( t_val ) ) {
+ if (_.isUndefined(t_val)) {
t_val = '';
}
- if ( ! control.compare( t_val, cond_cond, cond_val ) ) {
+ if (!control.compare(t_val, cond_cond, cond_val)) {
check = false;
}
- } );
+ });
}
- } catch ( e ) {
+ } catch (e) {
check = false;
}
@@ -553,64 +556,66 @@
return check;
},
- conditionize: function( $context ){
- var control = this;
+ conditionize: function ($context) {
+ var control = this;
- if ( $context.hasClass( 'conditionized' ) ) {
- return ;
- }
- $context.addClass( 'conditionized' );
+ if ($context.hasClass('conditionized')) {
+ return;
+ }
+ $context.addClass('conditionized');
- var $fields = $( '.field--item', $context );
+ var $fields = $('.field--item', $context);
- $context.on( 'change condition_check', 'input, select, textarea', function( e ) {
+ $context.on('change condition_check', 'input, select, textarea', function (e) {
- var f = $('.form', $context );
+ var f = $('.form', $context);
var data = $('input, textarea, select', f).serialize();
- data = jQuery.deparam( data );
+ data = jQuery.deparam(data);
var fieldData = {};
- if ( _.isObject( data ) ) {
- _.each( data._items, function( value){
+ if (_.isObject(data)) {
+ _.each(data._items, function (value) {
fieldData = value;
- } );
+ });
}
- $fields.each( function( ) {
+ $fields.each(function () {
var $field = $(this);
var check = true;
var req = $field.attr('data-cond') || false;
- if ( !_.isUndefined( req ) && req ) {
- req = JSON.parse( req );
- check = control.multiple_compare( req, fieldData );
- if ( ! check ) {
- $field.hide().addClass( 'cond-hide' ).removeClass( 'cond-show' );
+ if (!_.isUndefined(req) && req) {
+ req = JSON.parse(req);
+ check = control.multiple_compare(req, fieldData);
+ if (!check) {
+ $field.hide().addClass('cond-hide').removeClass('cond-show');
} else {
- $field.slideDown().removeClass( 'cond-hide' ).addClass('cond-show');
+ $field.slideDown().removeClass('cond-hide').addClass('cond-show');
}
}
});
- } );
+ });
- /**
- * Current support one level only
- */
- $('input, select, textarea', $context ).eq(0).trigger( 'condition_check' );
- },
+ /**
+ * Current support one level only
+ */
+ $('input, select, textarea', $context).eq(0).trigger('condition_check');
+ },
- remove_editor: function( $context ){},
- editor: function( $textarea ){ },
+ remove_editor: function ($context) {
+ },
+ editor: function ($textarea) {
+ },
- _init: function() {
+ _init: function () {
var control = this;
var default_data = control.params.fields;
var values;
try {
- if ( typeof control.params.value == 'string' ) {
+ if (typeof control.params.value == 'string') {
values = JSON.parse(control.params.value);
} else {
values = control.params.value;
@@ -685,14 +690,14 @@
//$("[data-hidden-value]", control.container).val(data);
//$("[data-hidden-value]", control.container).trigger('change');
- control.setting.set( data );
+ control.setting.set(data);
};
/**
* Rename repeater item
*/
control.rename = function () {
- $('.list-repeatable li', control.container).each( function (index) {
+ $('.list-repeatable li', control.container).each(function (index) {
var li = $(this);
$('input, textarea, select', li).each(function () {
var input = $(this);
@@ -707,7 +712,7 @@
};
- if ( ! window._upload_fame ) {
+ if (!window._upload_fame) {
window._upload_fame = wp.media({
title: wp.media.view.l10n.addMedia,
multiple: false,
@@ -741,7 +746,7 @@
$('.image_id', window.media_current).trigger('change');
try {
window.media_btn.text(window.media_btn.attr('data-change-txt'));
- } catch ( e ){
+ } catch (e) {
}
@@ -916,12 +921,12 @@
*/
control.repeaterTemplate = _.memoize(function () {
var compiled,
- /*
- * Underscore's default ERB-style templates are incompatible with PHP
- * when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax.
- *
- * @see trac ticket #22344.
- */
+ /*
+ * Underscore's default ERB-style templates are incompatible with PHP
+ * when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax.
+ *
+ * @see trac ticket #22344.
+ */
options = {
evaluate: /<#([\s\S]+?)#>/g,
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
@@ -959,7 +964,7 @@
});
// Custom for special IDs
- if ( control.id === 'onepress_section_order_styling' ) {
+ if (control.id === 'onepress_section_order_styling') {
if ($context.find('input.add_by').val() !== 'click') {
$context.addClass('no-changeable');
// Remove because we never use
@@ -1004,10 +1009,10 @@
_templateData = $.extend(true, {}, control.params.fields);
var _templateData;
- $.each( values, function ( i, _values ) {
+ $.each(values, function (i, _values) {
_values = values[i];
- if ( _values ) {
+ if (_values) {
for (var j in _values) {
if (_templateData.hasOwnProperty(j) && _values.hasOwnProperty(j)) {
_templateData[j].value = _values[j];
@@ -1015,136 +1020,141 @@
}
}
- var $html = $( control.template( _templateData) );
+ var $html = $(control.template(_templateData));
$('.list-repeatable', control.container).append($html);
control.intItem($html);
control.actions($html);
});
- /**
- * Add new item
- */
- control.container.on( 'click', '.add-new-repeat-item', function(){
- var $html = $( control.template( default_data ) );
- $( '.list-repeatable', control.container ).append( $html );
+ /**
+ * Add new item
+ */
+ control.container.on('click', '.add-new-repeat-item', function () {
+ var $html = $(control.template(default_data));
+ $('.list-repeatable', control.container).append($html);
- // add unique ID for section if id_key is set
- if ( control.params.id_key !== '' ){
- $html.find( '.item-'+control.params.id_key).find( 'input').val( 'sid'+( new Date().getTime() ) );
- }
- $html.find( 'input.add_by').val( 'click' );
+ // add unique ID for section if id_key is set
+ if (control.params.id_key !== '') {
+ $html.find('.item-' + control.params.id_key).find('input').val('sid' + (new Date().getTime()));
+ }
+ $html.find('input.add_by').val('click');
- control.intItem( $html );
- control.actions( $html );
- control.updateValue();
- control._check_max_item();
- } );
+ control.intItem($html);
+ control.actions($html);
+ control.updateValue();
+ control._check_max_item();
+ });
- /**
- * Update repeater data when any events fire.
- */
- $( '.list-repeatable', control.container ).on( 'keyup change color_change', 'input, select, textarea', function( e ) {
- control.updateValue();
- });
+ /**
+ * Update repeater data when any events fire.
+ */
+ $('.list-repeatable', control.container).on('keyup change color_change', 'input, select, textarea', function (e) {
+ control.updateValue();
+ });
- control._check_max_item();
+ control._check_max_item();
- }
+ }
- } );
+ });
-} )( wp.customize, jQuery );
+})(wp.customize, jQuery);
/**
* WP EDITOR plugin
*/
-(function ( $ ) {
+(function ($) {
window._wpEditor = {
- init: function( id , content, settings ){
+ init: function (id, content, settings) {
var _id = '__wp_mce_editor__';
- var _tpl = $( '#_wp-mce-editor-tpl').html();
- if ( typeof content === "undefined" ){
+ var _tpl = $('#_wp-mce-editor-tpl').html();
+ if (typeof content === "undefined") {
content = '';
}
- if ( typeof window.tinyMCEPreInit.mceInit[ _id ] !== "undefined" ) {
+ if (typeof window.tinyMCEPreInit.mceInit[_id] !== "undefined") {
- var tmceInit = _.clone( window.tinyMCEPreInit.mceInit[_id] );
- var qtInit = _.clone( window.tinyMCEPreInit.qtInit[_id] );
+ var tmceInit = _.clone(window.tinyMCEPreInit.mceInit[_id]);
+ var qtInit = _.clone(window.tinyMCEPreInit.qtInit[_id]);
- tmceInit = $.extend( tmceInit , settings.tinymce );
- qtInit = $.extend( qtInit , settings.qtag );
+ tmceInit = $.extend(tmceInit, settings.tinymce);
+ qtInit = $.extend(qtInit, settings.qtag);
- var tpl = _tpl.replace( new RegExp(_id,"g"), id );
- var template = $( tpl );
- template.find( 'textarea').removeAttr( 'rows').removeAttr( 'cols' );
- $( "#"+id ).replaceWith( template );
+ var tpl = _tpl.replace(new RegExp(_id, "g"), id);
+ var template = $(tpl);
+ template.find('textarea').removeAttr('rows').removeAttr('cols');
+ $("#" + id).replaceWith(template);
// set content
- $( '#'+id ).val( content );
+ $('#' + id).val(content);
- $wrap = tinymce.$( '#wp-' + id + '-wrap' );
+ $wrap = tinymce.$('#wp-' + id + '-wrap');
- tmceInit.body_class = tmceInit.body_class.replace(new RegExp(_id,"g"), id );
- tmceInit.selector = tmceInit.selector.replace(new RegExp(_id,"g"), id );
- tmceInit.cache_suffix = '';
+ tmceInit.body_class = tmceInit.body_class.replace(new RegExp(_id, "g"), id);
+ tmceInit.selector = tmceInit.selector.replace(new RegExp(_id, "g"), id);
+ tmceInit.cache_suffix = '';
- $wrap.removeClass( 'html-active').addClass( 'tmce-active' );
+ $wrap.removeClass('html-active').addClass('tmce-active');
- tmceInit.init_instance_callback = function( editor ){
- if ( typeof settings === 'object' ) {
- if ( typeof settings.mod === 'string' && settings.mod === 'html' ){
+ tmceInit.init_instance_callback = function (editor) {
+ if (typeof settings === 'object') {
+ if (typeof settings.mod === 'string' && settings.mod === 'html') {
//console.log( settings.mod );
- switchEditors.go( id, settings.mod );
+ try {
+ switchEditors.go(id, settings.mod);
+ } catch (e) {
+
+ }
+
}
// editor.theme.resizeTo('100%', 500);
- if( typeof settings.init_instance_callback === "function" ) {
- settings.init_instance_callback( editor );
+ if (typeof settings.init_instance_callback === "function") {
+ settings.init_instance_callback(editor);
}
if (settings.sync_id !== '') {
if (typeof settings.sync_id === 'string') {
editor.on('keyup change', function (e) {
- var html = editor.getContent( { format: 'raw' } );
- html = _wpEditor.removep( html );
- $('#' + settings.sync_id).val( html ).trigger('change');
+ var html = editor.getContent({format: 'raw'});
+ html = _wpEditor.removep(html);
+ $('#' + settings.sync_id).val(html).trigger('change');
});
} else {
editor.on('keyup change', function (e) {
- var html = editor.getContent( { format: 'raw' } );
- html = _wpEditor.removep( html );
- settings.sync_id.val( html ).trigger('change');
+ var html = editor.getContent({format: 'raw'});
+ html = _wpEditor.removep(html);
+ settings.sync_id.val(html).trigger('change');
});
}
- $( 'textarea#'+id ).on( 'keyup change', function(){
- var v = $( this).val();
- if ( typeof settings.sync_id === 'string' ) {
- $('#' + settings.sync_id).val( v ).trigger('change');
+ $('textarea#' + id).on('keyup change', function () {
+ var v = $(this).val();
+ if (typeof settings.sync_id === 'string') {
+ $('#' + settings.sync_id).val(v).trigger('change');
} else {
- settings.sync_id.val( v ).trigger('change');
+ settings.sync_id.val(v).trigger('change');
}
- } );
+ });
}
}
};
tmceInit.plugins = tmceInit.plugins.replace('fullscreen,', '');
- tinyMCEPreInit.mceInit[ id ] = tmceInit;
+ tinyMCEPreInit.mceInit[id] = tmceInit;
qtInit.id = id;
- tinyMCEPreInit.qtInit[ id ] = qtInit;
+ tinyMCEPreInit.qtInit[id] = qtInit;
- if ( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) {
- tinymce.init( tmceInit );
- if ( ! window.wpActiveEditor ) {
+ if ($wrap.hasClass('tmce-active') || !tinyMCEPreInit.qtInit.hasOwnProperty(id)) {
+ tinymce.init(tmceInit);
+ if (!window.wpActiveEditor) {
window.wpActiveEditor = id;
}
}
- if ( typeof quicktags !== 'undefined' ) {
+ if (typeof quicktags !== 'undefined') {
/**
* Reset quicktags
@@ -1152,11 +1162,11 @@
* Maybe this is a bug ?
* see wp-includes/js/quicktags.js line 252
*/
- if( QTags.instances['0'] ) {
- QTags.instances['0'] = false;
+ if (QTags.instances['0']) {
+ QTags.instances['0'] = false;
}
- quicktags( qtInit );
- if ( ! window.wpActiveEditor ) {
+ quicktags(qtInit);
+ if (!window.wpActiveEditor) {
window.wpActiveEditor = id;
}
@@ -1169,321 +1179,322 @@
* Replace paragraphs with double line breaks
* @see wp-admin/js/editor.js
*/
- removep: function ( html ) {
- return window.switchEditors._wp_Nop( html );
+ removep: function (html) {
+ return window.switchEditors._wp_Nop(html);
},
- sync: function(){
+ sync: function () {
//
},
- remove: function( id ){
+ remove: function (id) {
var content = '';
var editor = false;
- if ( editor = tinymce.get(id) ) {
- content = editor.getContent( { format: 'raw' } );
- content = _wpEditor.removep( content );
+ if (editor = tinymce.get(id)) {
+ content = editor.getContent({format: 'raw'});
+ content = _wpEditor.removep(content);
editor.remove();
} else {
- content = $( '#'+id ).val();
+ content = $('#' + id).val();
}
- if ( $( '#wp-' + id + '-wrap').length > 0 ) {
+ if ($('#wp-' + id + '-wrap').length > 0) {
window._wpEditorBackUp = window._wpEditorBackUp || {};
- if ( typeof window._wpEditorBackUp[ id ] !== "undefined" ) {
- $( '#wp-' + id + '-wrap').replaceWith( window._wpEditorBackUp[ id ] );
+ if (typeof window._wpEditorBackUp[id] !== "undefined") {
+ $('#wp-' + id + '-wrap').replaceWith(window._wpEditorBackUp[id]);
}
}
- $( '#'+id ).val( content );
+ $('#' + id).val(content);
}
};
- $.fn.wp_js_editor = function( options ) {
+ $.fn.wp_js_editor = function (options) {
// This is the easiest way to have default options.
- if ( options !== 'remove' ) {
+ if (options !== 'remove') {
options = $.extend({
sync_id: "", // sync to another text area
tinymce: {}, // tinymce setting
- qtag: {}, // quick tag settings
- mod: '', // quick tag settings
- init_instance_callback: function(){} // quick tag settings
- }, options );
- } else{
- options = 'remove';
+ qtag: {}, // quick tag settings
+ mod: '', // quick tag settings
+ init_instance_callback: function () {
+ } // quick tag settings
+ }, options);
+ } else {
+ options = 'remove';
}
- return this.each( function( ) {
- var edit_area = $( this );
+ return this.each(function () {
+ var edit_area = $(this);
edit_area.uniqueId();
// Make sure edit area have a id attribute
- var id = edit_area.attr( 'id' ) || '';
- if ( id === '' ){
- return ;
+ var id = edit_area.attr('id') || '';
+ if (id === '') {
+ return;
}
- if ( 'remove' !== options ) {
- if ( ! options.mod ){
- options.mod = edit_area.attr( 'data-editor-mod' ) || '';
+
+ if ('remove' !== options) {
+ if (!options.mod) {
+ options.mod = edit_area.attr('data-editor-mod') || '';
}
window._wpEditorBackUp = window._wpEditorBackUp || {};
- window._wpEditorBackUp[ id ] = edit_area;
- window._wpEditor.init( id, edit_area.val(), options );
+ window._wpEditorBackUp[id] = edit_area;
+ window._wpEditor.init(id, edit_area.val(), options);
} else {
- window._wpEditor.remove( id );
+ window._wpEditor.remove(id);
}
});
};
-}( jQuery ));
+}(jQuery));
-( function( api, $ ) {
+(function (api, $) {
- function _the_editor( container ){
+ function _the_editor(container) {
var _editor = {
editor_added: false,
- ready: function( container ) {
+ ready: function (container) {
var control = this;
control.container = container;
- control.container.addClass( 'onepress-editor-added' );
- control.editing_area = $( 'textarea' , control.container );
- if ( control.editing_area.hasClass( 'wp-editor-added' ) ) {
+ control.container.addClass('onepress-editor-added');
+ control.editing_area = $('textarea', control.container);
+ if (control.editing_area.hasClass('wp-editor-added')) {
return false;
}
control.editing_area.uniqueId();
control.editing_area.addClass('wp-editor-added');
- control.editing_id = control.editing_area.attr( 'id' ) || false;
- if ( ! control.editing_id ) {
+ control.editing_id = control.editing_area.attr('id') || false;
+ if (!control.editing_id) {
return false;
}
- control.editor_id = 'wpe-for-'+control.editing_id;
- control.preview = $( '');
- control.editing_editor = $( '');
+ control.editor_id = 'wpe-for-' + control.editing_id;
+ control.preview = $('');
+ control.editing_editor = $('');
var content = control.editing_area.val();
// Load default value
- $( 'textarea', control.editing_editor).val( content );
+ $('textarea', control.editing_editor).val(content);
try {
- control.preview.html( window.switchEditors._wp_Autop( content ) );
- } catch ( e ) {
+ control.preview.html(window.switchEditors._wp_Autop(content));
+ } catch (e) {
}
- $( 'body' ).on( 'click', '#customize-controls, .customize-section-back', function( e ) {
- if ( ! $( e.target ).is( control.preview ) ) {
+ $('body').on('click', '#customize-controls, .customize-section-back', function (e) {
+ if (!$(e.target).is(control.preview)) {
/// e.preventDefault(); // Keep this AFTER the key filter above
- control.editing_editor.removeClass( 'wpe-active' );
- $( '.wp-js-editor-preview').removeClass( 'wpe-focus');
+ control.editing_editor.removeClass('wpe-active');
+ $('.wp-js-editor-preview').removeClass('wpe-focus');
}
- } );
+ });
- control.container.find( '.wp-js-editor').addClass( 'wp-js-editor-active' );
- control.preview.insertBefore( control.editing_area );
+ control.container.find('.wp-js-editor').addClass('wp-js-editor-active');
+ control.preview.insertBefore(control.editing_area);
control._init();
- $( window ) .on( 'resize', function(){
- control._resize();
- } );
+ $(window).on('resize', function () {
+ control._resize();
+ });
},
- _add_editor: function(){
+ _add_editor: function () {
var control = this;
- if ( ! this.editor_added ) {
+ if (!this.editor_added) {
this.editor_added = true;
- $( 'body .wp-full-overlay').append( control.editing_editor );
+ $('body .wp-full-overlay').append(control.editing_editor);
- $( 'textarea', control.editing_editor).attr( 'data-editor-mod', ( control.editing_area.attr( 'data-editor-mod' ) || '' ) ) .wp_js_editor( {
+ $('textarea', control.editing_editor).attr('data-editor-mod', (control.editing_area.attr('data-editor-mod') || '')).wp_js_editor({
sync_id: control.editing_area,
- init_instance_callback: function( editor ) {
- var w = $( '#wp-'+control.editor_id+ '-wrap' );
- $( '.wp-editor-tabs', w).append( '' );
- $( '.wp-editor-tabs', w).append( '' );
- $( '.wp-editor-tabs', w).append( '' );
- w.on( 'click', '.close-wp-editor', function( e ) {
+ init_instance_callback: function (editor) {
+ var w = $('#wp-' + control.editor_id + '-wrap');
+ $('.wp-editor-tabs', w).append('');
+ $('.wp-editor-tabs', w).append('');
+ $('.wp-editor-tabs', w).append('');
+ w.on('click', '.close-wp-editor', function (e) {
e.preventDefault();
- control.editing_editor.removeClass( 'wpe-active' );
- $( '.wp-js-editor-preview').removeClass( 'wpe-focus');
- } );
- $( '.preview-wp-editor', w ).hover( function(){
- w.closest( '.modal-wp-js-editor').css( { opacity: 0 } );
- }, function(){
- w.closest( '.modal-wp-js-editor').css( { opacity: 1 } );
- } );
- w.on( 'click', '.fullscreen-wp-editor', function( e ) {
+ control.editing_editor.removeClass('wpe-active');
+ $('.wp-js-editor-preview').removeClass('wpe-focus');
+ });
+ $('.preview-wp-editor', w).hover(function () {
+ w.closest('.modal-wp-js-editor').css({opacity: 0});
+ }, function () {
+ w.closest('.modal-wp-js-editor').css({opacity: 1});
+ });
+ w.on('click', '.fullscreen-wp-editor', function (e) {
e.preventDefault();
- w.closest( '.modal-wp-js-editor').toggleClass( 'fullscreen' );
- setTimeout( function(){
- $( window ).resize();
- }, 600 );
- } );
+ w.closest('.modal-wp-js-editor').toggleClass('fullscreen');
+ setTimeout(function () {
+ $(window).resize();
+ }, 600);
+ });
}
- } );
+ });
}
},
- _init: function( ){
+ _init: function () {
var control = this;
- control.editing_area.on( 'change', function() {
- control.preview.html( window.switchEditors._wp_Autop( $( this).val() ) );
+ control.editing_area.on('change', function () {
+ control.preview.html(window.switchEditors._wp_Autop($(this).val()));
});
- control.preview.on( 'click', function( e ){
+ control.preview.on('click', function (e) {
control._add_editor();
- $( '.modal-wp-js-editor').removeClass( 'wpe-active' );
- control.editing_editor.toggleClass( 'wpe-active' );
- tinyMCE.get( control.editor_id ).focus();
- control.preview.addClass( 'wpe-focus' );
+ $('.modal-wp-js-editor').removeClass('wpe-active');
+ control.editing_editor.toggleClass('wpe-active');
+ tinyMCE.get(control.editor_id).focus();
+ control.preview.addClass('wpe-focus');
control._resize();
return false;
- } );
+ });
- control.container.on( 'click', '.wp-js-editor-preview', function( e ){
+ control.container.on('click', '.wp-js-editor-preview', function (e) {
e.preventDefault();
- } );
+ });
},
- _resize: function(){
+ _resize: function () {
var control = this;
- var w = $( '#wp-'+control.editor_id+ '-wrap');
+ var w = $('#wp-' + control.editor_id + '-wrap');
var height = w.innerHeight();
- var tb_h = w.find( '.mce-toolbar-grp' ).eq( 0 ).height();
- tb_h += w.find( '.wp-editor-tools' ).eq( 0 ).height();
+ var tb_h = w.find('.mce-toolbar-grp').eq(0).height();
+ tb_h += w.find('.wp-editor-tools').eq(0).height();
tb_h += 50;
//var width = $( window ).width();
- var editor = tinymce.get( control.editor_id );
- if ( editor ) {
- control.editing_editor.width( '' );
- editor.theme.resizeTo( '100%', height - tb_h );
- w.find( 'textarea.wp-editor-area').height( height - tb_h );
+ var editor = tinymce.get(control.editor_id);
+ if (editor) {
+ control.editing_editor.width('');
+ editor.theme.resizeTo('100%', height - tb_h);
+ w.find('textarea.wp-editor-area').height(height - tb_h);
}
}
};
- _editor.ready( container );
+ _editor.ready(container);
}
- function _remove_editor( $context ){
- $( 'textarea', $context ).each( function(){
- var id = $(this).attr( 'id' ) || '';
- var editor_id = 'wpe-for-'+id;
+ function _remove_editor($context) {
+ $('textarea', $context).each(function () {
+ var id = $(this).attr('id') || '';
+ var editor_id = 'wpe-for-' + id;
try {
- var editor = tinymce.get( editor_id );
- if ( editor ) {
+ var editor = tinymce.get(editor_id);
+ if (editor) {
editor.remove();
}
- $( '#wrap-'+editor_id ).remove();
- $( '#wrap-'+id ).remove();
+ $('#wrap-' + editor_id).remove();
+ $('#wrap-' + id).remove();
- if ( typeof tinyMCEPreInit.mceInit[ editor_id ] !== "undefined" ) {
- delete tinyMCEPreInit.mceInit[ editor_id ];
+ if (typeof tinyMCEPreInit.mceInit[editor_id] !== "undefined") {
+ delete tinyMCEPreInit.mceInit[editor_id];
}
- if ( typeof tinyMCEPreInit.qtInit[ editor_id ] !== "undefined" ) {
- delete tinyMCEPreInit.qtInit[ editor_id ];
+ if (typeof tinyMCEPreInit.qtInit[editor_id] !== "undefined") {
+ delete tinyMCEPreInit.qtInit[editor_id];
}
} catch (e) {
}
- } );
+ });
}
var _is_init_editors = {};
// jQuery( document ).ready( function( $ ){
- api.bind( 'ready', function( e, b ) {
+ api.bind('ready', function (e, b) {
- $( '#customize-theme-controls .accordion-section').each( function(){
- var section = $( this );
- var id = section.attr( 'id' ) || '';
- if ( id ) {
- if ( typeof _is_init_editors[ id ] === "undefined" ) {
- _is_init_editors[ id ] = true;
+ $('#customize-theme-controls .accordion-section').each(function () {
+ var section = $(this);
+ var id = section.attr('id') || '';
+ if (id) {
+ if (typeof _is_init_editors[id] === "undefined") {
+ _is_init_editors[id] = true;
- setTimeout( function() {
- if ( $( '.wp-js-editor', section ).length > 0 ) {
- $( '.wp-js-editor', section ).each( function(){
- _the_editor( $( this ) );
- } );
+ setTimeout(function () {
+ if ($('.wp-js-editor', section).length > 0) {
+ $('.wp-js-editor', section).each(function () {
+ _the_editor($(this));
+ });
}
- if ( $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).length > 0 ) {
- $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).each( function(){
- _the_editor( $( this ) );
- } );
+ if ($('.repeatable-customize-control:not(.no-changeable) .item-editor', section).length > 0) {
+ $('.repeatable-customize-control:not(.no-changeable) .item-editor', section).each(function () {
+ _the_editor($(this));
+ });
}
- }, 10 );
+ }, 10);
}
}
- } );
+ });
// Check section when focus
- if ( _wpCustomizeSettings.autofocus ) {
- if ( _wpCustomizeSettings.autofocus.section ) {
- var id = "sub-accordion-section-"+_wpCustomizeSettings.autofocus.section ;
- _is_init_editors[ id ] = true;
- var section = $( '#'+id );
- setTimeout( function(){
- if ( $( '.wp-js-editor', section ).length > 0 ) {
- $( '.wp-js-editor', section ).each( function(){
- _the_editor( $( this ) );
- } );
+ if (_wpCustomizeSettings.autofocus) {
+ if (_wpCustomizeSettings.autofocus.section) {
+ var id = "sub-accordion-section-" + _wpCustomizeSettings.autofocus.section;
+ _is_init_editors[id] = true;
+ var section = $('#' + id);
+ setTimeout(function () {
+ if ($('.wp-js-editor', section).length > 0) {
+ $('.wp-js-editor', section).each(function () {
+ _the_editor($(this));
+ });
}
- if ( $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).length > 0 ) {
- $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).each( function(){
- _the_editor( $( this ) );
- } );
+ if ($('.repeatable-customize-control:not(.no-changeable) .item-editor', section).length > 0) {
+ $('.repeatable-customize-control:not(.no-changeable) .item-editor', section).each(function () {
+ _the_editor($(this));
+ });
}
- }, 1000 );
+ }, 1000);
- } else if ( _wpCustomizeSettings.autofocus.panel ) {
+ } else if (_wpCustomizeSettings.autofocus.panel) {
}
}
+ $('body').on('repeater-control-init-item', function (e, container) {
+ $('.item-editor', container).each(function () {
+ _the_editor($(this));
+ });
+ });
- $( 'body' ).on( 'repeater-control-init-item', function( e, container ){
- $( '.item-editor', container ).each( function(){
- _the_editor( $( this ) );
- } );
- } );
-
- $( 'body' ).on( 'repeat-control-remove-item', function( e, container ){
- _remove_editor( container );
- } );
- } );
+ $('body').on('repeat-control-remove-item', function (e, container) {
+ _remove_editor(container);
+ });
+ });
-} )( wp.customize , jQuery );
+})(wp.customize, jQuery);
-jQuery( window ).ready( function( $ ){
+jQuery(window).ready(function ($) {
- if ( typeof onepress_customizer_settings !== "undefined" ) {
+ if (typeof onepress_customizer_settings !== "undefined") {
if (onepress_customizer_settings.number_action > 0) {
$('.control-section-themes h3.accordion-section-title').append('' + onepress_customizer_settings.number_action + '');
}
@@ -1492,178 +1503,173 @@ jQuery( window ).ready( function( $ ){
/**
* For Hero layout content settings
*/
- $( 'select[data-customize-setting-link="onepress_hero_layout"]').on( 'change on_custom_load', function(){
- var v = $( this).val() || '';
+ $('select[data-customize-setting-link="onepress_hero_layout"]').on('change on_custom_load', function () {
+ var v = $(this).val() || '';
- $( "li[id^='customize-control-onepress_hcl']").hide();
- $( "li[id^='customize-control-onepress_hcl"+v+"']").show();
+ $("li[id^='customize-control-onepress_hcl']").hide();
+ $("li[id^='customize-control-onepress_hcl" + v + "']").show();
- } );
- $( 'select[data-customize-setting-link="onepress_hero_layout"]').trigger( 'on_custom_load' );
+ });
+ $('select[data-customize-setting-link="onepress_hero_layout"]').trigger('on_custom_load');
/**
* For Gallery content settings
*/
- $( 'select[data-customize-setting-link="onepress_gallery_source"]').on( 'change on_custom_load', function(){
- var v = $( this).val() || '';
+ $('select[data-customize-setting-link="onepress_gallery_source"]').on('change on_custom_load', function () {
+ var v = $(this).val() || '';
- $( "li[id^='customize-control-onepress_gallery_source_']").hide();
- $( "li[id^='customize-control-onepress_gallery_api_']").hide();
- $( "li[id^='customize-control-onepress_gallery_settings_']").hide();
- $( "li[id^='customize-control-onepress_gallery_source_"+v+"']").show();
- $( "li[id^='customize-control-onepress_gallery_api_"+v+"']").show();
- $( "li[id^='customize-control-onepress_gallery_settings_"+v+"']").show();
+ $("li[id^='customize-control-onepress_gallery_source_']").hide();
+ $("li[id^='customize-control-onepress_gallery_api_']").hide();
+ $("li[id^='customize-control-onepress_gallery_settings_']").hide();
+ $("li[id^='customize-control-onepress_gallery_source_" + v + "']").show();
+ $("li[id^='customize-control-onepress_gallery_api_" + v + "']").show();
+ $("li[id^='customize-control-onepress_gallery_settings_" + v + "']").show();
- } );
+ });
- $( 'select[data-customize-setting-link="onepress_gallery_source"]').trigger( 'on_custom_load' );
+ $('select[data-customize-setting-link="onepress_gallery_source"]').trigger('on_custom_load');
/**
* For Gallery display settings
*/
- $( 'select[data-customize-setting-link="onepress_gallery_display"]').on( 'change on_custom_load', function(){
- var v = $( this).val() || '';
- switch ( v ) {
+ $('select[data-customize-setting-link="onepress_gallery_display"]').on('change on_custom_load', function () {
+ var v = $(this).val() || '';
+ switch (v) {
case 'slider':
- $( "#customize-control-onepress_g_row_height, #customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide();
+ $("#customize-control-onepress_g_row_height, #customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide();
break;
case 'justified':
- $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide();
- $( "#customize-control-onepress_g_row_height").show();
+ $("#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide();
+ $("#customize-control-onepress_g_row_height").show();
break;
case 'carousel':
- $( "#customize-control-onepress_g_row_height, #customize-control-onepress_g_col").hide();
- $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
+ $("#customize-control-onepress_g_row_height, #customize-control-onepress_g_col").hide();
+ $("#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
break;
case 'masonry':
- $( "#customize-control-onepress_g_row_height").hide();
- $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
+ $("#customize-control-onepress_g_row_height").hide();
+ $("#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
break;
default:
- $( "#customize-control-onepress_g_row_height").hide();
- $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
+ $("#customize-control-onepress_g_row_height").hide();
+ $("#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show();
}
- } );
- $( 'select[data-customize-setting-link="onepress_gallery_display"]').trigger( 'on_custom_load' );
-
-} );
-
-
-
-
+ });
+ $('select[data-customize-setting-link="onepress_gallery_display"]').trigger('on_custom_load');
+});
/**
* Icon picker
*/
-jQuery( document ).ready( function( $ ) {
+jQuery(document).ready(function ($) {
window.editing_icon = false;
- var icon_picker = $( '
' );
- var options_font_type = '', icon_group = '';
+ var icon_picker = $('
Check out the OnePress Plus version for full control over the frontpage SECTIONS ORDER!
Advanced Section Styling
Check out the OnePress Plus version for full control over the section styling which includes background color, image, video, parallax effect, custom style and more ...
', 'onepress' )
+ )
+));
+
+$wp_customize->add_section(
+ new OnePress_Section_Plus(
+ $wp_customize,
+ 'onepress-plus',
+ array(
+ 'priority' => 1,
+ 'plus_text' => __( 'OnePress Plus Available! Take a look', 'onepress' ),
+ 'plus_url' => 'https://www.famethemes.com/plugins/onepress-plus/?utm_source=theme_customizer&utm_medium=text_link&utm_campaign=onepress_customizer#get-started'
+ )
+ )
+);
\ No newline at end of file
diff --git a/inc/customize-configs/section-video-popup.php b/inc/customize-configs/section-video-popup.php
new file mode 100644
index 00000000..36baa250
--- /dev/null
+++ b/inc/customize-configs/section-video-popup.php
@@ -0,0 +1,103 @@
+add_panel( 'onepress_videolightbox' ,
+ array(
+ 'priority' => 180,
+ 'title' => esc_html__( 'Section: Video Lightbox', 'onepress' ),
+ 'description' => '',
+ 'active_callback' => 'onepress_showon_frontpage'
+ )
+);
+
+$wp_customize->add_section( 'onepress_videolightbox_settings' ,
+ array(
+ 'priority' => 3,
+ 'title' => esc_html__( 'Section Settings', 'onepress' ),
+ 'description' => '',
+ 'panel' => 'onepress_videolightbox',
+ )
+);
+
+// Show Content
+$wp_customize->add_setting( 'onepress_videolightbox_disable',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_checkbox',
+ 'default' => '',
+ )
+);
+$wp_customize->add_control( 'onepress_videolightbox_disable',
+ array(
+ 'type' => 'checkbox',
+ 'label' => esc_html__('Hide this section?', 'onepress'),
+ 'section' => 'onepress_videolightbox_settings',
+ 'description' => esc_html__('Check this box to hide this section.', 'onepress'),
+ )
+);
+
+// Section ID
+$wp_customize->add_setting( 'onepress_videolightbox_id',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_text',
+ 'default' => 'videolightbox',
+ )
+);
+$wp_customize->add_control( 'onepress_videolightbox_id',
+ array(
+ 'label' => esc_html__('Section ID:', 'onepress'),
+ 'section' => 'onepress_videolightbox_settings',
+ 'description' => esc_html__('The section id, we will use this for link anchor.', 'onepress' )
+ )
+);
+
+// Title
+$wp_customize->add_setting( 'onepress_videolightbox_title',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_text',
+ 'default' => '',
+ )
+);
+
+$wp_customize->add_control( new OnePress_Editor_Custom_Control(
+ $wp_customize,
+ 'onepress_videolightbox_title',
+ array(
+ 'label' => esc_html__('Section heading', 'onepress'),
+ 'section' => 'onepress_videolightbox_settings',
+ 'description' => '',
+ )
+));
+
+// Video URL
+$wp_customize->add_setting( 'onepress_videolightbox_url',
+ array(
+ 'sanitize_callback' => 'esc_url_raw',
+ 'default' => '',
+ )
+);
+$wp_customize->add_control( 'onepress_videolightbox_url',
+ array(
+ 'label' => esc_html__('Video url', 'onepress'),
+ 'section' => 'onepress_videolightbox_settings',
+ 'description' => esc_html__('Paste Youtube or Vimeo url here', 'onepress'),
+ )
+);
+
+// Parallax image
+$wp_customize->add_setting( 'onepress_videolightbox_image',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_number',
+ 'default' => '',
+ )
+);
+$wp_customize->add_control( new WP_Customize_Media_Control(
+ $wp_customize,
+ 'onepress_videolightbox_image',
+ array(
+ 'label' => esc_html__('Background image', 'onepress'),
+ 'section' => 'onepress_videolightbox_settings',
+ )
+));
+
+onepress_add_upsell_for_section( $wp_customize, 'onepress_videolightbox_settings' );
\ No newline at end of file
diff --git a/inc/customize-configs/site-identity.php b/inc/customize-configs/site-identity.php
new file mode 100644
index 00000000..64ac408b
--- /dev/null
+++ b/inc/customize-configs/site-identity.php
@@ -0,0 +1,74 @@
+add_setting( 'onepress_hide_sitetitle',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_checkbox',
+ 'default' => $is_old_logo ? 1 : 0,
+ )
+);
+$wp_customize->add_control(
+ 'onepress_hide_sitetitle',
+ array(
+ 'label' => esc_html__( 'Hide site title', 'onepress' ),
+ 'section' => 'title_tagline',
+ 'type' => 'checkbox',
+ )
+);
+
+$wp_customize->add_setting( 'onepress_hide_tagline',
+ array(
+ 'sanitize_callback' => 'onepress_sanitize_checkbox',
+ 'default' => $is_old_logo ? 1 : 0,
+ )
+);
+$wp_customize->add_control(
+ 'onepress_hide_tagline',
+ array(
+ 'label' => esc_html__( 'Hide site tagline', 'onepress' ),
+ 'section' => 'title_tagline',
+ 'type' => 'checkbox',
+
+ )
+);
+
+// Retina Logo
+$wp_customize->add_setting( 'onepress_retina_logo',
+ array(
+ 'sanitize_callback' => 'sanitize_text_field',
+ 'default' => '',
+ 'transport' => 'postMessage'
+ )
+);
+$wp_customize->add_control(
+ new WP_Customize_Image_Control(
+ $wp_customize,
+ 'onepress_retina_logo',
+ array(
+ 'label' => esc_html__( 'Retina Logo', 'onepress' ),
+ 'section' => 'title_tagline',
+ )
+ )
+);
+
+
+// Logo Width
+$wp_customize->add_setting( 'onepress_logo_height',
+ array(
+ 'sanitize_callback' => 'sanitize_text_field',
+ 'default' => '',
+ 'transport' => 'postMessage'
+ )
+);
+$wp_customize->add_control(
+ 'onepress_logo_height',
+ array(
+ 'label' => esc_html__( 'Logo Height In Pixel', 'onepress' ),
+ 'section' => 'title_tagline',
+ )
+
+);
\ No newline at end of file
diff --git a/inc/customize-controls/control-category.php b/inc/customize-controls/control-category.php
new file mode 100644
index 00000000..de723504
--- /dev/null
+++ b/inc/customize-controls/control-category.php
@@ -0,0 +1,50 @@
+.
+ */
+class OnePress_Alpha_Color_Control extends WP_Customize_Control {
+
+ /**
+ * Official control name.
+ */
+ public $type = 'alpha-color';
+
+ /**
+ * Add support for palettes to be passed in.
+ *
+ * Supported palette values are true, false, or an array of RGBa and Hex colors.
+ */
+ public $palette;
+
+ /**
+ * Add support for showing the opacity value on the slider handle.
+ */
+ public $show_opacity;
+
+ /**
+ * Enqueue scripts and styles.
+ *
+ * Ideally these would get registered and given proper paths before this control object
+ * gets initialized, then we could simply enqueue them here, but for completeness as a
+ * stand alone class we'll register and enqueue them here.
+ */
+ public function enqueue() {
+
+ }
+
+ /**
+ * Render the control.
+ */
+ public function render_content() {
+
+ // Process the palette
+ if ( is_array( $this->palette ) ) {
+ $palette = implode( '|', $this->palette );
+ } else {
+ // Default to true.
+ $palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
+ }
+
+ // Support passing show_opacity as string or boolean. Default to true.
+ $show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
+
+ // Begin the output. ?>
+
+
+
+ mod = strtolower( $this->mod );
+ if( ! $this->mod = 'html' ) {
+ $this->mod = 'tmce';
+ }
+ ?>
+
+
+
+
description ?>
+
+ type ) {
+ default:
+
+ case 'heading':
+ echo '' . $this->title . '';
+ break;
+
+ case 'custom_message' :
+ echo '
Check out the OnePress Plus version for full control over the section styling which includes background color, image, video, parallax effect, custom style and more ...
Check out the OnePress Plus version for full control over the frontpage SECTIONS ORDER!
Advanced Section Styling
Check out the OnePress Plus version for full control over the section styling which includes background color, image, video, parallax effect, custom style and more ...