Fixes to jquery.colorpicker.js

Permalink 1 user found helpful
I was frustrated by the concrete-provided colorpicker. Problems:
* Could not paste values -- have to retype every time.
* More important, the color picker has a bug:
-- it will arbitrarily change entered values:

Try these values, for example:
Hexcode #81D8D0 is changed to # 82d9d0
RGB 129,216,208 is change to RGB 128,217,208

Minor changes to entered values make graphic artists worry.

I have attached a file that repairs these problems.
- Download that attached file 'jquery.colorpicker.txt';
- Change its name to 'jquery.colorpicker.js'
- Replace the file 'jquery.colorpicker.js' in /concrete/js

More about the changes:
In addition changed HSB values back to the original stock version that allows fractional values when the RGB or HEX creates them, so cutting and pasting HSB values return the same exact RGB and HEX values.

And I changed the stupid 'Ok' button to OK. 'Ok' is NOT okay.

1 Attachment

nemonoman
 
simonchilton replied on at Permalink Reply
simonchilton
Hi. Firstly, thanks for your post.

Unfortunately, it didn't work for me. I have no file named jquery.colorpicker.js in the /concrete/js folder. Instead I have _jquery.colorpicker.js in /concrete/js/ccm_app. Replacing this one didn't affect the color picker.

I'm using v5.5.2.1.
nemonoman replied on at Permalink Reply
nemonoman
Simon: Actually, it sort of HAS to work. Either you have not replaced the file, or the existing file is still lingering in your browser's cache.

I have not upgraded to 5.5. I forked my own version off 5.3 some time ago so was unfamiliar with the directory/name changes. HOWEVER: The problematic colorpicker has not changed in those versions. So my fixes will be helpful.

You are correct that the colorpicker 5.5 info is:
/concrete/js/ccm_app/_jquery.colorpicker.js


To test whether your browser is using my version, point your browser to:
http://MyWebSiteURL.com/concrete/js/ccm_app/_jquery.colorpicker.js...

You should see the words "Repairs done" in the header. If you don't, clear you browser cache and refresh the page. If you STILL don't, check again that you have actually replaced
/concrete/js/ccm_app/_jquery.colorpicker.js
with my new file.
JohntheFish replied on at Permalink Reply
JohntheFish
In 5.5+, all the files in that directory are concatenated into ccm_app.js and loaded together. The concatenation is done by Andrew running an offline tool when the C5 version is released and there is no automated repetition.
nemonoman replied on at Permalink Reply
nemonoman
Thanks John.

As you point out, my fixes will now not work. The rotten concrete5-added modifications to the colorpicker freeware are now embedded in the concatenated file. The fixes will not be applied.

Fixes to that file are possible, but someone else is going to have to do it. Like a lot of concrete code, it's just a rat's nest.

On a personal note. I forked off of concrete 5.3 because it was full of bugs, overcomplications, restrictions and inadequacies, and the development team was not responsive to addressing even serious errors -- instead, when I messaged problems and fixes, I was waved off and warned of the dangers of making changes to the concrete5 "core code."

So now you get what you get with colorpicker, unless you are pretty smart and very determined.

Good luck making color #81D8D0. Good luck pasting color values.
Adios, muchachos.

PS. If you are determined, you can probably fix the pasting problem by finding and replacing:

Z.find("input").bind("keydown",q)

with
Z.find("input").bind("keyup",q)

in ccm.app.js
dingus9 replied on at Permalink Reply 1 Attachment
This was still a major issue for me because I was trying to add hex codes to a customizable template and it was drastically modifying my color values. I ended up kinda ghetto patching nemonoman's modified unminified colorpicker.js into the current ccm.app.js file.... I've attached the file for others to save time. PS I noticed a few js errors in the console, but right now I'm just too mad to fix them since it worked.

I'm really not sure why this hasn't been fixed yet since it's clearly changing valid hex and rgb color values. I ran into just about every color I wanted to set being changed to a different value.

I'm using Concrete5: 5.6.3.1
File replaced: /concrete/js/ccm.app.js
JohntheFish replied on at Permalink Reply
JohntheFish
You could try using the alternate spectrum picker - free addon.
http://www.concrete5.org/marketplace/addons/spectrum-color-picker/...
dingus9 replied on at Permalink Reply
I looked at that addon initially, didn't try it because I didn't see how it would allow me to paste in the values I need. Honestly I almost just wrote a user script to toggle the the fields to text boxes. But the hacky fix worked OK... until I update then I'll have to repatch :(
nemonoman replied on at Permalink Reply
nemonoman
It seems strange and disturbing to me that the nasty problem and simple fix have been identified for 2 years and still not implemented and still causing headaches, and that the suggested solution is an add-on.