[Pkg-javascript-commits] [jquery-minicolors] 37/46: Fixes 174

David Prévot taffit at moszumanska.debian.org
Sun Oct 25 17:18:27 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 c3d57f4de327be371337512da6a04dd8a989373d
Author: Cory LaViska <cory at abeautifulsite.net>
Date:   Tue Oct 6 13:44:53 2015 -0400

    Fixes 174
---
 index.html               |  3 +--
 jquery.minicolors.js     | 12 +++++++++++-
 jquery.minicolors.min.js |  2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/index.html b/index.html
index 734a7ba..27e381e 100644
--- a/index.html
+++ b/index.html
@@ -620,8 +620,7 @@ rgba(0, 82, 148, .75)
                 <dd>
                     <p>
                         Gets or sets a control's color value. To use this method as a setter, pass
-                        <code>data</code> in as a hex value. (You can also obtain this value by checking the
-                        input element's <code>value</code> attribute.)
+                        in a color string or an object (ex: <code>{color: '#fc0', opacity: .5}</code>).
                     </p>
                 </dd>
             </dl>
diff --git a/jquery.minicolors.js b/jquery.minicolors.js
index 7c085f0..a7ec793 100644
--- a/jquery.minicolors.js
+++ b/jquery.minicolors.js
@@ -115,7 +115,17 @@
                     } else {
                         // Setter
                         $(this).each( function() {
-                            updateFromInput($(this).val(data));
+                            if( typeof(data) === 'object' ) {
+                                if( data.opacity ) {
+                                    $(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
+                                }
+                                if( data.color ) {
+                                    $(this).val(data.color);
+                                }
+                            } else {
+                                $(this).val(data);
+                            }
+                            updateFromInput($(this));
                         });
                     }
                     return $(this);
diff --git a/jquery.minicolors.min.js b/jquery.minicolors.min.js
index c70a4ec..e7a182e 100644
--- a/jquery.minicolors.min.js
+++ b/jquery.minicolors.min.js
@@ -8,4 +8,4 @@
  * @license: http://opensource.org/licenses/MIT
  *
  */
-!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function($){function i(i,t){var a=$('<div class="minicolors" />'),o=$.minicolors.defaults,s=i.attr("data-format"),n=i.attr("data-keywords"),e=i.attr("data-opacity");i.data("minicolors-initialized")||(t=$.extend(!0,{},o,t),a.addClass("minicolors-theme-"+t.theme).toggleClass("minicolors-with-opacity",t.opacity).toggleClass("minicolors-no-data-uris" [...]
\ No newline at end of file
+!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function($){function i(i,t){var a=$('<div class="minicolors" />'),o=$.minicolors.defaults,s=i.attr("data-format"),n=i.attr("data-keywords"),e=i.attr("data-opacity");i.data("minicolors-initialized")||(t=$.extend(!0,{},o,t),a.addClass("minicolors-theme-"+t.theme).toggleClass("minicolors-with-opacity",t.opacity).toggleClass("minicolors-no-data-uris" [...]
\ 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