Sha256: dfbda8da07c95f478a14fd19a86a551580b627aa27322050d0937c21b651c645

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

OverlayMe.Mixin.Storable = {

  loadCss: (element=@el, default_css) ->
    return unless @id
    if ( cssData = localStorage.getItem(@id) )
      $o(element).css(JSON.parse(cssData))
      # console.log 'load: ', @id, cssData
    else
      $o(element).css(default_css) unless default_css == undefined
    
  saveCss: (element=@el) ->
    return unless @id
    @css_attributes_to_save = ['top', 'left', 'display', 'opacity'] unless @css_attributes_to_save
    cssData = {}
    for css_attribute in @css_attributes_to_save
      cssData[css_attribute] = $o(element).css(css_attribute)
    # console.log 'save: ', @id, JSON.stringify(cssData)
    localStorage.setItem(@id, JSON.stringify(cssData))

}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overlay_me-0.13.4 javascripts/coffeescripts/mixins/storable.js.coffee
overlay_me-0.13.0 javascripts/mixins/storable.js.coffee