-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize assets loading in frontend editor and backend editor Fix loading in frontend editor Use save_always for checkbox without STD Optimize performance with registering param type only when needed Fix codestyle issues
- Loading branch information
Showing
4 changed files
with
70 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
(function ( $ ) { | ||
/* | ||
Class used in edit form and editor models to save/render shortcode | ||
*/ | ||
vc.atts.custom_checkbox = { | ||
/** | ||
* Used to save multiple values in single string for saving/parsing/opening | ||
* @param param | ||
* @returns {string} | ||
$( function () { | ||
/* | ||
Class used in edit form and editor models to save/render param type | ||
*/ | ||
parse: function ( param ) { | ||
var arr, newValue; | ||
window.vc.atts.custom_checkbox = { | ||
/** | ||
* Used to save multiple values in single string for saving/parsing/opening | ||
* @param param | ||
* @returns {string} | ||
*/ | ||
parse: function ( param ) { | ||
var arr, newValue; | ||
|
||
arr = []; | ||
newValue = ''; | ||
$( 'input[name=' + param.param_name + ']', this.content() ).each( function () { | ||
var self; | ||
arr = []; | ||
newValue = ''; | ||
$( 'input[name=' + param.param_name + ']', this.content() ).each( function () { | ||
var self; | ||
|
||
self = $( this ); | ||
if ( this.checked ) { | ||
arr.push( self.attr( 'value' ) ); | ||
self = $( this ); | ||
if ( this.checked ) { | ||
arr.push( self.attr( 'value' ) ); | ||
} | ||
} ); | ||
if ( 0 < arr.length ) { | ||
newValue = arr.join( ',' ); | ||
} | ||
} ); | ||
if ( 0 < arr.length ) { | ||
newValue = arr.join( ',' ); | ||
return newValue; | ||
}, | ||
/** | ||
* Used in shortcode saving | ||
* Default: '' empty (unchecked) | ||
* Can be overwritten by 'std' | ||
* @param param | ||
* @returns {string} | ||
*/ | ||
defaults: function ( param ) { | ||
return ''; // needed for saving - without this default value for param will be first value in array | ||
} | ||
return newValue; | ||
}, | ||
/** | ||
* Used in shortcode saving | ||
* Default: '' empty (unchecked) | ||
* Can be overwritten by 'std' | ||
* @param param | ||
* @returns {string} | ||
*/ | ||
defaults: function ( param ) { | ||
return ''; // needed for saving - without this default value for param will be first value in array | ||
} | ||
}; | ||
}; | ||
} ); | ||
})( window.jQuery ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters