-<iframe frameBorder="0" id="id-embed" class="id-embed"></iframe>
-<% token = @user.access_token(ID_KEY) %>
-<script>
-var keys = {
- '<%= request.protocol + request.host_with_port %>': {
- oauth_consumer_key: "<%= token.client_application.key %>",
- oauth_secret: "<%= token.client_application.secret %>",
- oauth_token: "<%= token.token %>",
- oauth_token_secret: "<%= token.secret %>"
+ <div id="map">
+ <iframe frameBorder="0" id="id-embed" class="id-embed"></iframe>
+ </div>
+ <script>
+ var params = {};
+
+ var mapParams = OSM.mapParams();
+ if (mapParams.object) {
+ params.id = mapParams.object.type[0] + mapParams.object.id;
+ mapParams = OSM.parseHash(location.hash);
+ if (mapParams.center) {
+ params.map = mapParams.zoom + '/' + mapParams.center.lng + '/' + mapParams.center.lat;
+ }
+ } else {
+<% if @lat && @lon -%>
+ params.map = '16/<%= @lon %>/<%= @lat %>';
+<% else -%>
+ params.map = (mapParams.zoom || 17) + '/' + mapParams.lon + '/' + mapParams.lat;
+<% end -%>
+ }
+
+ var hashParams = OSM.params(location.hash.substring(1));
+
+ if (hashParams.background) {
+ params.background = hashParams.background;