aboutsummaryrefslogtreecommitdiff
path: root/plugin.rb
blob: ff11c3cde6dd564e7277676fdc3dcbc34c17de88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# name: OpenStreetMap Onebox
# version: 0.1
# authors: Marcin Rataj

# whitelist raw iframes
register_asset('javascripts/iframe_whitelist.js', :server_side)

class Onebox::Engine::OpenStreetMapOnebox
  include Onebox::Engine

  # oneboxing canonical links into iframes
  matches_regexp(/^https?:\/\/(?:www\.)?(?:openstreetmap\.org\/\?mlat)\/.+$/)

  def to_html
    "<iframe src='#{@url}' style='border: 0' width='100%' height='350' frameborder='0' scrolling='no'></iframe>"
  end
end