aboutsummaryrefslogtreecommitdiff
path: root/plugin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.rb')
-rw-r--r--plugin.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugin.rb b/plugin.rb
new file mode 100644
index 0000000..ff11c3c
--- /dev/null
+++ b/plugin.rb
@@ -0,0 +1,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