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' || !iD.detect().support) {
14 document.getElementById('id-container').innerHTML = 'This editor is supported ' +
15 'in Firefox, Chrome, Safari, Opera, and Internet Explorer 11 and above. ' +
16 'Please upgrade your browser or use Potlatch 2 to edit the map.';
17 document.getElementById('id-container').className = 'unsupported';
19 <% locale = ID::LOCALES.preferred(preferred_languages).to_s %>
22 .presets(iD.data.presets)
23 .imagery(iD.data.imagery)
24 .taginfo(iD.services.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 if (id.inIntro()) return;
40 var zoom = ~~id.map().zoom(),
41 center = id.map().center(),
42 llz = { lon: center[0], lat: center[1], zoom: zoom };
44 parent.updateLinks(llz, zoom);
46 // Manually resolve URL to avoid iframe JS context weirdness.
47 // http://bl.ocks.org/jfirebaugh/5439412
48 var hash = parent.OSM.formatHash(llz);
49 if (hash !== parent.location.hash) {
50 parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
54 parent.$("body").on("click", "a.set_position", function (e) {
56 var data = parent.$(this).data();
58 // 0ms timeout to avoid iframe JS context weirdness.
59 // http://bl.ocks.org/jfirebaugh/5439412
60 setTimeout(function() {
63 Math.max(data.zoom || 15, 13));
67 d3.select('#id-container')