Sha256: ea3675eeb8e64e5b729252efa8b63bf587d40e854fcf238b7ec7b404d0574024

Contents?: true

Size: 626 Bytes

Versions: 4

Compression:

Stored size: 626 Bytes

Contents

class @Cookie
  @set: (name, value, exdays=null)->
    exdate = new Date()
    exdate.setDate(exdate.getDate() + exdays)
    value = "#{escape(value)}; path=/"
    value += "; expires=#{exdate.toUTCString()}" if exdays
    value += "; domain=.#{BASE_DOMAIN}"  if BASE_DOMAIN and URL.parse(window.location.href).root_domain != '0.0'
    document.cookie = "#{name}=#{value}"

  @get: (name)->
    cookies = document.cookie.split(";")
    for cookie in cookies
      x = cookie.substr(0,cookie.indexOf("="))
      y = cookie.substr(cookie.indexOf("=")+1)
      x = x.replace(/^\s+|\s+$/g,"")
      return unescape(y) if (x==name)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fanforce-app-factory-2.0.0.rc5 lib/fanforce/app_factory/asset_framework/app_factory/lib/cookie.coffee
fanforce-app-factory-2.0.0.rc4 lib/fanforce/app_factory/asset_framework/app_factory/lib/cookie.coffee
fanforce-app-factory-2.0.0.rc2 lib/fanforce/app_factory/asset_framework/app_factory/lib/cookie.coffee
fanforce-app-factory-2.0.0.rc1 lib/fanforce/app_factory/asset_framework/app_factory/lib/cookie.coffee