~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to horizon/static/horizon/js/jquery/jquery.cookie.js

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman, Adrien Cunin
  • Date: 2012-04-04 07:21:15 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20120404072115-lb9v3gq3yv93ern2
Tags: 2012.1~rc2-0ubuntu1
[ Chuck Short ]
* New usptream release.
* debian/control: Use python-cherrypy3
* debian/rules: Update pythonpath in order to run tests.
* debian/patches/fix-coverage-binary-name.patch: Make the testsuite
  run.
* debian/rules: Fail build if tests fail.

[ Adam Gandelman ]
* debian/control: Add python-memcache 
* debain/dashboard.conf: Update to match current upstream documentation
  (LP: #966069)

[ Adrien Cunin ]
* Renamed Apache config file from dashboard.conf to openstack-dashboard.conf
  (LP: #965410)
  - Updated post{inst,rm} and added preinst to handle correctly the rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
 * jQuery Cookie Plugin
 
3
 * https://github.com/carhartl/jquery-cookie
 
4
 *
 
5
 * Copyright 2011, Klaus Hartl
 
6
 * Dual licensed under the MIT or GPL Version 2 licenses.
 
7
 * http://www.opensource.org/licenses/mit-license.php
 
8
 * http://www.opensource.org/licenses/GPL-2.0
 
9
 */
 
10
(function($) {
 
11
    $.cookie = function(key, value, options) {
 
12
 
 
13
        // key and at least value given, set cookie...
 
14
        if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
 
15
            options = $.extend({}, options);
 
16
 
 
17
            if (value === null || value === undefined) {
 
18
                options.expires = -1;
 
19
            }
 
20
 
 
21
            if (typeof options.expires === 'number') {
 
22
                var days = options.expires, t = options.expires = new Date();
 
23
                t.setDate(t.getDate() + days);
 
24
            }
 
25
 
 
26
            value = String(value);
 
27
 
 
28
            return (document.cookie = [
 
29
                encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
 
30
                options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
 
31
                options.path    ? '; path=' + options.path : '',
 
32
                options.domain  ? '; domain=' + options.domain : '',
 
33
                options.secure  ? '; secure' : ''
 
34
            ].join(''));
 
35
        }
 
36
 
 
37
        // key and possibly options given, get cookie...
 
38
        options = value || {};
 
39
        var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
 
40
 
 
41
        var pairs = document.cookie.split('; ');
 
42
        for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
 
43
            if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
 
44
        }
 
45
        return null;
 
46
    };
 
47
})(jQuery);