Skip to content

Commit

Permalink
Merge pull request #4 from ysc3839/patch-1
Browse files Browse the repository at this point in the history
Thanks, update
  • Loading branch information
Sergio P.A committed Dec 1, 2015
2 parents 062f81d + 44d1d3b commit 3a896aa
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/wp-color-picker-alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@
if ( this.error )
return '';

if ( hex.length < 6 ) {
for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
hex = '0' + hex;
}
}
if ( hex.length < 6 )
hex = ( '00000' + hex ).substr( -6 );

return '#' + hex;
};
Expand Down Expand Up @@ -63,7 +60,7 @@
// 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.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).data( 'current', wpColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button );

Expand Down Expand Up @@ -210,7 +207,7 @@
self.options.defaultWidth = el.width();

// Update width for input
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != 1 ) {
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 ) {
el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
}

Expand Down Expand Up @@ -345,4 +342,4 @@
// Auto Call plugin is class is color-picker
jQuery( document ).ready( function( $ ) {
$( '.color-picker' ).wpColorPicker();
} );
} );

0 comments on commit 3a896aa

Please sign in to comment.