3 document.addEventListener("DOMContentLoaded", function(e) {
4 var container = document.getElementById("id-container");
6 if (typeof iD == 'undefined' || !iD.Detect().support) {
7 container.innerHTML = 'This editor is supported ' +
8 'in Firefox, Chrome, Safari, Opera, Edge, and Internet Explorer 11. ' +
9 'Please upgrade your browser or use Potlatch 2 to edit the map.';
10 container.className = 'unsupported';
15 .assetMap(container.dataset.assetMap)
16 .locale(container.dataset.locale, container.dataset.localePath)
18 urlroot: location.protocol + "//" + location.host,
19 oauth_consumer_key: container.dataset.consumerKey,
20 oauth_secret: container.dataset.consumerSecret,
21 oauth_token: container.dataset.token,
22 oauth_token_secret: container.dataset.tokenSecret
25 id.map().on('move.embed', parent.$.throttle(250, function() {
26 if (id.inIntro()) return;
27 var zoom = ~~id.map().zoom(),
28 center = id.map().center(),
29 llz = { lon: center[0], lat: center[1], zoom: zoom };
31 parent.updateLinks(llz, zoom);
33 // Manually resolve URL to avoid iframe JS context weirdness.
34 // http://bl.ocks.org/jfirebaugh/5439412
35 var hash = parent.OSM.formatHash(llz);
36 if (hash !== parent.location.hash) {
37 parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
41 parent.$("body").on("click", "a.set_position", function (e) {
43 var data = parent.$(this).data();
45 // 0ms timeout to avoid iframe JS context weirdness.
46 // http://bl.ocks.org/jfirebaugh/5439412
47 setTimeout(function() {
50 Math.max(data.zoom || 15, 13));