[sagenb] 01/01: Improve the behaviour of the colorpicker

Ximin Luo infinity0 at debian.org
Sun Dec 4 23:21:26 UTC 2016


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

infinity0 pushed a commit to branch master
in repository sagenb.

commit 38f88804a13032aa32a2208abffde27b8d4aa1f5
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Dec 5 00:20:37 2016 +0100

    Improve the behaviour of the colorpicker
---
 ...witch-system-jquery-vanderlee-colorpicker.patch | 27 ++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch b/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch
index b5876f8..cf783a7 100644
--- a/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch
+++ b/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch
@@ -7,12 +7,12 @@ Forwarded: not-needed
 
 --- a/sagenb/notebook/interact.py
 +++ b/sagenb/notebook/interact.py
-@@ -483,53 +483,40 @@
+@@ -483,53 +483,44 @@
                    <input type="text"
                           id="%s"
                           name="color"
 -                         onchange="%s; $(this).css({backgroundColor: this.value}); $('#%s-picker').ColorPickerSetColor(this.value.slice(1)); $('#%s-picker div').css({backgroundColor: this.value});"
-+                         onchange="%s; $(this).css({backgroundColor: this.value});"
++                         onchange="%s"
                           value="%s"
                           style="%s" />
                  </td>
@@ -31,12 +31,11 @@ Forwarded: not-needed
               setTimeout(function () {
 -                 var def = '%s'.slice(1), div = $('#%s-picker div'),
 -                     input = $('#%s'), picker = $('#%s-picker');
-+                 var def = '%s'.slice(1), input = $('#%s');
-                  input.css({
-                      backgroundColor: '%s',
-                      // Should be good enough:
-                      color: (parseInt(def.slice(0, 2), 16) + parseInt(def.slice(2, 4), 16) + parseInt(def.slice(4, 6), 16)) / 3 > 127 ? '#000000' : '#ffffff'
-                  });
+-                 input.css({
+-                     backgroundColor: '%s',
+-                     // Should be good enough:
+-                     color: (parseInt(def.slice(0, 2), 16) + parseInt(def.slice(2, 4), 16) + parseInt(def.slice(4, 6), 16)) / 3 > 127 ? '#000000' : '#ffffff'
+-                 });
 -                 picker.ColorPicker({
 -                     color : '%s',
 -                     onShow : function (pkr) {
@@ -58,6 +57,15 @@ Forwarded: not-needed
 -                     onSubmit : function (hsb, hex, rgb, el) {
 -                         $(el).ColorPickerHide();
 -                     }
++                 var def = '%s'.slice(1), input = $('#%s');
++                 var update = function(hex) {
++                   input.css({
++                       backgroundColor: '#'+hex,
++                       // Should be good enough:
++                       color: (parseInt(hex.slice(0, 2), 16) + parseInt(hex.slice(2, 4), 16) + parseInt(hex.slice(4, 6), 16)) / 3 > 127 ? '#000000' : '#ffffff'
++                   });
++                 };
++                 update(def);
 +                 input.colorpicker({
 +                    color: '%s',
 +                    alpha: true,
@@ -70,13 +78,14 @@ Forwarded: not-needed
 +                        var hsb = color.colorPicker.color.getHSV();
 +                        hsb.b = hsb.v; // compatibility with old colorpicker
 +                        var rgb = color.colorPicker.color.getRGB();
++                        update(hex);
 +                        %s;
 +                    },
 +
                   });
               }, 1);
 -             </script>""" % (default, id, id, id, default, default, change)
-+             </script>""" % (default, id, default, default, change)
++             </script>""" % (default, id, default, change)
  
      elif widget == 'jpicker':
          raise ValueError("not supported in Debian")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list