5 <%= stylesheet_link_tag 'id' %>
6 <!--[if !IE || gte IE 9]><!-->
7 <%= javascript_include_tag 'id' %>
11 <div id='id-container'></div>
13 if (typeof iD == 'undefined') {
14 document.getElementById('id-container').innerHTML = 'This editor is supported ' +
15 'in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. ' +
16 'Please upgrade your browser or use Potlatch 2 to edit the map.';
17 document.getElementById('id-container').className = 'unsupported';
19 <% locale = select_locale(ID::LOCALES).to_s %>
22 .presets(iD.data.presets)
23 .imagery(iD.data.imagery)
24 .taginfo(iD.taginfo())
26 .assetPath("/iD/") <%# Cant use asset_path('iD/') in production. %>
27 .assetMap(<%= assets("iD").to_json.html_safe %>)
28 .locale("<%= locale %>", "<%= asset_path("iD/locales/#{locale}.json") %>")
30 <% token = @user.access_token(ID_KEY) %>
31 url: "<%= request.protocol + request.host_with_port %>",
32 oauth_consumer_key: "<%= token.client_application.key %>",
33 oauth_secret: "<%= token.client_application.secret %>",
34 oauth_token: "<%= token.token %>",
35 oauth_token_secret: "<%= token.secret %>"
38 id.map().on('move.embed', parent.$.throttle(250, function() {
39 var zoom = ~~id.map().zoom(),
40 center = id.map().center(),
41 llz = { lon: center[0], lat: center[1], zoom: zoom };
43 parent.updateLinks(llz, zoom);
45 // Manually resolve URL to avoid iframe JS context weirdness.
46 // http://bl.ocks.org/jfirebaugh/5439412
47 var hash = parent.OSM.formatHash(llz);
48 if (hash !== parent.location.hash) {
49 parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
53 parent.$("body").on("click", "a.set_position", function (e) {
55 var data = parent.$(this).data();
57 // 0ms timeout to avoid iframe JS context weirdness.
58 // http://bl.ocks.org/jfirebaugh/5439412
59 setTimeout(function() {
62 Math.max(data.zoom || 15, 13));
66 d3.select('#id-container')