[Pkg-javascript-commits] [jquery-minicolors] 04/07: Fixed bug where change event wouldn't fire on key press

David Prévot taffit at alioth.debian.org
Sat Sep 14 15:59:06 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository jquery-minicolors.

commit d8708ae5fd949ec76903b9266eae07ef0a69f733
Author: Cory LaViska <cory at abeautifulsite.net>
Date:   Sun Sep 8 19:32:47 2013 -0400

    Fixed bug where change event wouldn't fire on key press
---
 jquery.minicolors.js     |   16 ++++++++--------
 jquery.minicolors.min.js |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/jquery.minicolors.js b/jquery.minicolors.js
index b274dcb..474a84c 100644
--- a/jquery.minicolors.js
+++ b/jquery.minicolors.js
@@ -142,7 +142,7 @@ if(jQuery) (function($) {
 		// The input
 		input
 			.addClass('minicolors-input')
-			.data('minicolors-initialized', true)
+			.data('minicolors-initialized', false)
 			.data('minicolors-settings', settings)
 			.prop('size', 7)
 			.wrap(minicolors)
@@ -178,11 +178,7 @@ if(jQuery) (function($) {
 		
 		updateFromInput(input, false);
 		
-		// Populate lastChange to prevent change event from firing initially
-		input.data('minicolors-lastChange', {
-			hex: input.val(),
-			opacity: input.attr('data-opacity')
-		});
+		input.data('minicolors-initialized', true);
 		
 	}
 	
@@ -550,7 +546,6 @@ if(jQuery) (function($) {
 				// Update UI
 				slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
 				minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
-				
 				break;
 			
 			case 'brightness':
@@ -590,6 +585,11 @@ if(jQuery) (function($) {
 				
 		}
 		
+		// Fire change event, but only if minicolors is fully initialized
+		if( input.data('minicolors-initialized') ) {
+			doChange(input, hex, opacity);
+		}
+		
 	}
 	
 	// Runs the change and changeDelay callbacks
@@ -599,7 +599,7 @@ if(jQuery) (function($) {
 			lastChange = input.data('minicolors-lastChange');
 		
 		// Only run if it actually changed
-		if( lastChange.hex !== hex || lastChange.opacity !== opacity ) {
+		if( !lastChange || lastChange.hex !== hex || lastChange.opacity !== opacity ) {
 			
 			// Remember last-changed value
 			input.data('minicolors-lastChange', {
diff --git a/jquery.minicolors.min.js b/jquery.minicolors.min.js
index 520f8d6..1b9c5ec 100644
--- a/jquery.minicolors.min.js
+++ b/jquery.minicolors.min.js
@@ -5,4 +5,4 @@
  *
  * Licensed under the MIT license: http://opensource.org/licenses/MIT
  *
- */jQuery&&function(e){function t(t,n){var r=e('<div class="minicolors" />'),i=e.minicolors.defaults;if(t.data("minicolors-initialized"))return;n=e.extend(!0,{},i,n);r.addClass("minicolors-theme-"+n.theme).toggleClass("minicolors-with-opacity",n.opacity);n.position!==undefined&&e.each(n.position.split(" "),function(){r.addClass("minicolors-position-"+this)});t.addClass("minicolors-input").data("minicolors-initialized",!0).data("minicolors-settings",n).prop("size",7).wrap(r).after('<div c [...]
\ No newline at end of file
+ */jQuery&&function(e){function t(t,n){var r=e('<div class="minicolors" />'),i=e.minicolors.defaults;if(t.data("minicolors-initialized"))return;n=e.extend(!0,{},i,n);r.addClass("minicolors-theme-"+n.theme).toggleClass("minicolors-with-opacity",n.opacity);n.position!==undefined&&e.each(n.position.split(" "),function(){r.addClass("minicolors-position-"+this)});t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",n).prop("size",7).wrap(r).after('<div c [...]
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/jquery-minicolors.git



More information about the Pkg-javascript-commits mailing list