balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

init-fields.js (1057B)


      1 /* global redux */
      2 
      3 (function( $ ) {
      4 	'use strict';
      5 
      6 	$.redux = $.redux || {};
      7 
      8 	$.redux.initFields = function() {
      9 		$( '.redux-group-tab:visible' ).find( '.redux-field-init:visible' ).each(
     10 			function() {
     11 				var tr;
     12 				var th;
     13 
     14 				var type = $( this ).attr( 'data-type' );
     15 
     16 				if ( 'undefined' !== typeof redux.field_objects && redux.field_objects[type] && redux.field_objects[type] ) {
     17 					redux.field_objects[type].init();
     18 				}
     19 
     20 				if ( 'undefined' !== typeof redux.field_objects.pro && ! $.isEmptyObject( redux.field_objects.pro[type] ) && redux.field_objects.pro[type] ) {
     21 					redux.field_objects.pro[type].init();
     22 				}
     23 
     24 				if ( ! redux.customizer && $( this ).hasClass( 'redux_remove_th' ) ) {
     25 					tr = $( this ).parents( 'tr:first' );
     26 					th = tr.find( 'th:first' );
     27 
     28 					if ( th.html() && th.html().length > 0 ) {
     29 						$( this ).prepend( th.html() );
     30 						$( this ).find( '.redux_field_th' ).css( 'padding', '0 0 10px 0' );
     31 					}
     32 
     33 					$( this ).parent().attr( 'colspan', '2' );
     34 
     35 					th.remove();
     36 				}
     37 			}
     38 		);
     39 	};
     40 })( jQuery );