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