Sha256: 60e9a13f557fa453fe07d25f2cc5339727392891159823561e7425b03aa0ea13

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

unless typeof define is 'function' and define.amd
  module = @GooglePlus ||= {}
  @define = (name, deps, callback) ->
    module.PhotoReader = callback(module.Reader, module.Photo)

define 'googleplus.photoreader', ['googleplus.reader', 'googleplus.photo'], (Reader, Photo) ->
  class extends Reader
    append: (items) ->
      for item in items
        continue unless item.verb?
        continue unless item.verb is 'post'

        date = if item.published? then new Date(item.published) else null

        continue unless item.object?

        post = item.object

        continue unless post.attachments?

        for attachment in post.attachments
          continue unless attachment.objectType?

          if attachment.objectType is 'photo'
            continue unless attachment.image?

            if attachment.fullImage?
              @collection.push new Photo
                url: attachment.image.url,
                width: attachment.fullImage.width,
                date: date
            else
              @collection.push new Photo
                url: attachment.image.url,
                width: null,
                date: date

          else if attachment.objectType is 'album'
            continue unless attachment.thumbnails?

            for thumbnail in attachment.thumbnails
              continue unless thumbnail.image?

              @collection.push new Photo
                url: thumbnail.image.url,
                width: null,
                date: date

      return

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
googleplus-reader-0.0.5 lib/assets/javascripts/googleplus.photoreader.js.coffee