| 1 |
/* |
| 2 |
Field Palette (color) |
| 3 |
*/ |
| 4 |
|
| 5 |
/*global jQuery, document, redux_change, redux*/ |
| 6 |
|
| 7 |
(function( $ ) { |
| 8 |
'use strict'; |
| 9 |
|
| 10 |
redux.field_objects = redux.field_objects || {}; |
| 11 |
redux.field_objects.palette = redux.field_objects.palette || {}; |
| 12 |
|
| 13 |
redux.field_objects.palette.init = function( selector ) { |
| 14 |
|
| 15 |
if ( !selector ) { |
| 16 |
selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-palette:visible' ); |
| 17 |
} |
| 18 |
|
| 19 |
$( selector ).each( |
| 20 |
function() { |
| 21 |
|
| 22 |
var el = $( this ); |
| 23 |
var parent = el; |
| 24 |
|
| 25 |
if ( !el.hasClass( 'redux-field-container' ) ) { |
| 26 |
parent = el.parents( '.redux-field-container:first' ); |
| 27 |
} |
| 28 |
|
| 29 |
if ( parent.is( ":hidden" ) ) { // Skip hidden fields |
| 30 |
return; |
| 31 |
} |
| 32 |
|
| 33 |
if ( parent.hasClass( 'redux-field-init' ) ) { |
| 34 |
parent.removeClass( 'redux-field-init' ); |
| 35 |
} else { |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
el.find( '.buttonset' ).each( |
| 40 |
function() { |
| 41 |
$( this ).buttonset(); |
| 42 |
} |
| 43 |
); |
| 44 |
|
| 45 |
// el.find('.redux-palette-set').click( |
| 46 |
// function(){ |
| 47 |
// console.log($(this).val()); |
| 48 |
// } |
| 49 |
// ) |
| 50 |
} |
| 51 |
); |
| 52 |
}; |
| 53 |
})( jQuery ); |