Sha256: cb37625e5edef04687e5358d53bdcbd25243f9502519927933bc5498525396ff
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
unless typeof define is 'function' and define.amd module = @GooglePlus ||= {} @define = (name, deps, callback) -> module.Photo = callback(jQuery) define 'googleplus.photo', ['jquery'], ($) -> class constructor: (@attributes) -> load: (options = {}) -> deferred = $.Deferred() element = $('<img/>') element .on 'load', -> element.off('load error') deferred.resolve(element) return .on 'error', (details...) -> element.off('load error') deferred.reject(details...) return element.attr(src: @url(options)) deferred.promise() url: (options = {}) -> if options.width? and @attributes.preview_url? width = options.width width = Math.min(width, @attributes.width) if @attributes.width? width = Math.round(width) @attributes.preview_url.replace(/w\d+-h\d+(-p)?/, "w#{width}") else @attributes.url or @attributes.preview_url
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
googleplus-reader-0.1.0 | lib/assets/javascripts/googleplus.photo.js.coffee |