Sha256: a03f273f46effd4083c0aacbe4c82997edbe45070c4ac6cb29f0352912e7b565

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

# Instagram's oembed endpoint returns "photo" oembed types (instead of "rich"),
# and only a URL to the photo, not an actual embed code. Therefore, we need to
# use StaticTemplate to use the iframe embed code.
class Embeditor.Adapters.Instagram extends Embeditor.Adapters.StaticTemplate
    className: "Instagram"

    @Template = Embeditor.Template('instagram')

    @QueryDefaults =
        maxwidth  : 612
        maxheight : 710

    @Matchers = [
        # http://instagram.com/p/e8hJe6CvTW/
        new RegExp "instagram\.com\/p\/([^/]+)", "gi"
    ]


    swap: ->
        match = @_parseUrl()
        return false if not match

        photo_id = match[1]

        @embed Instagram.Template
            maxheight   : @queryParams.maxheight
            maxwidth    : @queryParams.maxwidth
            photo_id    : photo_id

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
embeditor-rails-0.1.0 app/assets/javascripts/embeditor/adapters/instagram.js.coffee