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