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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Gábor Hojtsy’s picture

Note 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.

sun’s picture

Since 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

Gábor Hojtsy’s picture

Status: Active » Needs work

Ok, makes total sense, agreed.

Damien Tournoud’s picture

Status: Needs work » Needs review
FileSize
1.33 KB

Minified jquery cookie 1.0 (from http://plugins.jquery.com/files/jquery.cookie.js.txt), added $Id$ tag and version information.

Damien Tournoud’s picture

Title: Add jquery.cookies.js library » Add jquery cookie library
Dries’s picture

Title: Add jquery cookie library » Add jquery.cookies.js library
Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Damien Tournoud’s picture

Title: Add jquery.cookies.js library » Add jquery cookie library
Status: Fixed » Needs review
tic2000’s picture

Status: Needs review » Fixed

crossposted?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

The 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.

Senpai’s picture

Status: Closed (fixed) » Closed (duplicate)

This idea was already in progress with an in-depth discussion at #305221: Add a small cookie handling functions to drupal.js. Marking as duplicate.

Gábor Hojtsy’s picture

Status: Closed (duplicate) » Closed (fixed)

Hum, this one had code committed, so why set as duplicate?