Sequenzia/app/assets/javascripts/cookie.js
2013-10-26 18:06:58 -05:00

34 lines
832 B
JavaScript
Executable File

// 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);