Sha256: 908ac60c5a2402c34d5d4d8c055d4042d19600fbe56c043107f756d15801db07

Contents?: true

Size: 825 Bytes

Versions: 7

Compression:

Stored size: 825 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\/([^\/]+)/i
    ]


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

        photoId = match[1]

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
embeditor-rails-2.2.0 app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-2.0.1 app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-2.0.0 app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-2.0.0.beta app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-1.1.1 app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-1.1.0 app/assets/javascripts/embeditor/adapters/instagram.js.coffee
embeditor-rails-1.0.1 app/assets/javascripts/embeditor/adapters/instagram.js.coffee