3 $(document).ready(function () {
4 window.changesaved = true;
6 window.markChanged = function (saved) {
7 window.changesaved = saved;
10 $(window).on("beforeunload", function() {
11 if (!window.changesaved) {
12 return I18n.t("site.edit.potlatch_unsaved_changes");
16 window.updatelinks = function (lon, lat, zoom, layers, minlon, minlat, maxlon, maxlat, object) {
17 var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
19 if (hash !== location.hash) {
20 location.replace(hash);
23 updateLinks({ lon: lon, lat: lat }, zoom);
26 var potlatch = $("#potlatch"),
27 urlparams = OSM.params(),
28 potlatch_swf = <%= asset_path("potlatch/potlatch.swf").to_json %>,
29 install_swf = <%= asset_path("expressInstall.swf").to_json %>,
34 flashvars.winie = document.all && window.print ? true : false;
35 flashvars.token = potlatch.data("token");
37 if (potlatch.data("lat") && potlatch.data("lon")) {
38 flashvars.lat = potlatch.data("lat");
39 flashvars.long = potlatch.data("lon");
40 flashvars.scale = potlatch.data("zoom");
42 var mapParams = OSM.mapParams();
44 flashvars.lat = mapParams.lat;
45 flashvars.long = mapParams.lon;
46 flashvars.scale = mapParams.zoom || 17;
49 if (flashvars.scale < 11) flashvars.scale = 11;
51 if (urlparams.gpx) flashvars.gpx = urlparams.gpx;
52 if (urlparams.way) flashvars.way = urlparams.way;
53 if (urlparams.node) flashvars.node = urlparams.node;
54 if (urlparams.custombg) flashvars.custombg = urlparams.custombg;
56 attributes.id = "potlatch";
57 attributes.bgcolor = "#FFFFFF";
59 swfobject.embedSWF(potlatch_swf, "potlatch", "100%", "100%", "6",
60 install_swf, flashvars, params, attributes);