Skip to content

Commit

Permalink
Adding embedder for Google Maps and OpenLayers
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom MacWright committed Mar 14, 2011
1 parent 1cad515 commit cee933d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions control/g/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,13 @@ wax.g.Controls.prototype.Legend = function() {
});
return this;
};

wax.g.Controls.prototype.Embedder = function(script_id) {
$(this.map.d).prepend($('<input type="text" class="embed-src" />')
.css({
'z-index': '9999999999',
'position': 'relative'
})
.val("<div id='" + script_id + "'>" + $('#' + script_id).html() + "</div>"));
return this;
};
29 changes: 29 additions & 0 deletions control/ol/embedder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Wax header
var wax = wax || {};
wax.ol = wax.ol || {};

// An interaction toolkit for tiles that implement the
// [MBTiles UTFGrid spec](https://github.com/mapbox/mbtiles-spec)
wax.ol.Embedder =
OpenLayers.Class(OpenLayers.Control, {
initialize: function(options) {
options = options || {};
OpenLayers.Control.prototype.initialize.apply(this, [options || {}]);
},

// Add handlers to the map
setMap: function(map) {
if ($('#' + this.el + '-script').length) {
OpenLayers.Control.prototype.setMap.apply(this, arguments);
$(map.div).prepend($('<input type="text" class="embed-src" />')
.css({
'z-index': '9999999999',
'position': 'relative'
})
.val("<div id='" + this.el + "-script'>" + $('#' + this.el + '-script').html() + "</div>"));
}
this.activate();
},

CLASS_NAME: 'wax.ol.Embedder'
});

0 comments on commit cee933d

Please sign in to comment.