Sha256: 95777bf9d1b14febfa9e4ed5cb01249c2b87482d8a854e0a271dc05462b9ca88
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
#= require 'overlays/image' class OverlayMe.Overlays.DynamicManager extends Backbone.Model initialize: () -> if ( listJSON = localStorage.getItem('dyn_image_list') ) @list = JSON.parse(listJSON) else @list = [] isPresent: (image_id) -> for saved in @list return true if saved.id == image_id return false isEmpty: -> return @list.length == 0 addImage: (src, options = {} ) -> new_image = @loadImage(src, options) if new_image && !@isPresent(new_image.image_id) @list.push { id: new_image.image_id, src: new_image.image_src } @saveList() new_image loadImage: (src, options = {} ) -> image_id = OverlayMe.Overlays.urlToId(src) unless $("#overlay_me_images_container ##{image_id}").length > 0 _default_css = $.extend { visibility: 'visible' }, options.default_css image = new OverlayMe.Overlays.Image(src, { destroyable: true, default_css: _default_css }) OverlayMe.images_management_div.append image.render() image delImage: (image_id) -> for image in @list if image.id == image_id @list.splice(@list.indexOf(image), 1) @saveList() break OverlayMe.images_management_div.del image_id loadAll: () -> for image in @list @addImage(image.src) saveList: -> localStorage.setItem('dyn_image_list', JSON.stringify(@list))
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
overlay_me-0.12.0 | javascripts/overlays/dynamic_images_mngmt.js.coffee |