[Pkg-javascript-commits] [jquery-minicolors] 17/46: Simplify conditional

David Prévot taffit at moszumanska.debian.org
Sun Oct 25 17:18:25 UTC 2015


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

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

commit 5a8649f8eae42e0077031db09fe0672c38c2e194
Author: Cory LaViska <cory at abeautifulsite.net>
Date:   Thu Sep 17 15:13:07 2015 -0400

    Simplify conditional
---
 jquery.minicolors.js | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/jquery.minicolors.js b/jquery.minicolors.js
index efed2bf..3e5416a 100644
--- a/jquery.minicolors.js
+++ b/jquery.minicolors.js
@@ -550,12 +550,8 @@
         // Set color string
         if( input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1 ) {
             value = convertCase(input.val());
-        } else if (format === 'rgb') {
-            // Returns RGB(A) string
-            value = isRgb(input.val()) ? parseRgb(input.val()) : '';
         } else {
-            // Returns hex color
-            value = hex;
+            value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
         }
 
         // Update input value
@@ -923,7 +919,7 @@
             if( !input.data('minicolors-initialized') ) return;
             show(input);
         })
-        // Fix hex on blur
+        // Update value on blur
         .on('blur.minicolors', '.minicolors-input', function() {
             var input = $(this),
                 keywords = input.attr('data-keywords'),
@@ -938,12 +934,8 @@
             // Set color string
             if( input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1 ) {
                 value = convertCase(input.val());
-            } else if( isRgb(input.val()) ) {
-                // Returns RGB(A) string
-                value = parseRgb(input.val());
             } else {
-                // Returns hex color
-                value = parseHex(input.val(), true);
+                value = isRgb(input.val()) ? parseRgb(input.val()) : parseHex(input.val(), true);
             }
 
             // Set input value

-- 
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