At the admin header issue for D7, sun suggests adding in a standard cookie handling library to Drupal instead of one-off implementations of cookie parsing in modules. In case of admin header it would be the remembering of the collapsed state of the lower shortcut bar. I've reworked the admin header code to use the jquery.cookies.js library, and it is pretty easily done. So I'd suggest adding this library in.
Attached is a core-targetted version of the latest version. That is:
- I've added the name of the library and the version to the top comment. It was not in the downloadable one.
- I've added // $Id$ on the top for CVS versioning.
Suggested to commit to misc/, not in patch form, since it is just a single new file.
Comment | File | Size | Author |
---|---|---|---|
#5 | 507072-jquery-cookie.patch | 1.33 KB | Damien Tournoud |
jquery.cookies.js.txt | 5.21 KB | Gábor Hojtsy |
Comments
Comment #1
Gábor Hojtsy@sun's suggestion is at http://drupal.org/node/484820#comment-1739548 on #484820: Initial D7UX admin header
Comment #2
Gábor HojtsyNote that there are many cookie libraries, with http://plugins.jquery.com/project/Cookie and http://plugins.jquery.com/project/Cookies being two prominent ones. This suggestion is for the later, but the former can be more lightweight and has less features. For the header shortcut bar, the only requirement is to be able to read and write cookies, so either works. If we go with the smaller one (Cookie), then we'd even want to minify it, since it comes in its full source form, which is inconsistent with how we include other libraries.
Comment #3
sunSince we added jQuery UI to core, and various of the jQuery UI libraries implement optional support for http://plugins.jquery.com/project/cookie, that is the plugin we want to add.
@see http://docs.jquery.com/UI/API/1.7/Tabs
@see http://code.google.com/p/jquery-ui/source/browse/trunk/ui/ui.tabs.js
Comment #4
Gábor HojtsyOk, makes total sense, agreed.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedMinified jquery cookie 1.0 (from http://plugins.jquery.com/files/jquery.cookie.js.txt), added $Id$ tag and version information.
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #7
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #9
tic2000 CreditAttribution: tic2000 commentedcrossposted?
Comment #11
Gábor HojtsyThe mod_security Apache module seems to be incompatible with the jquery.cookie.js filename as it is. Opened #522646: jquery.cookie.js incompatible with Apache mod_security by default with more backround info, so we can resolve this.
Comment #12
Senpai CreditAttribution: Senpai commentedThis idea was already in progress with an in-depth discussion at #305221: Add a small cookie handling functions to drupal.js. Marking as duplicate.
Comment #13
Gábor HojtsyHum, this one had code committed, so why set as duplicate?