This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/app/assets/javascripts/cookie.js

34 lines
832 B
JavaScript
Raw Permalink Normal View History

2013-10-27 01:06:58 +02:00
// FIXME: I think the correct way would be replacing all calls to this
// with jQuery.cookie.
(function($) {
$.cookie.defaults['path'] = PREFIX;
$.cookie.defaults['expires'] = 365;
Cookie = {
put: function(name, value, days) {
var options = null;
if (days) {
options = { expires: days };
};
$.cookie(name, value, options);
},
get: function(name) {
// FIXME: compatibility reason. Should sweep this with !! check
// or something similar in relevant codes.
return $.cookie(name) || '';
},
get_int: function(name) {
parseInt($.cookie(name));
},
remove: function(name) {
$.removeCookie(name);
},
unescape: function(value) {
return window.decodeURIComponent(value.replace(/\+/g, " "))
}
};
}) (jQuery);