Sha256: ac70a068ebca1d2ee2f46ad1ed8e946dce4189b0c657d5a90e286a0d4fb87dfa

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

Trestle.cookie = {
  get: function(name) {
    name += '=';

    var cookies = document.cookie.split(/;\s*/)

    for (i = cookies.length - 1; i >= 0; i--) {
      if (!cookies[i].indexOf(name)) {
        return cookies[i].replace(name, '');
      }
    }

    return "";
  },

  set: function(name, value) {
    document.cookie = name + "=" + encodeURIComponent(value) + "; path=/";
  },

  delete: function(name) {
    document.cookie = name + "=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
  }
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trestle-0.8.5 app/assets/javascripts/trestle/_cookies.js