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 %>
23 .assetPath("/iD/") <%# Can't use asset_path('iD/') in production. %>
24 .assetMap(<%= assets("iD").to_json.html_safe %>)
25 .locale("<%= locale %>", "<%= asset_path("iD/locales/#{locale}.json") %>")
27 <% token = @user.access_token(ID_KEY) %>
28 url: "<%= request.protocol + request.host_with_port %>",
29 oauth_consumer_key: "<%= token.client_application.key %>",
30 oauth_secret: "<%= token.client_application.secret %>",
31 oauth_token: "<%= token.token %>",
32 oauth_token_secret: "<%= token.secret %>"
35 id.map().on('move.embed', parent.$.throttle(250, function() {
36 var zoom = ~~id.map().zoom(),
37 center = id.map().center(),
38 llz = { lon: center[0], lat: center[1], zoom: zoom };
40 parent.updatelinks(llz, zoom);
42 // Manually resolve URL to avoid iframe JS context weirdness.
43 // http://bl.ocks.org/jfirebaugh/5439412
44 var hash = parent.OSM.formatHash(llz);
45 if (hash !== parent.location.hash) {
46 parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
50 parent.$("body").on("click", "a.set_position", function (e) {
52 var data = parent.$(this).data();
54 // 0ms timeout to avoid iframe JS context weirdness.
55 // http://bl.ocks.org/jfirebaugh/5439412
56 setTimeout(function() {
59 Math.max(data.zoom || 15, 13));
63 d3.select('#id-container')