Sha256: 4727d04d8f719835c09c0222da87ef0a61cfa1151167c3d54641e5ce1141e023

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

#= require googleplus.reader
#= require googleplus.photo

class PhotoReader extends GooglePlus.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 GooglePlus.Photo \
              url: attachment.image.url,
              width: attachment.fullImage.width,
              date: date
          else
            @collection.push new GooglePlus.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 GooglePlus.Photo \
              url: thumbnail.image.url,
              width: null,
              date: date

    return

window.GooglePlus ||= {}
window.GooglePlus.PhotoReader = PhotoReader

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
googleplus-reader-0.0.4 lib/assets/javascripts/googleplus.photoreader.js.coffee
googleplus-reader-0.0.3 lib/assets/javascripts/googleplus.photoreader.js.coffee
googleplus-reader-0.0.2 lib/assets/javascripts/googleplus.photoreader.js.coffee