Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 381
- Log:
Radiant is now packaged as a Gem - see Changeset #373, Changeset #374,
Changeset #375, Changeset #376, Changeset #377, Changeset #378,
Changeset #379 and Changeset #380. The application part of Radiant is
now mostly empty; it exists to provide a structure which hooks into the
gem and which provides a framework for extensions. Included in this big
changeset are all the deletions, additions and changes needed to go from
the old ROOL customised Radiant to a new ROOL customised Radiant, which
includes several custom extensions adapted from the old Radiant
modifications and requires Radiant 0.9.1 to be installed as a gem.
- Author:
- rool
- Date:
- Mon Mar 21 14:01:18 +0000 2011
- Size:
- 3103 Bytes
1 | /* |
2 | cookie.js |
3 | |
4 | Copyright (c) 2007, 2008 Maxime Haineault |
5 | (http://www.haineault.com/code/cookie-js/, http://code.google.com/p/cookie-js/) |
6 | |
7 | Portions Copyright (c) 2008, John W. Long |
8 | |
9 | Permission is hereby granted, free of charge, to any person obtaining |
10 | a copy of this software and associated documentation files (the |
11 | "Software"), to deal in the Software without restriction, including |
12 | without limitation the rights to use, copy, modify, merge, publish, |
13 | distribute, sublicense, and/or sell copies of the Software, and to |
14 | permit persons to whom the Software is furnished to do so, subject to |
15 | the following conditions: |
16 | |
17 | The above copyright notice and this permission notice shall be |
18 | included in all copies or substantial portions of the Software. |
19 | |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | */ |
28 | |
29 | Cookie = { |
30 | get: function(name) { |
31 | // Still not sure that "[a-zA-Z0-9.()=|%/]+($|;)" match *all* allowed characters in cookies |
32 | tmp = document.cookie.match((new RegExp(name +'=[a-zA-Z0-9.()=|%/]+($|;)','g'))); |
33 | if (!tmp || !tmp[0]) { |
34 | return null; |
35 | } else { |
36 | return unescape(tmp[0].substring(name.length + 1, tmp[0].length).replace(';', '')) || null; |
37 | } |
38 | }, |
39 | |
40 | set: function(name, value, expireInHours, path, domain, secure) { |
41 | var cookie = [ |
42 | name + '=' + escape(value), |
43 | 'path=' + ((!path || path == '') ? '/' : path) |
44 | ]; |
45 | if (Cookie._notEmpty(domain)) cookie.push('domain=' + domain); |
46 | if (Cookie._notEmpty(expireInHours)) cookie.push(Cookie._hoursToExpireDate(expireInHours)); |
47 | if (Cookie._notEmpty(secure)) cookie.push('secure'); |
48 | return document.cookie = cookie.join(';'); |
49 | }, |
50 | |
51 | erase: function(name, path, domain) { |
52 | path = (!path || typeof path != 'string') ? '' : path; |
53 | domain = (!domain || typeof domain != 'string') ? '' : domain; |
54 | if (Cookie.get(name)) Cookie.set(name, '', 'Thu, 01-Jan-70 00:00:01 GMT', path, domain); |
55 | }, |
56 | |
57 | // Returns true if cookies are enabled |
58 | accept: function() { |
59 | Cookie.set('b49f729efde9b2578ea9f00563d06e57', 'true'); |
60 | if (Cookie.get('b49f729efde9b2578ea9f00563d06e57') == 'true') { |
61 | Cookie.erase('b49f729efde9b2578ea9f00563d06e57'); |
62 | return true; |
63 | } |
64 | return false; |
65 | }, |
66 | |
67 | _notEmpty: function(value) { |
68 | return (typeof value != 'undefined' && value != null && value != ''); |
69 | }, |
70 | |
71 | // Private function for calculating the date of expiration based on hours |
72 | _hoursToExpireDate: function(hours) { |
73 | if (parseInt(hours) == 'NaN' ) return ''; |
74 | else { |
75 | now = new Date(); |
76 | now.setTime(now.getTime() + (parseInt(hours) * 60 * 60 * 1000)); |
77 | return now.toGMTString(); |
78 | } |
79 | } |
80 | } |