Sha256: ed5cebd41abd0349d1a0b34c9c13f335d3c5828ab8443e41564fdeb39c7957cb

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

// refactoring from https://github.com/leonid-shevtsov/cacheable-flash-jquery
var Flash = new Object();

Flash.data = {};

Flash.transferFromCookies = function() {
  var data = JSON.parse(unescape($.cookie("flash") || '{}'));
  if(!data) data = {};
  Flash.data = data;
  $.cookie('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
};

Flash.writeDataTo = function(name, element, callback) {
  element = $(element);
  var message = "";
  if (Flash.data[name]) {
    message = Flash.data[name].toString().replace(/\+/g, ' ');
    element.text(message);
    if (callback && typeof(callback) === 'function') {
      callback(element);
    } else {
      element.show();
    }
  }
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cacheable_flash-0.3.4 vendor/assets/javascripts/flash.js.erb