3 $(document).ready(function () {
4 var id = $("#id-embed");
6 if (id.data("configured") === true) {
7 var hash = location.hash.substring(1);
8 var hashParams = hash ? OSM.params(hash) : {};
9 var mapParams = OSM.mapParams();
12 if (mapParams.object) {
13 params.id = mapParams.object.type[0] + mapParams.object.id;
14 mapParams = OSM.parseHash(location.hash);
15 if (mapParams.center) {
16 params.map = mapParams.zoom + '/' + mapParams.center.lat + '/' + mapParams.center.lng;
18 } else if (id.data("lat") && id.data("lon")) {
19 params.map = "16/" + id.data("lat") + "/" + id.data("lon");
21 params.map = (mapParams.zoom || 17) + '/' + mapParams.lat + '/' + mapParams.lon;
24 if (hashParams.background) params.background = hashParams.background;
25 if (hashParams.comment) params.comment = hashParams.comment;
26 if (hashParams.disable_features) params.disable_features = hashParams.disable_features;
27 if (hashParams.hashtags) params.hashtags = hashParams.hashtags;
28 if (hashParams.locale) params.locale = hashParams.locale;
29 if (hashParams.maprules) params.maprules = hashParams.maprules;
30 if (hashParams.offset) params.offset = hashParams.offset;
31 if (hashParams.photo) params.photo = hashParams.photo;
32 if (hashParams.photo_dates) params.photo_dates = hashParams.photo_dates;
33 if (hashParams.photo_overlay) params.photo_overlay = hashParams.photo_overlay;
34 if (hashParams.photo_username) params.photo_username = hashParams.photo_username;
35 if (hashParams.presets) params.presets = hashParams.presets;
36 if (hashParams.source) params.source = hashParams.source;
37 if (hashParams.validationDisable) params.validationDisable = hashParams.validationDisable;
38 if (hashParams.validationWarning) params.validationWarning = hashParams.validationWarning;
39 if (hashParams.validationError) params.validationError = hashParams.validationError;
40 if (hashParams.walkthrough) params.walkthrough = hashParams.walkthrough;
43 params.gpx = id.data("gpx");
44 } else if (hashParams.gpx) {
45 params.gpx = hashParams.gpx;
48 id.attr("src", id.data("url") + "#" + Qs.stringify(params));
50 alert(I18n.t("site.edit.id_not_configured"));