[sagenb] 05/14: Use vanderlee's colorpicker as the only colorpicker; remove the others
Ximin Luo
infinity0 at debian.org
Fri Dec 2 22:52:48 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 69409f91d0d179697e84238f4e830a1c4496ea4f
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Fri Dec 2 21:28:47 2016 +0100
Use vanderlee's colorpicker as the only colorpicker; remove the others
3 different color pickers, really?
---
debian/control | 1 +
debian/copyright | 4 +
debian/patches/disable-farbtastic-jpicker.patch | 255 +++++++++++++++++++++
debian/patches/series | 2 +
...witch-system-jquery-vanderlee-colorpicker.patch | 79 +++++++
debian/python-sagenb.links | 1 +
6 files changed, 342 insertions(+)
diff --git a/debian/control b/debian/control
index 89be792..ce3dfc6 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Architecture: all
Depends: ${python:Depends}, ${misc:Depends},
libjs-codemirror,
libjs-jquery,
+ libjs-jquery-colorpicker,
libjs-jquery-form,
libjs-jquery-ui,
libjs-json,
diff --git a/debian/copyright b/debian/copyright
index 80c2d6c..d2b7ce0 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -8,7 +8,10 @@ Files-Excluded:
sagenb/data/codemirror/*
sagenb/data/highlight/*
sagenb/data/jquery/jquery*.js
+ sagenb/data/jquery/plugins/colorpicker/*
+ sagenb/data/jquery/plugins/farbtastic/*
sagenb/data/jquery/plugins/form/*
+ sagenb/data/jquery/plugins/jpicker/*
sagenb/data/jquery/plugins/jquery.bgiframe.min.js
sagenb/data/jqueryui/*
sagenb/data/json/*
@@ -21,6 +24,7 @@ Comment:
- bgiframe is a IE6-specific work-around, and upstream omits its source anyway
- openid-realselector/demo.html loads a remote jQuery, just rm it, it's unused
- everything else is supplied by Debian system packages
+ - farbtastic and jpicker aren't necessary, just use libjs-jquery-colorpicker
Files: *
Copyright: 2009-2016 SageNB contributors <sage-notebook at googlegroups.com>
diff --git a/debian/patches/disable-farbtastic-jpicker.patch b/debian/patches/disable-farbtastic-jpicker.patch
new file mode 100644
index 0000000..75dc491
--- /dev/null
+++ b/debian/patches/disable-farbtastic-jpicker.patch
@@ -0,0 +1,255 @@
+--- a/sagenb/notebook/interact.py
++++ b/sagenb/notebook/interact.py
+@@ -448,8 +448,8 @@
+ a 6-character HTML hexadecimal string.
+
+ - ``widget`` - a string (default: 'colorpicker'); the color
+- selector widget to use; choices are 'colorpicker', 'farbtastic' and
+- 'jpicker' (currently broken)
++ selector widget to use; choices are 'colorpicker'; in Debian other
++ values are not supported.
+
+ - ``hide_box`` - a boolean (default: False); whether to hide the
+ input box associated with the color selector widget
+@@ -462,53 +462,13 @@
+
+ sage: sagenb.notebook.interact.html_color_selector(0, 'alert("changed")', '', default='0afcac')
+ '...<table>...colorpicker...'
+- sage: sagenb.notebook.interact.html_color_selector(99, 'console.log(color);', '', default='fedcba', widget='farbtastic', hide_box=True)
+- '...<table>...farbtastic...'
+ """
+ input_style = ''
+ if hide_box:
+ input_style = 'display: none;'
+
+ if widget == 'farbtastic':
+- # HTML
+- s = """
+- <table>
+- <tr>
+- <td>
+- <div id="%s-picker"></div>
+- </td>
+- <td>
+- <input type="text"
+- id="%s"
+- name="color"
+- onchange="%s; $(this).css({backgroundColor: this.value, color: ''}); $.farbtastic('#%s-picker').setColor(this.value);"
+- value="%s"
+- style="%s"/>
+- </td>
+- </tr>
+- </table>""" % (id, id, input_change, id, default, input_style)
+-
+- # We now generate javascript that gets run after the above div
+- # gets inserted. This happens because of the setTimeout
+- # function below which gets passed an anonymous function.
+- # Figuring out the below took understanding jQuery much
+- # better, and took me surprisingly long, especially the part
+- # involving linkTo which sets the callback.
+- s += """<script>
+- setTimeout(function () {
+- var input = $('#%s'), picker = $.farbtastic('#%s-picker');
+- picker.linkTo('#%s').linkTo(function (color) {
+- if (input.val() !== color) {
+- input.val(color);
+- input.css({
+- backgroundColor: color,
+- color: picker.hsl[2] > 0.5 ? '#000000' : '#ffffff'
+- });
+- %s;
+- }
+- })
+- }, 1);
+- </script>""" % (id, id, id, change)
++ raise ValueError("not supported in Debian")
+
+ elif widget == 'colorpicker':
+ # HTML
+@@ -560,72 +520,7 @@
+ </script>""" % (default, id, id, id, default, default, change)
+
+ elif widget == 'jpicker':
+- # HTML.
+- s = """
+- <table>
+- <tr>
+- <td>
+- <input type="text"
+- id="%s"
+- name="color"
+- onchange="%s; $(this).css({backgroundColor: this.value}); $('.jPicker_HexText', $('#%s-picker').next()).val(this.value.slice(1)).trigger('keyup');"
+- value="%s"
+- style="%s" />
+- </td>
+- <td>
+- <div id="%s-picker"></div>
+- </td>
+- </tr>
+- </table>
+- """ % (id, input_change, id, default, input_style, id)
+-
+- # JS. Note: jPicker uses, e.g., 'abcdef' instead of '#abcdef'
+- # for bound input fields. To maintain consistency with the
+- # Farbtastic and ColorPicker implementations above, we do not
+- # simply call $('#%s').jPicker({...}).
+- s += """<script>
+- setTimeout(function () {
+- var def = '%s'.slice(1), input = $('#%s'),
+- picker = $('#%s-picker');
+- 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.jPicker(
+- // Settings.
+- {
+- window: {
+- expandable: true,
+- position: { x: 20, y: 20 },
+- title: 'Select a color'
+- },
+- color: {
+- active: '%s'
+- },
+- images: {
+- clientPath: '/javascript/jquery/plugins/jpicker/images/'
+- }
+- },
+- // commitCallback
+- function (color) {},
+- // liveCallback
+- function (color_arg) {
+- color = '#' + color_arg.hex;
+- if (input.val() !== color) {
+- input.val(color);
+- input.css({
+- backgroundColor: color,
+- color: color_arg.v > 50 ? '#000000' : '#ffffff'
+- });
+- %s;
+- }
+- },
+- // cancelCallback
+- function (color) {}
+- );
+- }, 1);
+- </script>""" % (default, id, id, default, default, change)
++ raise ValueError("not supported in Debian")
+
+ return s
+
+@@ -2375,8 +2270,8 @@
+
+ * ``u = color_selector(default=(0,0,1), label=None,
+ widget='colorpicker', hide_box=False)`` - a color selector with a
+- possibly hidden input box; the ``widget`` can also be ``'farbtastic'``
+- or ``'jpicker'`` (currently not working properly)
++ possibly hidden input box; in Debian other values for ``widget``
++ are not supported.
+
+ * ``u = text_control(value='')`` - a block of text
+
+@@ -2873,8 +2768,8 @@
+ the left of the selector.
+
+ - ``widget`` - a string (default: 'colorpicker'); the color
+- selector widget to use; choices are 'colorpicker', 'farbtastic',
+- and 'jpicker' (currently broken)
++ selector widget to use; choices are 'colorpicker'; in Debian
++ other values are not supported.
+
+ - ``hide_box`` - a boolean (default: False); whether to hide
+ the input box associated with the color selector widget
+@@ -2883,8 +2778,6 @@
+
+ sage: color_selector()
+ Interact color selector labeled None, with default RGB color (0.0, 0.0, 1.0), widget 'colorpicker', and visible input box
+- sage: color_selector((0.5, 0.5, 1.0), widget='jpicker')
+- Interact color selector labeled None, with default RGB color (0.5, 0.5, 1.0), widget 'jpicker', and visible input box
+ sage: color_selector(default = Color(0, 0.5, 0.25))
+ Interact color selector labeled None, with default RGB color (0.0, 0.5, 0.25), widget 'colorpicker', and visible input box
+ sage: color_selector('purple', widget = 'colorpicker')
+@@ -2893,12 +2786,6 @@
+ Traceback (most recent call last):
+ ...
+ ValueError: unknown color 'crayon'
+- sage: color_selector('#abcdef', label='height', widget='jpicker')
+- Interact color selector labeled 'height', with default RGB color (0.6..., 0.8..., 0.9...), widget 'jpicker', and visible input box
+- sage: color_selector('abcdef', label='height', widget='jpicker')
+- Traceback (most recent call last):
+- ...
+- ValueError: unknown color 'abcdef'
+ """
+ input_box.__init__(self, default=Color(default), label=label,
+ type=Color, widget=widget, hide_box=hide_box)
+@@ -2917,8 +2804,6 @@
+
+ sage: color_selector(Color('red'), 'line color').__repr__()
+ "Interact color selector labeled 'line color', with default RGB color (1.0, 0.0, 0.0), widget 'colorpicker', and visible input box"
+- sage: color_selector(Color((1,0,1)), 'circle color', widget='jpicker', hide_box=True).__repr__()
+- "Interact color selector labeled 'circle color', with default RGB color (1.0, 0.0, 1.0), widget 'jpicker', and hidden input box"
+ """
+ s = "Interact color selector labeled %r, with default %r, widget %r, and " % (self.label(), self.default(), self.widget())
+ if self.hide_box():
+@@ -2938,10 +2823,6 @@
+
+ sage: color_selector().widget()
+ 'colorpicker'
+- sage: color_selector('#abcdef', hide_box=True, widget='farbtastic').widget()
+- 'farbtastic'
+- sage: color_selector(widget='jpicker').widget()
+- 'jpicker'
+ sage: color_selector(default=Color(0,0.5,0.25)).widget()
+ 'colorpicker'
+ """
+@@ -2960,8 +2841,6 @@
+
+ sage: color_selector().hide_box()
+ False
+- sage: color_selector('green', hide_box=True, widget='jpicker').hide_box()
+- True
+ sage: color_selector((0.75,0.5,0.25)).hide_box()
+ False
+ """
+--- a/sagenb/data/sage/html/notebook/base.html
++++ b/sagenb/data/sage/html/notebook/base.html
+@@ -21,12 +21,8 @@
+ <script type="text/javascript" src="/javascript/jqueryui/js/jquery-ui.min.js"></script>
+
+ <!-- jQuery plugins - color pickers, shift-click, AJAX forms, IE fixes, notifications -->
+-<link rel="stylesheet" href="/javascript/jquery/plugins/farbtastic/farbtastic.css" type="text/css" />
+-<script type="text/javascript" src="/javascript/jquery/plugins/farbtastic/farbtastic.min.js"></script>
+ <script type="text/javascript" src="/javascript/jquery/plugins/extendedclick/jquery.event.extendedclick.min.js"></script>
+ <script type="text/javascript" src="/javascript/jquery/plugins/form/jquery.form.min.js"></script>
+-<link rel="stylesheet" href="/javascript/jquery/plugins/jpicker/css/jPicker-1.1.6.min.css" type="text/css" />
+-<script type="text/javascript" src="/javascript/jquery/plugins/jpicker/jpicker-1.1.6.min.js"></script>
+ <link rel="stylesheet" media="screen" type="text/css" href="/javascript/jquery/plugins/colorpicker/jquery.colorpicker.css" />
+ <script type="text/javascript" src="/javascript/jquery/plugins/colorpicker/jquery.colorpicker.js"></script>
+ <script type="text/javascript" src="/javascript/jquery/plugins/achtung/ui.achtung-mod.min.js"></script>
+--- a/sagenb/data/sage/html/settings/notebook_settings.html
++++ b/sagenb/data/sage/html/settings/notebook_settings.html
+@@ -2,12 +2,10 @@
+ {% block title %}{{ gettext('Notebook Settings') }}{% endblock %}
+
+ {% block more_css %}
+-<link rel="stylesheet" href="/javascript/jquery/plugins/farbtastic/farbtastic.css" type="text/css" />
+ {% endblock %}
+
+ {% block javascript %}
+ <script type="text/javascript" src="/javascript/sage/js/ws_list.js"></script>
+-<script type="text/javascript" src="/javascript/jquery/plugins/farbtastic/farbtastic.min.js"></script>
+ {% endblock %}
+
+ {% block page_id %}notebook-settings-page{% endblock %}
+--- a/sagenb/notebook/conf.py
++++ b/sagenb/notebook/conf.py
+@@ -213,7 +213,6 @@
+
+ if DS[o][TYPE] == T_COLOR:
+ s += u' <div id="picker_%s"></div>\n' % color_picker
+- special_init += u' $("#picker_%s").farbtastic("#%s");\n' % (color_picker, o)
+ color_picker += 1
+
+ s += u' </td>\n <td class="%s">%s</td>\n </tr>\n' % updated.get(o, ('', ''))
diff --git a/debian/patches/series b/debian/patches/series
index bb06ebb..f0f8142 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,6 @@ fix-sass-syntax.patch
use-system-jquery.js
update-flask-0.11.patch
update-codemirror-version.patch
+switch-system-jquery-vanderlee-colorpicker.patch
disable-bgiframe.patch
+disable-farbtastic-jpicker.patch
diff --git a/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch b/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch
new file mode 100644
index 0000000..7a54e36
--- /dev/null
+++ b/debian/patches/switch-system-jquery-vanderlee-colorpicker.patch
@@ -0,0 +1,79 @@
+--- a/sagenb/notebook/interact.py
++++ b/sagenb/notebook/interact.py
+@@ -523,18 +523,12 @@
+ <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});"
+ value="%s"
+ style="%s" />
+ </td>
+- <td>
+- <div id="%s-picker" style="%s">
+- <div style="%s"></div>
+- </div>
+- </td>
+ </tr>
+- </table>""" % (id, input_change, id, id, default, input_style,
+- id, style1, style2)
++ </table>""" % (id, input_change, default, input_style)
+
+ # JS
+ s += """<script>
+@@ -546,27 +540,21 @@
+ // 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) {
+- $(pkr).css({zIndex: '10'}).show();
+- return false;
+- },
+- onChange : function (hsb, hex, rgb) {
+- color = '#' + hex;
+- if (input.val() !== color) {
+- input.val(color);
+- input.css({
+- backgroundColor: color,
+- color: hsb.b > 50 ? '#000000' : '#ffffff'
+- });
+- div.css({backgroundColor: color});
+- %s;
+- }
+- },
+- onSubmit : function (hsb, hex, rgb, el) {
+- $(el).ColorPickerHide();
+- }
++ picker.colorpicker({
++ color: '%s',
++ alpha: true,
++ showOn: 'all',
++ buttonImage: '/javascript/jquery/plugins/colorpicker/images/ui-colorpicker.png',
++ buttonImageOnly: true,
++ buttonColorize: true,
++ select: function(event, color) {
++ var hex = color.formatted;
++ var hsb = color.colorPicker.color.getHSV();
++ hsb.b = hsb.v; // compatibility with old colorpicker
++ var rgb = color.colorPicker.color.getRGB();
++ %s;
++ },
++
+ });
+ }, 1);
+ </script>""" % (default, id, id, id, default, default, change)
+--- a/sagenb/data/sage/html/notebook/base.html
++++ b/sagenb/data/sage/html/notebook/base.html
+@@ -27,8 +27,8 @@
+ <script type="text/javascript" src="/javascript/jquery/plugins/form/jquery.form.min.js"></script>
+ <link rel="stylesheet" href="/javascript/jquery/plugins/jpicker/css/jPicker-1.1.6.min.css" type="text/css" />
+ <script type="text/javascript" src="/javascript/jquery/plugins/jpicker/jpicker-1.1.6.min.js"></script>
+-<link rel="stylesheet" media="screen" type="text/css" href="/javascript/jquery/plugins/colorpicker/css/colorpicker.css" />
+-<script type="text/javascript" src="/javascript/jquery/plugins/colorpicker/js/colorpicker.min.js"></script>
++<link rel="stylesheet" media="screen" type="text/css" href="/javascript/jquery/plugins/colorpicker/jquery.colorpicker.css" />
++<script type="text/javascript" src="/javascript/jquery/plugins/colorpicker/jquery.colorpicker.js"></script>
+ <script type="text/javascript" src="/javascript/jquery/plugins/achtung/ui.achtung-mod.min.js"></script>
+
+ <!-- Jmol - embedded 3D graphics **needs to be before jmol_lib.js** -->
diff --git a/debian/python-sagenb.links b/debian/python-sagenb.links
index 064ea17..b6ee62f 100644
--- a/debian/python-sagenb.links
+++ b/debian/python-sagenb.links
@@ -6,4 +6,5 @@
/usr/share/javascript/jquery-ui /usr/lib/python2.7/dist-packages/sagenb/data/jqueryui/js
/usr/share/javascript/jquery-ui/themes/base /usr/lib/python2.7/dist-packages/sagenb/data/jqueryui/css/sage
/usr/share/javascript/json /usr/lib/python2.7/dist-packages/sagenb/data/json
+/usr/share/javascript/libjs-jquery-colorpicker/ /usr/lib/python2.7/dist-packages/sagenb/data/jquery/plugins/colorpicker
/usr/share/tinymce/www /usr/lib/python2.7/dist-packages/sagenb/data/tiny_mce
--
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