if (typeof DEBUG == "undefined") DEBUG = false;
if (!Date.now) {
Date.now = function e() {
return (new Date).getTime()
}
}
if (!Date.prototype.toSlotFormat) {
Date.prototype.toSlotFormat = function() {
return this.getFullYear() + "-" + (this.getMonth() + 1 < 10 ? "0" + (this.getMonth() + 1) : this.getMonth() + 1) + "-" + (this.getDate() < 10 ? "0" + this.getDate() : this.getDate()) + "T" + (this.getHours() < 10 ? "0" + this.getHours() : this.getHours()) + ":" + (this.getMinutes() < 10 ? "0" + this.getMinutes() : this.getMinutes()) + ":" + (this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds())
}
}(function(e, i, t) {
if ("placeholder" in i.createElement("input")) {
i.placeholderPolyfill = function() {};
i.placeholderPolyfill.active = false;
return
}
i.placeholderPolyfill = function(e) {
return r(e)
};
i.placeholderPolyfill.active = true;
var a = h();
a.addRule(".-placeholder", "color: #888;", 0);
a.addRule("input", "behavior: expression(document.placeholderPolyfill(this))", 0);
a.addRule("textarea", "behavior: expression(document.placeholderPolyfill(this))", 0);
a.addRule("input", "-ms-behavior: expression(document.placeholderPolyfill(this))", 0);
a.addRule("textarea", "-ms-behavior: expression(document.placeholderPolyfill(this))", 0);
function r(a) {
if (!c(a)) {
return
}
if (a.__placeholder != null) {
if (a.__placeholder) {
a.value = r()
}
return
}
var i = d(a);
function r() {
return i = d(a)
}
if (a.value) {
a.__placeholder = false;
if (a.value === r()) {
n()
}
} else {
o()
}
l(a, "keyup", t);
l(a, "keyDown", t);
l(a, "blur", t);
l(a, "focus", s);
l(a, "click", s);
l(a, "propertychange", e);
function e() {
setTimeout(function() {
var e = i;
var t = r();
if (e !== t) {
if (a.__placeholder) {
a.value = t
}
}
if (a.__placeholder && a.value !== t) {
a.__placeholder = false
}
}, 0)
}
function t() {
if (a.value) {
s()
} else {
o()
}
}
function o() {
if (!a.__placeholder && !a.value) {
n()
}
}
function n() {
a.__placeholder = true;
a.value = r();
u(a, "-placeholder")
}
function s() {
if (a.__placeholder) {
a.__placeholder = false;
a.value = "";
p(a, "-placeholder")
}
}
}
function c(e) {
var t = (e.nodeName || "").toLowerCase();
return t === "textarea" || t === "input" && (e.type === "text" || e.type === "password")
}
function l(e, t, a) {
if (e.addEventListener) {
e.addEventListener(t, a, false)
} else if (e.attachEvent) {
e.attachEvent("on" + t, a)
}
}
function o(e, t, a) {
if (e.removeEventListener) {
e.removeEventListener(t, a, false)
} else if (e.detachEvent) {
e.detachEvent("on" + t, a)
}
}
function n(e, t) {
if (e.forEach) {
return e.forEach(t)
}
for (var a = 0, i = e.length; a < i; a++) {
t.call(null, e[a], a, e)
}
}
function s(e, t) {
if (e.filter) {
return e.filter(t)
}
var a = [];
for (var i = 0, r = e.length; i < r; i++) {
if (t.call(null, e[i], i, e)) {
a.push(e[i])
}
}
return a
}
var f = {};
function m(e) {
if (!f[e]) {
f[e] = new RegExp("(^|\\s)+" + e + "(\\s|$)+", "g")
}
return f[e]
}
function u(e, t) {
e.className += " " + t
}
function p(e, t) {
e.className = e.className.replace(m(t), " ")
}
function d(e) {
return e.getAttribute("placeholder") || e.attributes.placeholder && e.attributes.placeholder.nodeValue
}
function h() {
var e = i.styleSheets && i.styleSheets[0];
if (!e) {
var t = i.head || i.getElementsByTagName("head")[0];
var a = i.createElement("style");
a.appendChild(i.createTextNode(""));
i.head.appendChild(a);
e = a.sheet
}
return e
}
})(window, document);
var at = new function() {
var C;
this.Map = function(e, t) {
if (C) {
console.log("AT map already instantiated");
return
}
this.div;
this.mapObject;
this.refreshToken;
this.updateTimer;
this.lastUpdateDateTime;
this.lastHeartBeat = Date.now();
this.heartBeat;
this.language = "FR";
this.trafficLayer = "realTime";
this.initialTrafficForecastDateTime;
this.trafficForecastDateTime;
this.trafficForecastMinDate;
this.trafficForecastMaxDate;
this.trafficForecastDatePicker;
this.createForecastDateSelectionScreenTries = 0;
this.onTrafficForecastDateTimeChange;
this.minZoom = 6;
this.maxZoom = 13;
this.zoomSnap = 1;
this.zoomDelta = 1;
this.zoom = 6;
this.center = [46.75944, 2.40111];
this.maxBounds = L.latLngBounds([35, -15], [57, 20]);
this.SAWT = [];
this.areas = [];
this.exits = [];
this.webcams = [];
this.webcamsLoading = false;
this.webcamsLoaded = false;
this.webcamData;
this.tripTimes = [];
this.tripTimeClusters = [];
this.trafficForecastSections = [];
this.rushHours = [];
this.trafficForecastSectionsLoading = false;
this.trafficForecastSectionsLoaded = false;
this.trafficForecastSectionStates = [];
this.trafficForecastChartData = [];
this.trafficForecastGroups = [];
this.webcamsOn = false;
this.areasOn = false;
this.exitsOn = false;
this.tripTimesOn = false;
this.disruptionsOn = false;
this.informationOn = false;
this.waitingTimesOn = false;
this.disruptions = [];
this.information = [];
this.waitingTimes = [];
this.trafficAlerts = [];
this.markerIconSizes = [];
this.informationMarkers = new Array(this.maxZoom - this.minZoom + 1);
this.disruptionMarkers = new Array(this.maxZoom - this.minZoom + 1);
this.waitingTimeMarkers = new Array(this.maxZoom - this.minZoom + 1);
this.trafficForecastMarkers = new Array(this.maxZoom - this.minZoom + 1);
for (var a = 0; a < this.maxZoom - this.minZoom + 1; ++a) {
this.informationMarkers[a] = [];
this.disruptionMarkers[a] = [];
this.waitingTimeMarkers[a] = [];
this.trafficForecastMarkers[a] = L.layerGroup()
}
this.disruptionsMarkerGroup = new L.featureGroup;
this.informationMarkerGroup = new L.featureGroup;
this.waitingTimeMarkerGroup = new L.featureGroup;
this.webcamMarkerGroups = [];
this.weatherForcast = {};
this.userLocationMarker;
this.tripTimeMarkerGroup = new L.layerGroup;
this.areaMarkerLayer;
this.exitMarkerLayer;
this.trafficStateLayer;
this.backgroundLayer;
this.labelLayer;
this.trafficForecastLayer;
this.zoomControl;
this.buttons = [];
this.menuBar;
this.sideBar;
this.displayBackground = true;
this.displayLabels = true;
this.displayTrafficState = true;
this.displayTrafficForecast = false;
this.displayEventsButtonBar = true;
this.displayExitsButton = true;
this.displayAreasButton = true;
this.displayWebcamsButton = false;
this.displayWeatherForcastButton = false;
this.displayTrafficAlerts = true;
this.displayUserLocationButton = true;
this.displayZoomControl = true;
this.displayFullScreenControl = true;
this.displayMenuBar = true;
this.displayTripTimesListButton = false;
this.displayTrafficForecastDateButton = true;
this.displayTrafficForecastTimeButtons = true;
this.displayTrafficForecastButton = false;
this.displayTrafficForecastListButton = false;
this.poiLookupAreaFactor = L.Browser.touch ? 15 : 5;
this.poiOffsetScaleFactor = 5;
this.enableSegmentRollOver = false;
this.segmentRollOverGeoJsonGeometryLocation = "";
this.segmentRollOverGeoJsonGeometry = null;
this.segmentRollOverPropeties = null;
this.fullScreen;
this.fullScreenToggle;
this.refreshTime = 180;
if (t) {
if (t["minZoom"] && !isNaN(parseInt(t["minZoom"], 10)) && parseInt(t["minZoom"], 10) < 18 && parseInt(t["minZoom"], 10) > 5) {
this.minZoom = t["minZoom"]
}
if (t["zoom"] && !isNaN(parseInt(t["zoom"], 10)) && parseInt(t["zoom"], 10) < 18 && parseInt(t["zoom"], 10) > 5) {
this.zoom = t["zoom"]
}
if (t["maxZoom"] && !isNaN(parseInt(t["maxZoom"], 10)) && parseInt(t["maxZoom"], 10) < 18 && parseInt(t["maxZoom"], 10) > 5) {
this.maxZoom = t["maxZoom"]
}
if (t["poiLookupAreaFactor"] && !isNaN(parseInt(t["poiLookupAreaFactor"]))) {
this.poiLookupAreaFactor = t["poiLookupAreaFactor"]
}
if (t["poiOffsetScaleFactor"] && !isNaN(parseInt(t["poiOffsetScaleFactor"]))) {
this.poiOffsetScaleFactor = t["poiOffsetScaleFactor"]
}
if (t["center"] && t["center"].constructor === Array) {
this.center = t["center"]
}
if (t["maxBounds"] && t["maxBounds"].constructor === Array) {
this.maxBounds = L.latLngBounds(t["maxBounds"])
}
if (t["displayBackground"] === false) {
this.displayBackground = false
}
if (t["displayLabels"] === false) {
this.displayLabels = false
}
if (t["displayTrafficState"] === false) {
this.displayTrafficState = false
}
if (t["displayEventsButtonBar"] === false) {
this.displayEventsButtonBar = false
}
if (t["displayExitsButton"] === false) {
this.displayExitsButton = false
}
if (t["displayAreasButton"] === false) {
this.displayAreasButton = false
}
if (t["displayWebcamsButton"] === true) {
this.displayWebcamsButton = true
}
if (t["displayWeatherForcastButton"] === true) {
this.displayWeatherForcastButton = true
}
if (t["displayTrafficAlerts"] === false) {
this.displayTrafficAlerts = false
}
if (t["displayUserLocationButton"] === false) {
this.displayUserLocationButton = false
}
if (t["displayTripTimesListButton"] === true) {
this.displayTripTimesListButton = true
}
if (t["displayZoomControl"] === false) {
this.displayZoomControl = false
}
if (t["displayFullScreenControl"] === false) {
this.displayFullScreenControl = false
}
if (t["fullScreen"] === true) {
this.fullScreen = true
}
if (t["fullScreenToggle"]) {
this.fullScreenToggle = t["fullScreenToggle"]
}
if (t["displayMenuBar"] === false) {
this.displayMenuBar = false
}
if (t["language"]) {
this.language = t["language"]
}
if (t["trafficLayer"]) {
this.trafficLayer = t["trafficLayer"]
}
if (t["displayTrafficForecastButton"] === true && this.trafficLayer == "forecast") {
this.displayTrafficForecastButton = true
}
if (t["displayTrafficForecastListButton"] === true && this.trafficLayer == "forecast") {
this.displayTrafficForecastListButton = true
}
if (t["displayTrafficForecastDateButton"] === false || this.trafficLayer != "forecast") {
this.displayTrafficForecastDateButton = false
}
if (t["displayTrafficForecastTimeButtons"] === false || this.trafficLayer != "forecast") {
this.displayTrafficForecastTimeButtons = false
}
if (t["initialTrafficForecastDateTime"]) {
this.initialTrafficForecastDateTime = t["initialTrafficForecastDateTime"]
}
if (!isNaN(t['zoomDelta'])) {
this.zoomDelta = t['zoomDelta'];
}
if (!isNaN(t['zoomSnap'])) {
this.zoomSnap = t['zoomSnap'];
}
if (t["onTrafficForecastDateTimeChange"]) {
if (typeof t["onTrafficForecastDateTimeChange"] === "function") {
this.onTrafficForecastDateTimeChange = t["onTrafficForecastDateTimeChange"]
} else if (typeof t["onTrafficForecastDateTimeChange"] === "string" && window[t.onTrafficForecastDateTimeChange]) {
this.onTrafficForecastDateTimeChange = window[t.onTrafficForecastDateTimeChange]
}
}
if (t["refreshTime"] && !isNaN(parseInt(t["refreshTime"], 10)) && parseInt(t["refreshTime"], 10) > 0 && parseInt(t["refreshTime"], 10) < 361) {
this.refreshTime = t["refreshTime"]
}
if (this.enableSegmentRollOver === true && typeof SAWT3_SegmentRollOverGeoJsonGeometryLocation != "undefined" && typeof SAWT3_SegmentRollOverPopupDataLocation != "undefined") {
WT3_LoadGeoJsonSegmentGeometry()
}
}
if (!this.div && !this.mapObject) {
this.div = document.getElementById(e);
this.mapObject = L.map(e, {
center: this.center,
zoom: this.zoom,
minZoom: this.minZoom,
maxZoom: this.maxZoom - 1,
zoomDelta: this.zoomDelta,
zoomSnap: this.zoomSnap,
maxBounds: this.maxBounds,
zoomControl: false,
bounceAtZoomLimits: false,
poiLookupAreaFactor: this.poiLookupAreaFactor,
poiOffsetScaleFactor: this.poiOffsetScaleFactor,
zoomAnimationThreshold: 4,
zoomAnimation: true,
wheelPxPerZoomLevel: 100
});
this.mapObject.attributionControl.addAttribution(getLabelForLocale("attribution", this.language))
}
C = this;
re();
if (this.displayMenuBar) {
if (t && t["sideBarItems"]) {
this.sideBar = L.sideBar({
items: t["sideBarItems"]
}).addTo(this.mapObject);
this.menuBar = L.menuBar({
sideBar: this.sideBar
}).addTo(this.mapObject)
} else {
this.menuBar = L.menuBar().addTo(this.mapObject)
}
if (t && t["mapTitle"]) this.menuBar.setTitle(t["mapTitle"]);
if (t && t["aboutPopinContentFile"]) this.menuBar.getAboutContent(t["aboutPopinContentFile"]);
this.menuBar.setAboutPopinTitle(getLabelForLocale("aboutPopinTitle", this.language))
}
if (this.displayEventsButtonBar && this.trafficLayer != "forecast") {
var i = [{
title: getLabelForLocale("showInformation", this.language),
buttonname: "information",
controlcssclass: "leaflet-customButtonBar-information-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-information-activated-" + this.language.toLowerCase(),
intendedFunction: F
}, {
title: getLabelForLocale("showDisruptions", this.language),
buttonname: "disruptions",
controlcssclass: "leaflet-customButtonBar-disruptions-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-disruptions-activated-" + this.language.toLowerCase(),
intendedFunction: k
}];
L.customControlBar(this.mapObject, {
position: "topleft",
buttons: i
});
this.buttons.push(i)
}
if ((this.displayExitsButton || this.displayAreasButton || this.displayWebcamsButton || this.displayWeatherForcastButton) && this.trafficLayer != "forecast") {
var i = [];
if (this.displayExitsButton) {
i.push({
title: getLabelForLocale("showExits", this.language),
buttonname: "exits",
controlcssclass: "leaflet-customButtonBar-exits-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-exits-activated-" + this.language.toLowerCase(),
intendedFunction: w
})
}
if (this.displayWebcamsButton) {
i.push({
title: getLabelForLocale("showWebcams", this.language),
buttonname: "webcams",
controlcssclass: "leaflet-customButtonBar-webcams-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-webcams-activated-" + this.language.toLowerCase(),
intendedFunction: D
})
}
if (this.displayWeatherForcastButton) {
i.push({
title: getLabelForLocale("showWeatherForcast", this.language),
buttonname: "weatherForcast",
controlcssclass: "leaflet-customButtonBar-weatherForcast-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-weatherForcast-activated-" + this.language.toLowerCase(),
intendedFunction: weatherForcastControl_onClick
})
}
if (this.displayAreasButton) {
i.push({
title: getLabelForLocale("showAreas", this.language),
buttonname: "areas",
controlcssclass: "leaflet-customButtonBar-areas-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-areas-activated-" + this.language.toLowerCase(),
intendedFunction: M
})
}
L.customControlBar(this.mapObject, {
position: "topleft",
buttons: i
});
this.buttons.push(i)
}
if (this.trafficLayer == "forecast") {
var i = [];
if (this.displayTrafficForecastButton) {
i.push({
title: getLabelForLocale("display24hTraffic", this.language),
buttonname: "forecasts",
controlcssclass: "leaflet-customButtonBar-forecasts-" + this.language.toLowerCase(),
controlcssclassactivated: "leaflet-customButtonBar-forecasts-activated-" + this.language.toLowerCase(),
intendedFunction: A
})
}
L.customControlBar(this.mapObject, {
position: "topleft",
buttons: i
});
this.buttons.push(i)
}
if (this.displayTripTimesListButton && this.trafficLayer != "forecast") {
var r = document.getElementsByClassName("leaflet-bottom");
for (var a = 0; a < r.length; ++a) {
r[a].classList.add("with-control-bottom")
}
var i = [{
title: getLabelForLocale("showTripTimeList", this.language),
buttonname: "tripTimeListButton",
controlcssclass: "leaflet-customButtonBar-triptimelist",
controlcssclassactivated: "leaflet-customButtonBar-triptimelist-activated",
intendedFunction: B
}];
L.customControlBar(this.mapObject, {
position: "bottomright",
buttons: i
});
this.buttons.push(i)
}
if (this.trafficLayer == "forecast") {
var r = document.getElementsByClassName("leaflet-bottom");
for (var a = 0; a < r.length; ++a) {
r[a].classList.add("with-control-bottom")
}
var i = [];
if (this.displayTrafficForecastDateButton) {
i.push({
title: getLabelForLocale("openForecastDateSelectScreen", this.language),
buttonname: "openForecastDateSelectScreen",
controlcssclass: "leaflet-customButtonBar-forecastdateselectscreen",
controlcssclassactivated: "leaflet-customButtonBar-forecastdateselectscreen-activated",
intendedFunction: W
})
}
if (this.displayTrafficForecastTimeButtons) {
i.push({
title: getLabelForLocale("trafficForecastTimeSlide", this.language),
buttonname: "trafficForecastTimeSlide",
controlcssclass: "leaflet-customButtonBar-forecasttimeslide",
controlcssclassactivated: "leaflet-customButtonBar-forecastdateselectscreen-activated",
defaultClick: true
})
}
if (this.displayTrafficForecastListButton) {
i.push({
title: getLabelForLocale("trafficForecastList", this.language),
buttonname: "trafficForecastList",
controlcssclass: "leaflet-customButtonBar-forecastlist",
controlcssclassactivated: "leaflet-customButtonBar-forecastlist-activated",
intendedFunction: I
})
}
if (i.length > 0) {
L.customControlBar(this.mapObject, {
position: "bottomright",
buttons: i,
direction: "horizontal"
});
this.buttons.push(i)
}
}
this.zoomControl = new L.Control.Zoom({
position: "topright",
zoomInTitle: getLabelForLocale("zoomIn", this.language),
zoomOutTitle: getLabelForLocale("zoomOut", this.language),
zoomInText: "",
zoomOutText: ""
});
this.zoomControl.addTo(this.mapObject);
if (this.displayUserLocationButton) {
var i = [{
title: getLabelForLocale("showUserLocation", this.language),
buttonname: "userLocation",
controlcssclass: "leaflet-customButtonBar-userlocation",
controlcssclassactivated: "leaflet-customButtonBar-userlocation-activated",
intendedFunction: _
}];
L.customControlBar(this.mapObject, {
position: "topright",
buttons: i
});
this.buttons.push(i)
}
if (this.displayFullScreenControl) {
var i = [{
title: getLabelForLocale("fullScreenMap", this.language),
buttonname: "FullScreen",
controlcssclass: "leaflet-customButtonBar-fullscreen",
controlcssclassactivated: "leaflet-customButtonBar-exitfullscreen",
intendedFunction: O
}];
L.customControlBar(this.mapObject, {
position: "topright",
buttons: i
});
this.buttons.push(i);
if (this.fullScreen) {
L.activateButtonInCustomControlBar("FullScreen")
}
}
this.mapObject.on("click", N);
this.mapObject.on("mousemove", j);
this.mapObject.on("zoomstart", x);
this.mapObject.on("popupclose", E);
this.mapObject.on("zoomend", P);
this.mapObject.on("moveend", Be);
this.mapObject.on("popupclose", Be);
this.mapObject.on("resize", Z);
this.mapObject.on("locationfound", H);
this.mapObject.on("locationerror", R);
this.backgroundLayerOptions = {
maxZoom: this.maxZoom + 1,
minZoom: this.minZoom,
updateWhenZooming: true,
detectRetina: true
};
if (typeof SAWT3_BackgroundTilesLocation != "undefined" && this.displayBackground) {
this.SAWT["SAWT3_BackgroundTilesLocation"] = SAWT3_BackgroundTilesLocation;
var o;
o = L.tileLayer(SAWT3_BackgroundTilesLocation + "{z}/{x}/{y}.png", this.backgroundLayerOptions);
o.setZIndex(0);
o.addTo(this.mapObject);
this.backgroundLayer = o
}
switch (this.trafficLayer) {
case "forecast":
this.displayTrafficState = false;
this.displayTrafficForecast = true;
this.trafficForecastLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
WT3_LoadTrafficForecastSections();
qe();
u();
break;
case "neutral":
this.trafficStateLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_NeutralRoadLayoutLocation != "undefined" && this.displayTrafficState) {
this.SAWT["SAWT3_NeutralRoadLayoutLocation"] = SAWT3_NeutralRoadLayoutLocation;
var n;
n = L.tileLayer(SAWT3_NeutralRoadLayoutLocation + "{z}/{x}/{y}.png", this.trafficStateLayerOptions);
n.setZIndex(20);
n.addTo(this.mapObject);
this.trafficStateLayer = n
}
break;
default:
this.trafficStateLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_RealTimeTrafficStateTilesLocation != "undefined" && this.displayTrafficState) {
this.SAWT["SAWT3_RealTimeTrafficStateTilesLocation"] = SAWT3_RealTimeTrafficStateTilesLocation;
var n;
n = L.tileLayer(SAWT3_RealTimeTrafficStateTilesLocation + "{z}/{x}/{y}.png", this.trafficStateLayerOptions);
n.setZIndex(20);
n.addTo(this.mapObject);
this.trafficStateLayer = n
}
}
this.labelsLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_LabelsTilesLocation != "undefined" && this.displayLabels) {
this.SAWT["SAWT3_LabelsTilesLocation"] = SAWT3_LabelsTilesLocation;
var s;
s = L.tileLayer(SAWT3_LabelsTilesLocation + "{z}/{x}/{y}.png", this.labelsLayerOptions);
s.setZIndex(30);
s.addTo(this.mapObject);
this.labelLayer = s
}
this.exitLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_ExitMarkerTilesLocation != "undefined") {
this.SAWT["SAWT3_ExitMarkerTilesLocation"] = SAWT3_ExitMarkerTilesLocation;
var c = L.tileLayer(SAWT3_ExitMarkerTilesLocation + "{z}/{x}/{y}.png", this.exitLayerOptions);
c.setZIndex(40);
c.on("tileload", G);
c.on("tileunload", z);
this.exitMarkerLayer = c
}
this.areaLayerOptions = {
maxZoom: this.maxZoom,
minZoom: this.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_AreaMarkerTilesLocation != "undefined") {
this.SAWT["SAWT3_AreaMarkerTilesLocation"] = SAWT3_AreaMarkerTilesLocation;
var l = L.tileLayer(SAWT3_AreaMarkerTilesLocation + "{z}/{x}/{y}.png", this.areaLayeroptions);
l.setZIndex(10);
l.on("tileload", G);
l.on("tileunload", z);
this.areaMarkerLayer = l
}
if (typeof SAWT3_WebcamDescriptorsLocation != "undefined") {
this.SAWT["SAWT3_WebcamDescriptorsLocation"] = SAWT3_WebcamDescriptorsLocation;
ce()
}
if (typeof SAWT3_TripTimeMarkersLocation != "undefined") {
this.SAWT["SAWT3_TripTimeMarkersLocation"] = SAWT3_TripTimeMarkersLocation;
We()
}
this.SAWT["SAWT3_MarkerDescriptorsLocation"] = SAWT3_MarkerDescriptorsLocation;
if (typeof SAWT3_RealTimeTrafficEventsLocation != "undefined") {
this.SAWT["SAWT3_RealTimeTrafficEventsLocation"] = SAWT3_RealTimeTrafficEventsLocation;
this.informationMarkerGroup = new L.FeatureGroup;
this.disruptionsMarkerGroup = new L.FeatureGroup;
this.waitingTimeMarkerGroup = new L.FeatureGroup;
ye();
if (C.trafficLayer == "realTime") m()
}
if (this.displayTrafficAlerts && typeof SAWT3_RealTimeTrafficAlertsLocation != "undefined") {
this.SAWT["SAWT3_RealTimeTrafficAlertsLocation"] = SAWT3_RealTimeTrafficAlertsLocation;
Oe()
}
if (this.enableSegmentRollOver) {
this.enableSegmentRollOver = WT3_LoadGeoJsonSegmentGeometry()
}
if (this.enableSegmentRollOver && typeof SAWT3_SegmentRollOverGeoJsonGeometryLocation != "undefined") {
this.SAWT["SAWT3_SegmentRollOverGeoJsonGeometryLocation"] = SAWT3_SegmentRollOverGeoJsonGeometryLocation;
WT3_LoadGeoJsonSegmentGeometry()
}
this.heartBeat = setInterval(this.refreshMapData, 1e3);
f(true)
};
this.Map.prototype.getZoomLevel = function(e) {
this.mapObject.getZoom()
};
this.Map.prototype.setZoomLevel = function(e) {
this.mapObject.setZoom(e)
};
this.Map.prototype.getPosition = function() {
return this.mapObject.getCenter()
};
this.Map.prototype.setPosition = function(e, t) {
this.mapObject.panTo(L.latLng([t, e]))
};
this.Map.prototype.setView = function(e, t, a) {
this.mapObject.setView(L.latLng([t, e]), a)
};
this.Map.prototype.enablePOI = function(e) {
switch (e) {
case "information":
t();
break;
case "disruptions":
i();
break;
case "waitingTimes":
m();
break;
case "exits":
s();
break;
case "areas":
v();
break;
case "webcams":
l();
break;
case "tripTimes":
T();
break;
case "forecasts":
u();
break;
case "weatherForecast":
d();
break;
default:
break
}
};
this.Map.prototype.disablePOI = function(e) {
switch (e) {
case "information":
a();
break;
case "disruptions":
r();
break;
case "waitingTimes":
o();
break;
case "exits":
c();
break;
case "areas":
g();
break;
case "webcams":
p();
break;
case "weatherForcasts":
h();
break;
case "tripTimes":
b();
break;
case "forecasts":
n();
default:
break
}
};
this.Map.prototype.setMouseEnabled = function(e) {
if (e) {
this.mapObject.dragging.enable();
this.mapObject.touchZoom.enable();
this.mapObject.doubleClickZoom.enable();
this.mapObject.scrollWheelZoom.enable();
this.mapObject.boxZoom.enable();
this.mapObject.keyboard.enable();
if (this.mapObject.tap) this.mapObject.tap.enable()
} else {
this.mapObject.dragging.disable();
this.mapObject.touchZoom.disable();
this.mapObject.doubleClickZoom.disable();
this.mapObject.scrollWheelZoom.disable();
this.mapObject.boxZoom.disable();
this.mapObject.keyboard.disable();
if (this.mapObject.tap) this.mapObject.tap.disable()
}
};
this.Map.prototype.hideUI = function() {
var e = document.createElement("style");
e.id = "hiddenControlsStyleSheet";
e.innerHTML = ".leaflet-control-container { visibility:hidden; }";
document.body.appendChild(e)
};
this.Map.prototype.showUI = function() {
var e = document.getElementById("hiddenControlsStyleSheet");
if (e) {
document.body.removeChild(e)
}
};
this.Map.prototype.resize = function(e, t) {
this.div.style.width = e;
this.div.style.height = t
};
this.Map.prototype.openFullScreen = function() {
if (!C.fullScreen) S()
};
this.Map.prototype.leafletVersion = function() {
return L.version
};
this.Map.prototype.mapTitle = function() {
if (this.menuBar.title) {
return this.menuBar.title
}
};
this.Map.prototype.setMapTitle = function(e) {
if (this.menuBar.title) {
this.menuBar.setTitle(e)
}
};
this.Map.prototype.clearPois = function() {
this.areas.length = 0;
this.exits.length = 0;
this.clearWebcams();
this.clearTripTimes()
};
this.Map.prototype.clearWebcams = function() {
this.webcams.length = 0;
this.webcamData = 0;
this.webcamMarkerGroups.forEach(function(e) {
e.clearLayers()
});
this.webcamMarkerGroups.length = 0;
this.webcamsLoaded = false
};
this.Map.prototype.clearWeatherForcasts = function() {
this.weatherForcast.length = 0;
this.weatherForcastData = 0;
this.weatherForcastMarkerGroups.clearLayers();
this.weatherForcastLoaded = false
};
this.Map.prototype.clearEvents = function() {
this.disruptions.length = 0;
this.information.length = 0;
this.waitingTimes.length = 0;
this.informationMarkerGroup.clearLayers();
this.disruptionsMarkerGroup.clearLayers();
this.waitingTimeMarkerGroup.clearLayers()
};
this.Map.prototype.clearTrafficAlerts = function() {
this.trafficAlerts.length = 0
};
this.Map.prototype.clearTripTimes = function() {
this.tripTimes.length = 0
};
this.Map.prototype.setTrafficForecastDateTime = function(e) {
if (typeof this.ClickTimeoutPrevent == "undefined") {
this.ClickTimeoutPrevent = 0
}
if (e >= C.trafficForecastMinDate && e <= C.trafficForecastMaxDate) {
var t = new Date;
t.setMinutes(0);
t.setSeconds(0);
t.setHours(t.getHours() + 1);
if (e < t) {
e = t
}
this.trafficForecastDateTime = e;
C.menuBar.setSubTitle(getLabelForLocale("trafficForecastFor", C.language) + formatDateTime(e, C.language));
if (typeof preventLoadTimeOut != "undefined") {
clearTimeout(preventLoadTimeOut)
}
preventLoadTimeOut = setTimeout(function() {
WT3_LoadTrafficForecastTiles();
WT3_LoadTrafficForecastSections();
WT3_LoadTrafficForecastChartData()
}, this.ClickTimeoutPrevent);
this.ClickTimeoutPrevent = 750;
if (C.onTrafficForecastDateTimeChange) {
C.onTrafficForecastDateTimeChange()
}
if (C.displayTrafficForecastDateButton) {
L.appendChildToButtonInCustomControlBar("openForecastDateSelectScreen", Qe(), false)
}
if (C.displayTrafficForecastTimeButtons) {
L.appendChildToButtonInCustomControlBar("trafficForecastTimeSlide", et(), false)
}
} else {
if (C.trafficForecastSectionsLoaded) {
qe()
}
}
};
this.Map.prototype.refreshMapData = function(e) {
if (e || typeof C.lastHeartBeat == "undefined" || !C.lastHeartBeat || Date.now() - C.lastHeartBeat > C.refreshTime * 1e3) {
console.log("Refresh", C.lastHeartBeat, Date.now(), Date.now() - C.lastHeartBeat);
C.lastHeartBeat = Date.now() - 15e4;
if (C.updateTimer) {
clearInterval(C.updateTimer);
C.updateTimer = false
}
C.refreshToken = SAWT3_RefreshToken;
var t = document.getElementsByTagName("head")[0];
var a = document.getElementById("WT3_RefreshScript");
if (a) {
t.removeChild(a)
}
var i = document.createElement("script");
i.src = WT3_authenticationURL + "/?refresh=Y&keysign=" + WT3_keySign + "&div=" + C.div.id + "&ts=" + Date.now();
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_RefreshScript";
i.async = true;
t.appendChild(i);
C.updateTimer = setInterval(C.updateTimeTokens, 500)
}
};
this.Map.prototype.updateTimeTokens = function(e) {
if (typeof SAWT3_RefreshToken != "undefined" && C.refreshToken != SAWT3_RefreshToken) {
if (C.updateTimer) {
clearInterval(C.updateTimer);
C.updateTimer = false
}
C.lastHeartBeat = Date.now();
if (typeof SAWT3_BackgroundTilesLocation != "undefined" && C.SAWT["SAWT3_BackgroundTilesLocation"] && C.SAWT["SAWT3_BackgroundTilesLocation"] != SAWT3_BackgroundTilesLocation && C.displayBackground) {
C.SAWT["SAWT3_BackgroundTilesLocation"] = SAWT3_BackgroundTilesLocation;
C.mapObject.removeLayer(C.backgroundLayer);
var t = L.tileLayer(SAWT3_BackgroundTilesLocation + "{z}/{x}/{y}.png", C.backgroundLayerOptions);
t.setZIndex(0);
t.addTo(C.mapObject);
C.backgroundLayer = t
}
if (typeof SAWT3_LabelsTilesLocation != "undefined" && C.SAWT["SAWT3_LabelsTilesLocation"] && C.SAWT["SAWT3_LabelsTilesLocation"] != SAWT3_LabelsTilesLocation && C.displayLabels) {
C.SAWT["SAWT3_LabelsTilesLocation"] = SAWT3_LabelsTilesLocation;
C.mapObject.removeLayer(C.labelLayer);
var a = L.tileLayer(SAWT3_LabelsTilesLocation + "{z}/{x}/{y}.png", C.labelsLayerOptions);
a.setZIndex(30);
a.addTo(C.mapObject);
C.labelLayer = a
}
if (typeof SAWT3_ExitMarkerTilesLocation != "undefined" && C.SAWT["SAWT3_ExitMarkerTilesLocation"] && C.SAWT["SAWT3_ExitMarkerTilesLocation"] != SAWT3_ExitMarkerTilesLocation) {
C.SAWT["SAWT3_ExitMarkerTilesLocation"] = SAWT3_ExitMarkerTilesLocation;
var i = L.tileLayer(SAWT3_ExitMarkerTilesLocation + "{z}/{x}/{y}.png", C.exitLayerOptions);
i.setZIndex(40);
i.on("tileload", G);
i.on("tileunload", z);
if (C.mapObject.hasLayer(C.exitMarkerLayer)) {
C.mapObject.removeLayer(C.exitMarkerLayer);
C.mapObject.addLayer(i)
}
C.exitMarkerLayer = i
}
if (typeof SAWT3_AreaMarkerTilesLocation != "undefined" && C.SAWT["SAWT3_AreaMarkerTilesLocation"] && C.SAWT["SAWT3_AreaMarkerTilesLocation"] != SAWT3_AreaMarkerTilesLocation) {
C.SAWT["SAWT3_AreaMarkerTilesLocation"] = SAWT3_AreaMarkerTilesLocation;
var r = L.tileLayer(SAWT3_AreaMarkerTilesLocation + "{z}/{x}/{y}.png", C.areaMarkerOptions);
r.setZIndex(10);
r.on("tileload", G);
r.on("tileunload", z);
if (C.mapObject.hasLayer(C.areaMarkerLayer)) {
C.mapObject.removeLayer(C.areaMarkerLayer);
C.mapObject.addLayer(r)
}
C.areaMarkerLayer = r
}
if (typeof SAWT3_MarkerDescriptorsLocation != "undefined" && C.SAWT["SAWT3_MarkerDescriptorsLocation"] && C.SAWT["SAWT3_MarkerDescriptorsLocation"] != SAWT3_MarkerDescriptorsLocation) {
C.SAWT["SAWT3_MarkerDescriptorsLocation"] = SAWT3_MarkerDescriptorsLocation
}
if (typeof SAWT3_RealTimeTrafficEventsLocation != "undefined" && C.SAWT["SAWT3_RealTimeTrafficEventsLocation"] != SAWT3_RealTimeTrafficEventsLocation) {
C.SAWT["SAWT3_RealTimeTrafficEventsLocation"] = SAWT3_RealTimeTrafficEventsLocation;
C.clearEvents();
ye()
}
if (C.displayTrafficAlerts && typeof SAWT3_RealTimeTrafficAlertsLocation != "undefined" && C.SAWT["SAWT3_RealTimeTrafficAlertsLocation"] != SAWT3_RealTimeTrafficAlertsLocation) {
C.SAWT["SAWT3_RealTimeTrafficAlertsLocation"] = SAWT3_RealTimeTrafficAlertsLocation;
C.clearTrafficAlerts();
Oe()
}
if (typeof SAWT3_WebcamDescriptorsLocation != "undefined" && C.SAWT["SAWT3_WebcamDescriptorsLocation"] && C.SAWT["SAWT3_WebcamDescriptorsLocation"] != SAWT3_WebcamDescriptorsLocation) {
C.SAWT["SAWT3_WebcamDescriptorsLocation"] = SAWT3_WebcamDescriptorsLocation;
C.clearWebcams();
ce()
}
if (typeof SAWT3_TripTimeMarkersLocation != "undefined" && C.SAWT["SAWT3_TripTimeMarkersLocation"] && C.SAWT["SAWT3_TripTimeMarkersLocation"] != SAWT3_TripTimeMarkersLocation) {
C.SAWT["SAWT3_TripTimeMarkersLocation"] = SAWT3_TripTimeMarkersLocation;
C.clearTripTimes();
We()
}
switch (C.trafficLayer) {
case "forecast":
WT3_LoadTrafficForecastSections();
if (typeof C.trafficForecastDateTime == "undefined") {
qe()
}
u();
break;
case "neutral":
C.mapObject.removeLayer(C.trafficStateLayer);
C.trafficStateLayerOptions = {
maxZoom: C.maxZoom,
minZoom: C.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_NeutralRoadLayoutLocation == "undefined") {
SAWT3_NeutralRoadLayoutLocation = "//maptiles.autoroutes-trafic.fr/neutralRoadLayout/"
}
if (typeof SAWT3_NeutralRoadLayoutLocation != "undefined" && C.displayTrafficState) {
C.SAWT["SAWT3_NeutralRoadLayoutLocation"] = SAWT3_NeutralRoadLayoutLocation;
var o;
o = L.tileLayer(SAWT3_NeutralRoadLayoutLocation + "{z}/{x}/{y}.png", C.trafficStateLayerOptions);
o.setZIndex(20);
o.addTo(C.mapObject);
C.trafficStateLayer = o
}
break;
default:
C.trafficStateLayerOptions = {
maxZoom: C.maxZoom,
minZoom: C.minZoom,
detectRetina: false,
updateWhenZooming: true
};
if (typeof SAWT3_RealTimeTrafficStateTilesLocation != "undefined" && C.displayTrafficState) {
C.SAWT["SAWT3_RealTimeTrafficStateTilesLocation"] = SAWT3_RealTimeTrafficStateTilesLocation;
C.mapObject.removeLayer(C.trafficStateLayer);
var o;
o = L.tileLayer(SAWT3_RealTimeTrafficStateTilesLocation + "{z}/{x}/{y}.png", C.trafficStateLayerOptions);
o.setZIndex(20);
o.addTo(C.mapObject);
C.trafficStateLayer = o
}
}
if (typeof SAWT3_SegmentRollOverPopupDataLocation != "undefined" && C.enableSegmentRollOver) {
C.SAWT["SAWT3_SegmentRollOverPopupDataLocation"] = SAWT3_SegmentRollOverPopupDataLocation;
WT3_LoadSegmentRollOverPopupData()
}
C.refreshToken = SAWT3_RefreshToken;
f(true)
} else {
if (Date.now() - C.lastHeartBeat > 175e3) {
clearInterval(C.updateTimer);
C.updateTimer = false;
C.lastHeartBeat = Date.now() - 15e4;
f(false)
}
}
};
var f = function(e) {
if (C.updateErrorPopin) {
C.updateErrorPopin.remove();
C.updateErrorPopin = false
}
if (e) {
if (typeof SAWT3_RealTimeTrafficStateTilesLocation != "undefined" && !SAWT3_RealTimeTrafficStateTilesLocation) {
throw new Error("No time token set for Real Time Traffic Tiles Location, unable to get the data update date time")
} else {
if (typeof lastUpdateDateTime != "undefined") {
lastUpdateDateTime = false
}
var a;
var t = document.getElementsByTagName("head")[0];
var i = document.getElementById("WT3_GetLastUpdateDateTimeScript");
if (i) {
t.removeChild(i)
}
var r = document.createElement("script");
r.src = SAWT3_RealTimeTrafficStateTilesLocation + "info.js";
r.charset = "UTF-8";
r.type = "text/javascript";
r.id = "WT3_GetLastUpdateDateTimeScript";
r.async = true;
t.appendChild(r);
var o = function() {
if (typeof lastUpdateDateTime != "undefined" && lastUpdateDateTime) {
if (typeof lastUpdateTimeOffset == "undefined") {
lastUpdateTimeOffset = "+02:00"
}
C.lastUpdateDateTime = new Date(lastUpdateDateTime + lastUpdateTimeOffset);
if (C.menuBar) {
if (C.trafficLayer != "forecast" && C.weatherForcastLoading !== true && C.weatherForcastLoaded !== true) {
date = formatDateTime(C.lastUpdateDateTime, C.language);
C.menuBar.setSubTitle(getLabelForLocale("dataTime", C.language) + date)
} else if (C.trafficForecastDateTime) {
date = C.lastUpdateDateTime.toLocaleString();
C.menuBar.setSubTitle(getLabelForLocale("trafficForecastFor", C.language) + formatDateTime(C.trafficForecastDateTime, C.language))
} else if (C.weatherForcastLoaded || C.weatherForcastLoading) {
var e = new Date(C.weatherForcastCurrentSlot);
var t = C.language.toLowerCase() + "-" + C.language.toUpperCase();
C.menuBar.setSubTitle(getLabelForLocale("weatherForecastFor", C.language) + e.toLocaleDateString(t) + " " + e.toLocaleTimeString(t).replace(":00:00", getLabelForLocale("weatherForecastHourSuffix", C.language)))
}
}
clearInterval(a)
}
};
a = setInterval(o, 200)
}
} else {
if (!navigator.onLine) {
C.menuBar.setSubTitle(getLabelForLocale("updateError", C.language));
if (!C.updateError) {
if (C.mapObject.hasLayer(C.trafficStateLayer)) C.mapObject.removeLayer(C.trafficStateLayer);
if (C.mapObject.hasLayer(C.informationMarkerGroup)) C.mapObject.removeLayer(C.informationMarkerGroup);
if (C.mapObject.hasLayer(C.disruptionMarkerGroup)) C.mapObject.removeLayer(C.disruptionMarkerGroup);
if (C.mapObject.hasLayer(C.tripTimeMarkerGroup)) C.mapObject.removeLayer(C.tripTimeMarkerGroup);
if (C.mapObject.hasLayer(C.waitingTimeMarkerGroup)) C.mapObject.removeLayer(C.waitingTimeMarkerGroup);
if (C.mapObject.hasLayer(C.webcamMarkerGroups[C.mapObject.getZoom()])) C.mapObject.removeLayer(C.webcamMarkerGroups[C.mapObject.getZoom()]);
if (!C.updateErrorPopin) {
var n = L.popin({
title: getLabelForLocale("updateErrorPopinTitle", C.language),
className: "update-error",
closeButton: false
}).addTo(C.mapObject);
C.updateErrorPopin = n;
var s = document.createElement("h2");
s.innerHTML = getLabelForLocale("updateErrorPopinNetwork", C.language);
s.className = "update-error";
n.addContent(s);
var c = document.createElement("div");
c.className = "update-error";
var l = document.createElement("p");
l.innerHTML = getLabelForLocale("updateErrorPopinNextUpdate", C.language);
c.appendChild(l);
var f = document.createElement("a");
f.href = "#";
f.innerHTML = getLabelForLocale("updateErrorPopinRefreshLink", C.language);
f.onclick = function() {
C.SAWT["SAWT3_ExitMarkerTilesLocation"] = 1;
C.SAWT["SAWT3_AreaMarkerTilesLocation"] = 1;
C.SAWT["SAWT3_MarkerDescriptorsLocation"] = 1;
C.SAWT["SAWT3_RealTimeTrafficEventsLocation"] = 1;
C.SAWT["SAWT3_RealTimeTrafficAlertsLocation"] = 1;
C.SAWT["SAWT3_WebcamDescriptorsLocation"] = 1;
C.SAWT["SAWT3_TripTimeMarkersLocation"] = 1;
C.SAWT["SAWT3_RealTimeTrafficStateTilesLocation"] = 1;
C.refreshMapData(true);
this.innerHTML = getLabelForLocale("updating", C.language);
this.style.textDecoration = "none";
this.onclick = function() {}
};
c.appendChild(f);
n.addContent(c)
}
}
} else {
C.menuBar.setSubTitle(getLabelForLocale("updateError", C.language))
}
}
};
function t() {
C.informationOn = true;
C.mapObject.closePopup();
we();
C.mapObject.addLayer(C.informationMarkerGroup);
if (C.displayEventsButtonBar) L.activateButtonInCustomControlBar("information")
}
function a() {
C.informationOn = false;
if (C.mapObject.hasLayer(C.informationMarkerGroup)) C.mapObject.removeLayer(C.informationMarkerGroup);
if (C.displayEventsButtonBar) L.desactivateButtonInCustomControlBar("information")
}
function i() {
C.disruptionsOn = true;
C.mapObject.closePopup();
C.mapObject.addLayer(C.disruptionsMarkerGroup);
if (C.displayEventsButtonBar) L.activateButtonInCustomControlBar("disruptions")
}
function r() {
C.disruptionsOn = false;
if (C.mapObject.hasLayer(C.disruptionsMarkerGroup)) C.mapObject.removeLayer(C.disruptionsMarkerGroup);
if (C.displayEventsButtonBar) L.desactivateButtonInCustomControlBar("disruptions")
}
function m() {
C.waitingTimesOn = true;
C.mapObject.closePopup();
C.mapObject.addLayer(C.waitingTimeMarkerGroup)
}
function o() {
C.waitingTimesOn = false;
C.mapObject.removeLayer(C.waitingTimeMarkerGroup)
}
function u() {
if (C.displayTrafficForecastButton) {
L.activateButtonInCustomControlBar("forecasts");
C.mapObject.closePopup()
}
if (!C.mapObject.hasLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])) {
C.mapObject.closePopup();
C.mapObject.addLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])
}
}
function n() {
if (C.displayTrafficForecastButton) {
L.desactivateButtonInCustomControlBar("forecasts")
}
if (C.mapObject.hasLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])) {
C.mapObject.removeLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])
}
}
function s() {
C.exitsOn = true;
C.mapObject.closePopup();
p();
g();
C.mapObject.addLayer(C.exitMarkerLayer);
if (C.displayExitsButton) L.activateButtonInCustomControlBar("exits")
}
function c() {
C.exitsOn = false;
if (C.mapObject.hasLayer(C.exitMarkerLayer)) C.mapObject.removeLayer(C.exitMarkerLayer);
if (C.displayExitsButton) L.desactivateButtonInCustomControlBar("exits")
}
function l() {
if (!C.webcamsOn) {
C.mapObject.closePopup();
c();
g();
if (!C.webcamMarkerGroups[C.mapObject.getZoom()]) {
ce()
} else {
C.mapObject.addLayer(C.webcamMarkerGroups[C.mapObject.getZoom()])
}
if (C.displayWebcamsButton) L.activateButtonInCustomControlBar("webcams");
C.webcamsOn = true
}
}
function p() {
if (C.webcamsOn) {
if (C.mapObject.hasLayer(C.webcamMarkerGroups[C.mapObject.getZoom()])) C.mapObject.removeLayer(C.webcamMarkerGroups[C.mapObject.getZoom()]);
if (C.displayWebcamsButton) L.desactivateButtonInCustomControlBar("webcams")
}
C.webcamsOn = false
}
function d() {
if (!C.weatherForcastOn) {
C.mapObject.closePopup();
c();
g();
if (!C.weatherForcastMarkerGroups) {
ue()
} else {
C.mapObject.addLayer(C.weatherForcastMarkerGroups)
}
if (C.displayWeatherForcastButton) L.activateButtonInCustomControlBar("weatherForcast");
C.weatherForcastOn = true
}
}
function h() {
if (C.weatherForcastOn) {
if (C.mapObject.hasLayer(C.weatherForcastMarkerGroups)) C.mapObject.removeLayer(C.weatherForcastMarkerGroups);
if (C.displayWeatherForcastButton) L.desactivateButtonInCustomControlBar("weatherForcast")
}
C.weatherForcastOn = false
}
function v() {
C.areasOn = true;
C.mapObject.closePopup();
p();
c();
C.mapObject.addLayer(C.areaMarkerLayer);
if (C.displayAreasButton) L.activateButtonInCustomControlBar("areas")
}
function g() {
C.areasOn = false;
if (C.mapObject.hasLayer(C.areaMarkerLayer)) C.mapObject.removeLayer(C.areaMarkerLayer);
if (C.displayAreasButton) L.desactivateButtonInCustomControlBar("areas")
}
function T() {
if (!C.tripTimesOn) {
C.mapObject.addLayer(C.tripTimeMarkerGroup);
C.tripTimesOn = true
}
}
function b() {
if (C.mapObject.hasLayer(C.tripTimeMarkerGroup)) {
C.mapObject.removeLayer(C.tripTimeMarkerGroup)
}
C.tripTimesOn = false
}
function e() {
Pe()
}
function y() {
C.mapObject.locate({
setView: true,
maxZoom: 12
})
}
function S() {
if (C.fullScreenToggle) {
document.location.href = C.fullScreenToggle
}
}
function F() {
if (!L.buttonInCustomControlBarIsActivated("information")) {
t()
} else {
a()
}
}
function k() {
if (!L.buttonInCustomControlBarIsActivated("disruptions")) {
i()
} else {
r()
}
}
function w() {
if (!L.buttonInCustomControlBarIsActivated("exits")) {
s()
} else {
c()
}
}
function D() {
if (!L.buttonInCustomControlBarIsActivated("webcams")) {
l()
} else {
p()
}
}
function M() {
if (!L.buttonInCustomControlBarIsActivated("areas")) {
v()
} else {
g()
}
}
function A() {
if (!L.buttonInCustomControlBarIsActivated("forecasts")) {
u()
} else {
n()
}
}
function _() {
y()
}
function O() {
S()
}
function B() {
e()
}
function W() {
qe()
}
function I() {
Ue()
}
function N(e) {
var t = Y();
if (t) {
var a = J(e, t);
if (a) {
a.openPopup()
}
}
}
function j(e) {
var t = Y();
if (t) {
if (V(e, t)) {
C.mapObject.getContainer().style.cursor = "pointer"
} else {
C.mapObject.getContainer().style.cursor = ""
}
}
}
function E(e) {
delete C.openedPopupPoi
}
function x(e) {
C.mapObject.closePopup();
if (C.mapObject.hasLayer(C.webcamMarkerGroups[e.target.getZoom()])) {
C.mapObject.removeLayer(C.webcamMarkerGroups[e.target.getZoom()])
}
}
function P(e) {
we();
De();
Me();
ce();
if (C.displayTrafficAlerts) {
Be()
}
if (C.displayTrafficForecast) {
WT3_LoadTrafficForecastSections()
}
}
function Z(e) {
var t = C.markerIconSizes["incident"][0];
re();
var a = t != C.markerIconSizes["incident"][0];
if (a) {
Se();
Fe();
ke();
He();
me();
WT3_ClearAndReloadTrafficForecastMarkers();
resizeTrafficForecastChartBars();
if (C.mapObject.hasLayer(C.userLocationMarker)) {
var i = C.userLocationMarker.getLatLng();
C.mapObject.removeLayer(C.userLocationMarker);
C.userLocationMarker = L.marker(i, {
icon: userLocationIcon(C.markerIconSizes["userLocation"])
});
C.userLocationMarker.addTo(C.mapObject)
}
}
if (C.trafficLayer == "forecast") {
Xe()
}
}
function H(e) {
if (C.userLocationMarker) {
C.mapObject.removeLayer(C.userLocationMarker);
C.userLocationMarker = null
}
C.userLocationMarker = L.marker(e.latlng, {
icon: userLocationIcon(C.markerIconSizes["userLocation"])
});
C.userLocationMarker.addTo(C.mapObject)
}
function R(e) {
alert(getLabelForLocale("geolocationError", C.language));
if (C.userLocationMarker) {
C.mapObject.removeLayer(C.userLocationMarker);
C.userLocationMarker = null
}
if (C.displayUserLocationButton) L.desactivateButtonInCustomControlBar("userLocation")
}
function G(e) {
var t = X(e.tile.src);
if (t) {
if (!C.areas[t] && !C.exits[t]) {
oe(t)
}
}
}
function z(e) {
var t = X(e.tile.src);
if (t) {
if (C.areas[t]) {
delete C.areas[t]
}
if (C.exits[t]) {
delete C.exits[t];
delete C.exits[t]
}
}
}
var U = function(e) {
this.name = e[3];
this.type = e[2];
this.latlng = L.latLng(e[0]);
this.offset = e[1];
this.properties = e[4]
};
U.prototype.openPopup = function() {
var e = this.properties.roadname ? this.properties.roadname : "";
switch (this.type) {
case "EC":
var t = this.properties.numero ? " " + getLabelForLocale("abbreviatedNumber", C.language) + this.properties.numero : "";
C.mapObject.openPopup("
" + e + " - " + getLabelForLocale("exit", C.language) + " " + t + "
" + this.name + "", this.latlng);
break;
case "BI":
C.mapObject.openPopup("
" + getLabelForLocale("junction", C.language) + "
" + this.name + "", this.latlng);
break;
case "AR":
C.mapObject.openPopup("
" + e + " - " + getLabelForLocale("restArea", C.language) + "
" + this.name + "", this.getDisplayCoords());
break;
case "AS":
C.mapObject.openPopup("
" + e + " - " + getLabelForLocale("serviceArea", C.language) + "
" + this.name + "", this.getDisplayCoords());
break;
case "BA":
C.mapObject.openPopup("
" + e + " - " + getLabelForLocale("toll", C.language) + "
" + this.name + "", this.latlng);
break;
default:
C.mapObject.openPopup("
" + e + " " + this.name + "", this.latlng);
break
}
C.openedPopupPoi = this
};
U.prototype.getDisplayCoords = function(e, t) {
if (this.offset && this.latlng && C.poiOffsetScaleFactor) {
var a = C.mapObject.project(this.latlng);
a.x += this.offset[1] * C.poiOffsetScaleFactor;
a.y += this.offset[0] * C.poiOffsetScaleFactor;
return C.mapObject.unproject(a)
}
return
};
var J = function(e, t) {
var a = $(e.containerPoint);
var i = q(e.latlng, t);
var r = false;
var o = [];
if (C.mapObject.hasLayer(C.exitMarkerLayer) && C.exits[i] && C.exits[i].length > 0) {
for (var n = 0; n < C.exits[i].length; ++n) {
if (a.contains(C.exits[i][n].getDisplayCoords())) {
o.push(C.exits[i][n])
}
}
}
if (C.mapObject.hasLayer(C.areaMarkerLayer) && C.areas[i] && C.areas[i].length > 0) {
for (var n = 0; n < C.areas[i].length; ++n) {
if (a.contains(C.areas[i][n].getDisplayCoords())) {
o.push(C.areas[i][n])
}
}
}
if (o.length > 0) {
var s = Number.POSITIVE_INFINITY;
for (var c = 0; c < o.length; ++c) {
var l = o[c].getDisplayCoords().distanceTo(e.latlng);
if (l < s) {
r = o[c];
s = l
}
}
}
return r
};
var V = function(e, t) {
var a = $(e.containerPoint);
var i = q(e.latlng, t);
if (C.areasOn && C.areas[i] && C.areas[i].length > 0) {
for (var r = 0; r < C.areas[i].length; ++r) {
if (C.areas[i][r] && a.contains(C.areas[i][r].getDisplayCoords())) {
return true
}
}
}
if (C.exitsOn && C.exits[i] && C.exits[i].length > 0) {
for (var r = 0; r < C.exits[i].length; ++r) {
if (C.exits[i][r] && a.contains(C.exits[i][r].getDisplayCoords())) {
return true
}
}
}
return false
};
var $ = function(e) {
var t = C.mapObject.containerPointToLatLng([e.x - C.mapObject.options.poiLookupAreaFactor, e.y - C.mapObject.options.poiLookupAreaFactor]);
var a = C.mapObject.containerPointToLatLng([e.x + 2 * C.mapObject.options.poiLookupAreaFactor, e.y + C.mapObject.options.poiLookupAreaFactor]);
return L.latLngBounds(t, a)
};
var Y = function() {
if (C.areasOn) {
return C.areaMarkerLayer
}
if (C.exitsOn) {
return C.exitMarkerLayer
}
return
};
function q(e, t) {
var a = C.mapObject.getZoom();
if (L.Browser.retina && C.mapObject.hasLayer(t) && t.options.detectRetina) {
++a
}
var i = C.mapObject.project(e).divideBy(t.options.tileSize).floor();
return "" + a + "/" + i.x + "/" + i.y
}
function X(e) {
if (typeof e == "string" && e.search(".") > -1) {
var t = [];
var a = e.length - 1;
while (t.length < 3 && a >= 0) {
if (e.charAt(a) == "/") {
t.push(a)
}--a
}
if (t.length == 3) {
return e.substring(t[2] + 1, e.lastIndexOf("."))
}
}
return false
}
function K(e) {
return this.latlng.distanceTo(e.latlng)
}
var Q = function(e) {
this.type = ee(e[1]);
this.nature = te(e[1]);
this.horodate = e[2];
this.messages = e[3];
this.coords = e[0]
};
Q.prototype.getMessage = function(e) {
if (this.messages[e]) {
return this.messages[e]
} else {
return this.messages["FR"] ? this.messages["FR"] : ""
}
};
Q.prototype.getDisplayCoords = function() {
var e = this.coords[C.mapObject.getZoom()];
if (e && e[0] && e[1]) {
var t = C.mapObject.project(L.latLng(e[0]));
t.x += e[1][0] * (C.markerIconSizes[this.nature][0] / 2);
t.y -= e[1][1] * (C.markerIconSizes[this.nature][1] / 2);
return C.mapObject.unproject(t)
}
return
};
function ee(e) {
switch (e) {
case "TR":
case "IF":
return "information";
case "IN":
case "BO":
case "AC":
case "CO":
return "disruption";
case "AA":
case "AP":
return "waitingTime";
default:
return ""
}
}
function te(e) {
switch (e) {
case "TR":
return "roadworks";
case "IF":
return "information";
case "IN":
return "incident";
case "BO":
return "trafficJam";
case "AC":
return "accident";
case "CO":
return "closure";
case "AA":
return "retentionArea";
case "AP":
return "tollWaitingTime";
default:
return ""
}
}
var ae = function(e) {
this.type = ee(e[1]);
this.nature = te(e[1]);
this.label = e[2];
this.state = e[4];
this.duration = e[3];
this.coords = e[0]
};
ae.prototype.getDisplayCoords = function() {
var e = this.coords[C.mapObject.getZoom()];
if (e && e[0] && e[1]) {
var t = C.mapObject.project(L.latLng(e[0]));
t.x += e[1][0] * (C.markerIconSizes[this.nature][0] / 2);
t.y -= e[1][1] * (C.markerIconSizes[this.nature][1] / 2);
return C.mapObject.unproject(t)
}
return
};
var ie = function(e) {
this.latLngBounds = L.latLngBounds(e[0]);
this.horodate = e[1];
this.title = htmlDecode(e[2]);
this.message = htmlDecode(e[3]);
this.language = e[4].toUpperCase()
};
function re() {
var e = L.marker([0, 0]).addTo(C.mapObject);
var t = L.divIcon({
iconSize: null
});
t.options.className = "information-icon-class";
e.setIcon(t);
C.markerIconSizes["information"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "roadworks-icon-class";
e.setIcon(t);
C.markerIconSizes["roadworks"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "incident-icon-class";
e.setIcon(t);
C.markerIconSizes["incident"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "accident-icon-class";
e.setIcon(t);
C.markerIconSizes["accident"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "closure-icon-class";
e.setIcon(t);
C.markerIconSizes["closure"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "trafficjam-icon-class";
e.setIcon(t);
C.markerIconSizes["trafficJam"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "webcam-icon-class";
e.setIcon(t);
C.markerIconSizes["webcam"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "triptime-icon-class";
e.setIcon(t);
C.markerIconSizes["tripTime"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "retentionarea-icon-class";
e.setIcon(t);
C.markerIconSizes["retentionArea"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "tollwaitingtime-icon-class";
e.setIcon(t);
C.markerIconSizes["tollWaitingTime"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "userlocation-icon-class";
e.setIcon(t);
C.markerIconSizes["userLocation"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "forecast-icon-class";
e.setIcon(t);
C.markerIconSizes["forecast"] = [e._icon.clientWidth, e._icon.clientHeight];
t.options.className = "weatherForcast-icon-class";
e.setIcon(t);
C.markerIconSizes["weatherForcast"] = [e._icon.clientWidth, e._icon.clientHeight];
C.mapObject.removeLayer(e)
}
function oe(e) {
if (typeof SAWT3_MarkerDescriptorsLocation != "undefined") {
var t = document.getElementsByTagName("head")[0];
var a = document.getElementById("WT3_" + e + "TileScript");
if (a) {
t.removeChild(a)
}
var i = SAWT3_MarkerDescriptorsLocation + e + ".js";
var r = document.createElement("script");
r.src = i;
r.charset = "UTF-8";
r.type = "text/javascript";
r.id = "WT3_" + e + "TileScript";
t.appendChild(r)
}
}
this.parseMarkerDescriptors = function(e, t) {
if (e && t) {
var a = [];
var i = [];
for (var r = 0; r < e.length; ++r) {
var o = new U(e[r]);
if (o) {
if (o.type == "AS" || o.type == "AR") {
a.push(o)
}
if (o.type == "EC" || o.type == "BI" || o.type == "BA" || o.type == "LI" || o.type == "PO") {
i.push(o)
}
}
}
C.areas[t] = a;
C.exits[t] = i
}
e = 0
};
function ne() {
if (typeof SAWT3_ExitMarkerTilesLocation != "undefined") {
exitMarkerLayer = L.tileLayer(SAWT3_ExitMarkerTilesLocation + "{z}/{x}/{y}.png", {
maxZoom: C.mapObject.getMaxZoom(),
minZoom: C.mapObject.getMinZoom(),
detectRetina: false,
updateWhenZooming: true
});
exitMarkerLayer.setZIndex(40);
exitMarkerLayer.on("tileload", G);
exitMarkerLayer.on("tileunload", z);
exitMarkerGroup.addLayer(exitMarkerLayer)
}
}
function se() {
if (typeof SAWT3_AreaMarkerTilesLocation != "undefined") {
areaMarkerLayer = L.tileLayer(SAWT3_AreaMarkerTilesLocation + "{z}/{x}/{y}.png", {
maxZoom: C.mapObject.getMaxZoom(),
minZoom: C.mapObject.getMinZoom(),
detectRetina: false,
updateWhenZooming: true
});
areaMarkerLayer.setZIndex(10);
areaMarkerLayer.on("tileload", G);
areaMarkerLayer.on("tileunload", z);
areaMarkerGroup.addLayer(areaMarkerLayer)
}
}
function ce() {
if (C && typeof SAWT3_WebcamDescriptorsLocation != "undefined") {
if (!C.webcamsLoading && !C.webcamsLoaded) {
C.webcamsLoading = true;
var e = document.getElementsByTagName("head")[0];
var t = document.getElementById("WT3_WebcamScript");
if (t) {
e.removeChild(t)
}
var a = document.createElement("script");
a.src = SAWT3_WebcamDescriptorsLocation + "webcams.js";
a.charset = "UTF-8";
a.type = "text/javascript";
a.id = "WT3_WebcamScript";
a.async = true;
e.appendChild(a)
} else if (!C.webcamMarkerGroups[C.mapObject.getZoom()] || C.webcamMarkerGroups[C.mapObject.getZoom()].length == 0) {
at.parseWebcams(C.webcamData)
} else if (C.webcamsOn) {
C.mapObject.addLayer(C.webcamMarkerGroups[C.mapObject.getZoom()])
}
}
}
this.parseWebcams = function(e) {
C.webcamsLoading = false;
C.webcamData = e;
if (e) {
var t = C.mapObject.getZoom();
for (var a = 0; a < e.length; ++a) {
var i = new U(e[a]);
if (i) {
var r = "";
if (!C.webcams[t]) C.webcams[t] = [];
if (!C.webcamMarkerGroups[t]) C.webcamMarkerGroups[t] = new L.FeatureGroup;
if (Object.keys(C.webcams[t]).length > 0) {
for (var o = 0; o < Object.keys(C.webcams[t]).length; ++o) {
var n = Object.keys(C.webcams[t])[o].split(",");
var s = L.latLng(n[1], n[2]);
var c = C.mapObject.project(s).x - C.mapObject.project(i.latlng).x;
var l = C.mapObject.project(s).y - C.mapObject.project(i.latlng).y;
if (Math.abs(c) < 2 * C.markerIconSizes["webcam"][0] / 3 && Math.abs(l) < 2 * C.markerIconSizes["webcam"][1] / 3 && i.properties.group == n[0]) {
r = Object.keys(C.webcams[t])[o];
break
}
}
}
if (!r) r = i.properties.group + "," + i.latlng.lat + "," + i.latlng.lng;
var f = C.webcams[t][r];
if (!f) {
f = L.marker(i.latlng, {
clusterKey: r,
zoomLevel: t,
webcams: [],
group: i.properties.group
});
C.webcamMarkerGroups[t].addLayer(f);
C.webcams[t][r] = f;
f.on("click", function() {
var e = this.options.group;
var t = document.createElement("span");
t.className = "webcam-count";
t.innerHTML = " (" + this.options.webcams.length + " webcam";
if (this.options.webcams.length > 1) {
t.innerHTML += "s"
}
t.innerHTML += ")";
var a = L.popin({
title: e,
className: "webcam"
}).addTo(C.mapObject);
a._titleSpan.appendChild(t);
var i = document.createElement("ul");
i.className = "webcam";
for (var r = 0; r < this.options.webcams.length; ++r) {
var o = document.createElement("li");
o.className = "webcam";
var n = document.createElement("div");
n.className = "webcam-thumbnail";
o.appendChild(n);
var s = document.createElement("p");
s.className = "webcam-description";
s.innerHTML = this.options.webcams[r].name;
o.appendChild(s);
if (this.options.webcams[r].properties.thumbnail && this.options.webcams[r].properties.thumbnail != "") {
var c = document.createElement("img");
c.src = this.options.webcams[r].properties.thumbnail;
c.alt = "";
c.className = "webcam-thumbnail";
n.appendChild(c);
playWebcamOverlayP = document.createElement("p");
playWebcamOverlayP.className = "webcam-overlay";
n.appendChild(playWebcamOverlayP);
o.id = this.options.webcams[r].properties.id;
o.onclick = function() {
le(this.id, a)
}
} else {
n.classList.add("disabled");
s.classList.add("disabled")
}
i.appendChild(o)
}
a.addContent(i)
}, false)
}
f.options.webcams.push(i)
}
}
C.webcamMarkerGroups[t].eachLayer(function(e) {
e.setIcon(webcamIcon(C.markerIconSizes["webcam"], e.options.webcams.length))
});
if (C.webcamsOn) C.mapObject.addLayer(C.webcamMarkerGroups[t]);
C.webcamsLoaded = true
}
};
var le = function(e, t) {
var a;
for (var i = 0; i < C.webcamData.length; ++i) {
if (C.webcamData[i][4].id == e) {
a = new U(C.webcamData[i]);
break
}
}
if (a) {
var r = document.getElementById("webcamPlayer");
if (!r) {
gtag("event", "webcam-view", {
menu_item_name: a.properties.group,
menu_item_url: window.location.href
});
var o = L.popin({
title: a.properties.group,
className: "webcam",
parentPopin: t,
backToDisplayText: getLabelForLocale("backToWebcamList", C.language)
});
o.addTo(C.mapObject);
r = document.createElement("div");
r.className = "webcam-player";
o.addContent(r);
var n = document.createElement("h2");
n.innerHTML = a.name;
r.appendChild(n);
if (Date.now() - a.properties.lastUpdate * 1e3 < 30 * 60 * 1e3) {
var s = document.createElement("video");
s.src = a.properties.url;
s.onerror = function() {
fe(r)
};
s.onclick = function(e) {};
s.controls = true;
s.play();
s.loop = true;
if (a.properties.displayTime == 1) {
var c = document.createElement("div");
c.className = "webcam-time";
c.innerHTML = formatDateTime(new Date(a.properties.lastUpdate * 1e3), C.language);
r.appendChild(c)
}
r.appendChild(s);
var l = s.clientHeight;
var f = setInterval(function() {
if (s.clientHeight != l) {
l = s.clientHeight;
s.currentTime -= .1
}
}, 100);
o.timer = f
} else {
fe(r)
}
}
} else {
throw new Error("Unkown webcam id")
}
};
var fe = function(e) {
var t = document.createElement("div");
t.id = "webcamError";
t.className = "webcam-error";
t.innerHTML = getLabelForLocale("webcamError", C.language);
e.appendChild(t)
};
function me() {
C.clearWebcams();
ce()
}
function ue() {
var e = false;
if (typeof C.weatherForcastCurrentSlot == "undefined" || C.weatherForcastCurrentSlot == null) pe();
if (C && (typeof SAWT3_WeatherForcastDescriptorsLocation != "undefined" || e)) {
if (!C.weatherForcastLoading && !C.weatherForcastLoaded) {
C.weatherForcastLoading = true;
var t = document.getElementsByTagName("head")[0];
var a = document.getElementById("WT3_WeatherForcastScript");
if (a) {
t.removeChild(a)
}
var i = document.createElement("script");
if (e) {
i.src = "/weatherForecast-bug-198.js"
} else {
i.src = SAWT3_WeatherForcastDescriptorsLocation + "/weatherForecast.js"
}
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_WeatherForcastScript";
i.async = true;
t.appendChild(i)
} else if (!C.weatherForcastMarkerGroups || C.weatherForcastMarkerGroups.getLayers().length == 0) {
at.parseWeatherForecasts(C.weatherForcastData)
} else if (C.weatherForcastOn) {
C.mapObject.addLayer(C.weatherForcastMarkerGroups)
}
}
}
var pe = function() {
var e = false;
if (typeof C != "undefined" && typeof C._weatherForcastRefreshCurrentSlotsInterval != "undefined") e = true;
clearInterval(C._weatherForcastRefreshCurrentSlotsInterval);
var t = new Date;
C.weatherForcastCurrentSlot = null;
var a = new Date;
a.setHours(0);
a.setMinutes(0);
a.setSeconds(0);
a.setMilliseconds(0);
for (var i = 0; i < 48; i += 6) {
var r = new Date;
r.setTime(a.getTime() + i * 60 * 60 * 1e3);
if (r > t && C.weatherForcastCurrentSlot == null) {
C.weatherForcastCurrentSlot = r;
if (C.weatherForcastCurrentSlot >= C.weatherForcastNextSlot) {
C.weatherForcastCurrentSlot = C.weatherForcastNextSlot;
var o = new Date;
o.setTime(C.weatherForcastNextSlot.getTime() + 6 * 60 * 60 * 1e3);
C.weatherForcastNextSlot = o;
be()
}
var o = new Date;
o.setTime(r.getTime() + 6 * 60 * 60 * 1e3);
C.weatherForcastNextSlot = o;
break
}
}
if (e) C._weatherForcastRefreshCurrentSlotsInterval = setInterval(pe, 1e3)
};
this.parseWeatherForecasts = function(e) {
var t = null;
C._weatherForcastRefreshCurrentSlotsInterval = setInterval(pe, 1e3);
C.weatherForcastLoading = false;
C.weatherForcastData = e;
if (e) {
de(C.weatherForcastData);
var a = new Date(C.weatherForcastCurrentSlot);
var i = C.language.toLowerCase() + "-" + C.language.toUpperCase();
C.menuBar.setSubTitle(getLabelForLocale("weatherForecastFor", C.language) + a.toLocaleDateString(i) + " " + a.toLocaleTimeString(i).replace(":00:00", getLabelForLocale("weatherForecastHourSuffix", C.language)));
if (C.weatherForcastOn) C.mapObject.addLayer(C.weatherForcastMarkerGroups);
C.weatherForcastLoaded = true;
C.mapObject.on("move", ve);
C.mapObject.on("zoomend", function() {
C.weatherForcastMarkerGroups.clearLayers();
de(C.weatherForcastData)
});
ve()
}
};
var de = function(e, t) {
var a = C.mapObject.getZoom();
for (var i = 0; i < e.length; ++i) {
var r = new U(e[i]);
if (a <= r.properties.zoomMax && a >= r.properties.zoomMin) {
if (r) {
if (typeof C.weatherForcast == "undefined") C.weatherForcast = [];
if (typeof C.weatherForcastMarkerGroups == "undefined") C.weatherForcastMarkerGroups = new L.FeatureGroup;
C.weatherForcast = L.marker(r.latlng, {
weatherForcast: r
});
C.weatherForcast.on("click", function() {
var e = this.options.group + " " + (new Date).toLocaleDateString();
var t = this.options.weatherForcast;
var a = _translations[C.language].dates.weekdays[(new Date).getDay()] + " " + (new Date).getDate() + " " + _translations[C.language].dates.months[(new Date).getMonth()];
var i = L.popin({
title: e,
className: "weather"
}).addTo(C.mapObject);
i.setTitle(t.name + '
' + a + "");
var r = document.createElement("div");
r.className = "row";
var o = Te(t.properties.slots);
r.innerHTML = o;
i.addContent(r)
});
C.weatherForcastMarkerGroups.addLayer(C.weatherForcast)
}
}
}
C.weatherForcastMarkerGroups.eachLayer(function(e) {
var t = e.options.weatherForcast.properties.slots;
var a = t[C.weatherForcastCurrentSlot.toSlotFormat()];
var i = a.sky;
if (a.sky < 10) {
i = "0" + i
}
e.setIcon(weatherForcastIcon(C.markerIconSizes["weatherForcast"], i, a.tempMin, a.tempMax, a.wind))
})
};
var he = function() {
var t = C.mapObject.getZoom();
C.weatherForcastMarkerGroups.eachLayer(function(e) {
if (t <= e.options.weatherForcast.properties.zoomMax && t >= e.options.weatherForcast.properties.zoomMin) {
e.setOpacity(1)
} else {
e.remove()
}
})
};
var ve = function() {
var e = C.mapObject.getZoom();
var s = ge(C.weatherForcastMarkerGroups, e);
if (s.visible == false) {
if (s.marker != C.weatherForcast.closest_marker) {
var t = Te(s.marker.options.weatherForcast.properties.slots);
t = '
' + _translations[C.language].nearestWheaterForecastMarker + '
' + s.marker.options.weatherForcast.name + "
" + t + "
";
var a = {
autoPlacement: true,
marginArrow: {
top: 10,
bottom: 10,
left: 10,
right: 10
},
height: 150,
width: 208,
base: 20,
strenth: 130,
background: "#FFF",
borderThick: 0,
borderColor: "#2d64b6",
borderRadius: 0
};
var i = s.marker.bindSpeechBubble(t, a);
i._speechbubble.addClass("weather");
i._speechbubble.addTo(C.mapObject);
i._speechbubble._div.onclick = function(e) {
{
var t = s.marker.options.name + " " + (new Date).toLocaleDateString();
var a = s.marker.options.weatherForcast;
var i = _translations[C.language].dates.weekdays[(new Date).getDay()] + " " + (new Date).getDate() + " " + _translations[C.language].dates.months[(new Date).getMonth()];
var r = L.popin({
title: t,
className: "weather"
}).addTo(C.mapObject);
r.setTitle(a.name + '
' + i + "");
var o = document.createElement("div");
o.className = "row";
var n = Te(a.properties.slots);
o.innerHTML = n;
r.addContent(o)
}
}
}
C.weatherForcast.closest_marker = s.marker
} else {
if (C.weatherForcast.closest_marker) C.mapObject.closeSpeechBubble();
C.weatherForcast.closest_marker = null
}
};
var ge = function(e, i) {
if (typeof i == "undefined") i = null;
var r = C.mapObject.getBounds();
var o = C.mapObject.getCenter();
var n = false;
var s = null;
var c = null;
var l = null;
e.eachLayer(function(e, t) {
var a;
if (s == null) {
s = e._latlng.distanceTo(o);
c = e;
l = t
}
a = i == null || i <= e.options.weatherForcast.properties.zoomMax && i >= e.options.weatherForcast.properties.zoomMin;
if (a) {
n |= r.contains(e._latlng)
}
if (n == true) return;
if (e._latlng.distanceTo(o) < s) {
if (a) {
s = e._latlng.distanceTo(o);
c = e;
l = t
}
}
});
return {
visible: n,
marker: c
}
};
var Te = function(e) {
var t = "
";
var a = null;
var i = 0;
var r = C.language.toLowerCase() + "-" + C.language.toUpperCase();
for (slotName in e) {
var o = e[slotName];
var n = new Date(slotName.replace(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)$/, "$4:$5:00 $2/$3/$1"));
n = new Date;
n.setTime(Date.parse(slotName + lastUpdateTimeOffset));
a = n.toLocaleDateString();
var s = (new Date).toSlotFormat();
var c = "future";
if (n >= C.weatherForcastCurrentSlot) {
if (n < C.weatherForcastNextSlot) {
i++;
c = "current slot--" + i
} else {
i++;
c = "future slot--" + i
}
} else {
c = "hidden"
}
var l = "0" + o.sky;
l = l.substr(l.length - 2);
t += '';
t += '' + n.getDate() + " " + _translations[C.language].dates.months[n.getMonth()] + '' + n.toLocaleTimeString(r).replace(":00:00", getLabelForLocale("weatherForecastHourSuffix", C.language)) + " | ";
t += ' | ';
if (typeof o.tempMin == "undefined" && typeof o.tempMax == "undefined") {
t += ' | '
} else if (o.tempMin != o.tempMax) {
t += ' min: ' + o.tempMin + "C | ";
t += ' max: ' + o.tempMax + "C | "
} else {
t += ' ' + o.tempMax + "C | "
}
t += "
"
}
t += "
";
return t;
var t = "";
t += "
";
var a = null;
for (slotName in e) {
var o = e[slotName];
var n = new Date(slotName.replace(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)$/, "$4:$5:00 $2/$3/$1"));
if (a != n.toLocaleDateString()) {
if (a != null) {
t += "
"
}
t += '
' + n.toLocaleDateString() + '";
return t
};
var Le = function(e) {
var t = document.createElement("div");
t.id = "weatherForcastError";
t.className = "weatherForcast-error";
t.innerHTML = getLabelForLocale("weatherForcastError", C.language);
e.appendChild(t)
};
function be() {
C.clearWeatherForcasts();
ue()
}
function ye() {
if (SAWT3_RealTimeTrafficEventsLocation != "undefined") {
var e = document.getElementsByTagName("head")[0];
var t = document.getElementById("WT3_GetEventsScript");
if (t) {
e.removeChild(t)
}
var a = document.createElement("script");
a.src = SAWT3_RealTimeTrafficEventsLocation + "/events.js";
a.id = "WT3_GetEventsScript";
a.charset = "UTF-8";
a.type = "text/javascript";
a.async = true;
e.appendChild(a)
}
}
this.parseEvents = function(e) {
if (C) {
if (e) {
for (var t = 0; t < e.length; ++t) {
if (e[t] && e[t][1]) {
if (ee(e[t][1]) == "information") C.information.push(new Q(e[t]));
if (ee(e[t][1]) == "disruption") C.disruptions.push(new Q(e[t]));
if (ee(e[t][1]) == "waitingTime") {
C.waitingTimes.push(new ae(e[t]))
}
}
}
Se();
Fe();
ke()
}
e = 0
}
};
function Se() {
for (var e = 0; e < C.maxZoom - C.minZoom; ++e) {
while (C.informationMarkers[e].length > 0) {
C.informationMarkers[e].pop()
}
}
we()
}
function Fe() {
for (var e = 0; e < C.maxZoom - C.minZoom; ++e) {
C.disruptionMarkers[e].length = 0
}
De()
}
function ke() {
for (var e = 0; e < C.maxZoom - C.minZoom; ++e) {
C.waitingTimeMarkers[e].length = 0
}
Me()
}
function we() {
if (C) {
var e = C.mapObject.getZoom();
var t = C.mapObject.hasLayer(C.informationMarkerGroup);
if (t) {
C.mapObject.removeLayer(C.informationMarkerGroup)
}
if(C.informationMarkers[e - C.minZoom])
{
if (C.informationMarkers[e - C.minZoom].length == 0) {
if (C.informationMarkerGroup) {
C.informationMarkerGroup.clearLayers()
}
C.informationMarkers[e - C.minZoom] = Ae(C.information)
}
}
C.informationMarkerGroup = L.layerGroup(C.informationMarkers[e - 6]);
if (t) {
C.mapObject.addLayer(C.informationMarkerGroup)
}
}
}
function De() {
if (C) {
var e = C.mapObject.getZoom();
var t = C.mapObject.hasLayer(C.disruptionsMarkerGroup);
if (t) {
C.mapObject.removeLayer(C.disruptionsMarkerGroup)
}
if(C.disruptionMarkers[e - C.minZoom])
{
if (C.disruptionMarkers[e - C.minZoom].length == 0) {
if (C.disruptionsMarkerGroup) {
C.disruptionsMarkerGroup.clearLayers()
}
C.disruptionMarkers[e - C.minZoom] = Ce(C.disruptions)
}
}
C.disruptionsMarkerGroup = L.layerGroup(C.disruptionMarkers[e - 6]);
if (t) {
C.mapObject.addLayer(C.disruptionsMarkerGroup)
}
}
}
function Me() {
if (C) {
var e = C.mapObject.getZoom();
var t = C.mapObject.hasLayer(C.waitingTimeMarkerGroup);
if (t) {
C.mapObject.removeLayer(C.waitingTimeMarkerGroup)
}
if(C.waitingTimeMarkers[e - C.minZoom])
{
if (C.waitingTimeMarkers[e - C.minZoom].length == 0) {
if (C.waitingTimeMarkerGroup) {
C.waitingTimeMarkerGroup.clearLayers()
}
C.waitingTimeMarkers[e - C.minZoom] = _e(C.waitingTimes)
}
}
C.waitingTimeMarkerGroup = L.layerGroup(C.waitingTimeMarkers[e - C.minZoom]);
if (t) {
C.mapObject.addLayer(C.waitingTimeMarkerGroup)
}
}
}
function Ae(e) {
var t = new Array(e.length);
var a = 0;
var i;
for (var r = 0; r < e.length; r++) {
var o = e[r].getMessage(C.language).trim();
if (o != "") {
i = e[r].getDisplayCoords();
if (i) {
switch (e[r].nature) {
case "information":
t[a] = L.marker(i, {
icon: informationIcon(C.markerIconSizes["information"])
});
t[a].bindPopup(L.popup().setContent("" + o + "
"));
a++;
break;
case "roadworks":
t[a] = L.marker(i, {
icon: roadworksIcon(C.markerIconSizes["roadworks"])
});
t[a].bindPopup(L.popup().setContent("" + o + "
"));
a++;
break;
default:
break
}
}
}
}
t.length = a;
return t
}
function Ce(e) {
var t = new Array(e.length);
var a = 0;
var i;
for (var r = 0; r < e.length; r++) {
var o = e[r].getMessage(C.language).trim();
if (o != "") {
i = e[r].getDisplayCoords();
if (i) {
switch (e[r].nature) {
case "incident":
t[a] = L.marker(i, {
icon: incidentIcon(C.markerIconSizes["incident"])
});
t[a].bindPopup("" + o + "
");
t[a].setZIndexOffset(3e3);
a++;
break;
case "accident":
t[a] = L.marker(i, {
icon: accidentIcon(C.markerIconSizes["accident"])
});
t[a].bindPopup("" + o + "
");
t[a].setZIndexOffset(3e3);
a++;
break;
case "trafficJam":
t[a] = L.marker(i, {
icon: trafficjamIcon(C.markerIconSizes["trafficJam"])
});
t[a].bindPopup("" + o + "
");
t[a].setZIndexOffset(3e3);
a++;
break;
case "closure":
t[a] = L.marker(i, {
icon: closureIcon(C.markerIconSizes["closure"])
});
t[a].bindPopup("" + o + "
");
t[a].setZIndexOffset(3e3);
a++;
break;
default:
break
}
}
}
}
t.length = a;
return t
}
function _e(e) {
var t = new Array(e.length);
var a = 0;
var i;
for (var r = 0; r < e.length; r++) {
i = e[r].getDisplayCoords();
if (i) {
switch (e[r].nature) {
case "retentionArea":
t[a] = L.marker(i, {
icon: retentionAreaIcon(C.markerIconSizes["retentionArea"])
});
t[a].bindPopup(L.popup().setContent("" + e[r].label + "
" + getLabelForLocale("retentionDelay", C.language) + ": " + e[r].duration + "
"));
a++;
break;
case "tollWaitingTime":
t[a] = L.marker(i, {
icon: tollWaitingTimeIcon(C.markerIconSizes["tollWaitingTime"])
});
t[a].bindPopup(L.popup().setContent("" + e[r].label + "
" + getLabelForLocale("tollWaitingTime", C.language) + ": " + e[r].duration + "
"));
a++;
break;
default:
break
}
}
}
t.length = a;
return t
}
function Oe() {
var e = document.getElementsByTagName("head")[0];
var t = document.getElementById("WT3_GetTrafficAlertScript");
if (t) {
e.removeChild(t)
}
if (C.trafficAlerts && C.trafficAlerts.length == 0) {
link = document.createElement("script");
link.src = SAWT3_RealTimeTrafficAlertsLocation + "/trafficAlert.js";
link.charset = "UTF-8";
link.type = "text/javascript";
link.id = "WT3_GetTrafficAlertScript";
link.async = true;
e.appendChild(link)
}
}
this.parseTrafficAlert = function(e) {
if (e) {
for (var t = 0; t < e.length; ++t) {
if (e[t]) {
C.trafficAlerts.push(new ie(e[t]))
}
}
Be()
}
e = 0
};
function Be() {
var e = document.getElementById("trafficAlertNotification");
var t = document.getElementsByClassName("leaflet-top leaflet-right");
if (!e) {
e = document.createElement("div");
e.id = "trafficAlertNotification";
t[0].appendChild(e);
if (L.Browser.ielt9) {
e.innerText = ""
} else {
e.textContent = ""
}
e.onmouseover = function() {
e.style.cursor = "pointer"
}
}
e.style.visibility = "hidden";
var o = [];
for (var a = 0; a < C.trafficAlerts.length; ++a) {
if (C.trafficAlerts[a].latLngBounds.contains(C.mapObject.getCenter()) && (C.trafficAlerts[a].language.toUpperCase() == "FR" || C.trafficAlerts[a].language.toUpperCase() == C.language)) {
o.push(C.trafficAlerts[a])
}
}
if (o == 0) {
return
} else {
if (o.length > 0 && o.length < 10) {
e.className = "leaflet-control trafficalert-notification-" + o.length
} else {
e.className = "trafficalert-notification-10"
}
}
e.classList.add("leaflet-control");
e.style.visibility = "visible";
e.onclick = function(e) {
var t = L.popin({
title: getLabelForLocale("trafficAlertPopupTitle", C.language),
className: "trafficalert"
}).addTo(C.mapObject);
var a = document.createElement("ul");
a.className = "trafficalert-list";
for (var i = 0; i < o.length; ++i) {
var r = document.createElement("li");
r.className = "trafficalert-list-item";
trafficAlertTitleH1 = document.createElement("h2");
trafficAlertTitleH1.className = "trafficalert-list-item-title";
trafficAlertTitleH1.innerHTML = o[i].title;
r.appendChild(trafficAlertTitleH1);
trafficAlertContentP = document.createElement("p");
trafficAlertContentP.className = "trafficalert-list-item-content";
trafficAlertContentP.innerHTML = o[i].message;
r.appendChild(trafficAlertContentP);
a.appendChild(r)
}
t.addContent(a)
}
}
function We() {
var e = document.getElementsByTagName("head")[0];
var t = document.getElementById("WT3_GetTripTimeScript");
if (t) {
e.removeChild(t)
}
if (C.tripTimes.length !== 0) {
at.prepareTripTimesForDisplay()
}
}
this.parseTripTimes = function(e) {
if (e) {
for (var t = 0; t < e.length; ++t) {
C.tripTimes.push(new U(e[t]))
}
}
e = 0;
Ie()
};
function Ie() {
C.tripTimeClusters = new Array;
C.tripTimes.sort(function(e, t) {
if (e.name < t.name) return -1;
else if (e.name == t.name) return 0;
else return 1
});
for (var e = 0; e < C.tripTimes.length; ++e) {
var t = C.tripTimes[e];
if (!C.tripTimeClusters[t.latlng]) {
var a = L.marker(t.latlng, {
tripTimesCount: 0
});
a.on("click", function() {
je(this._latlng)
});
C.tripTimeClusters[t.latlng] = a
}
C.tripTimeClusters[t.latlng].options.tripTimesCount += t.properties.length
}
Ne()
}
function Ne() {
for (var e = 0; e < Object.keys(C.tripTimeClusters).length; ++e) {
var t = C.tripTimeClusters[Object.keys(C.tripTimeClusters)[e]];
t.options.icon = tripTimeIcon(C.markerIconSizes["tripTime"], t.options.tripTimesCount);
C.tripTimeMarkerGroup.addLayer(t)
}
if (C.tripTimesOn) C.tripTimeMarkerGroup.addTo(C.mapObject)
}
function je(e) {
var t = L.popin({
title: getLabelForLocale("tripTime", C.language),
className: "trip-time"
}).addTo(C.mapObject);
var a = document.createElement("ul");
a.className = "leaflet-popin-content trip-time";
var i = document.createElement("h2");
i.className = "trip-time-list";
a.appendChild(i);
for (var r = 0; r < C.tripTimes.length; r++) {
var o = C.tripTimes[r];
if (o.latlng.lat == e.lat && o.latlng.lat == e.lat) {
if (!i.innerHTML) {
i.innerHTML = getLabelForLocale("startingFrom", C.language) + "« " + o.name + " »"
}
o.properties.sort(function(e, t) {
if (e.destination < t.destination) return -1;
else if (e.destination == t.destination) return 0;
else return 1
});
for (var n = 0; n < o.properties.length; ++n) {
var s = Ee(o.name, o.properties[n]);
a.appendChild(s)
}
}
}
t.addContent(a)
}
function Ee(e, t) {
var a = document.createElement("li");
a.className = "trip-time";
var i = document.createElement("div");
i.className = "trip-time-description";
i.innerHTML = e + ' ' + t.destination;
a.appendChild(i);
var r = document.createElement("div");
r.className = "trip-time-display " + t.status;
r.innerHTML = t.TPE;
if (t.TPL && t.TPE && t.TPE != t.TPL) {
var o = document.createElement("p");
o.className = "trip-time-delay " + t.status;
o.innerHTML = getLabelForLocale("insteadOf", C.language) + " " + t.TPL;
r.appendChild(o)
}
a.appendChild(r);
return a
}
function xe(e, t) {
var a = document.createElement("li");
a.className = "trip-time global-list";
var i = document.createElement("div");
i.className = "trip-time-description global-list";
var r = document.createElement("p");
r.className = "trip-time-description-origin global-list";
r.innerHTML = e;
i.appendChild(r);
var o = document.createElement("p");
o.className = "trip-time-description-destination global-list";
i.appendChild(o);
var n = document.createElement("span");
n.className = "trip-time-description-to";
n.innerHTML = getLabelForLocale("to", C.language) + " ";
o.appendChild(n);
var s = document.createElement("span");
s.className = "trip-time-description-destination";
s.innerHTML = t.destination;
o.appendChild(s);
a.appendChild(i);
var c = document.createElement("div");
c.className = "trip-time-display global-list " + t.status;
var l = document.createElement("p");
l.className = "trip-time-current-time";
l.innerHTML = t.TPE;
c.appendChild(l);
if (t.TPE && t.TPL && t.TPE != t.TPL) {
var f = document.createElement("p");
f.className = "trip-time-normal-time";
f.innerHTML = getLabelForLocale("insteadOf", C.language) + " " + t.TPL;
c.appendChild(f)
}
a.appendChild(c);
a.id = e + "#" + t.destination;
return a
}
function Pe() {
var i = document.createElement("ul");
i.className = "leaflet-popin-content trip-time lobal-list";
var e = L.popin({
title: getLabelForLocale("tripTime", C.language),
className: "trip-time"
}).addTo(C.mapObject);
var t = document.createElement("div");
t.className = "trip-time-list-header global-list";
var a = document.createElement("span");
a.className = "trip-time-list-header global-list";
t.appendChild(a);
var r = document.createElement("h2");
r.innerHTML = getLabelForLocale("pickTripTimeLocation", C.language);
r.className = "trip-time-list";
a.appendChild(r);
var o = document.createElement("p");
o.className = "trip-time-count";
a.appendChild(o);
var n = document.createElement("div");
n.className = "trip-time-list-lookup hidden";
var s = document.createElement("input");
s.type = "text";
s.className = "trip-time-lookup-input";
s.placeholder = getLabelForLocale("tripTimeLookupInputPlaceholder", C.language);
s.onkeyup = function(e) {
if (e.target.value.length > 0) {
for (var t = 0; t < i.childNodes.length; ++t) {
var a = i.childNodes[t];
if (lookupStringClean(a.id).indexOf(lookupStringClean(e.target.value)) == -1) {
if (!a.classList.contains("hidden")) {
a.classList.add("hidden")
}
} else {
if (a.classList.contains("hidden")) {
a.classList.remove("hidden")
}
}
}
Ze(i, lookupStringClean(e.target.value))
} else {
for (var t = 0; t < i.childNodes.length; ++t) {
var a = i.childNodes[t];
if (a.classList.contains("hidden")) {
a.classList.remove("hidden")
}
}
s.placeholder = getLabelForLocale("tripTimeLookupInputPlaceholder", C.language);
Ze(i)
}
};
n.appendChild(s);
t.appendChild(n);
e.addContent(t);
var c = document.createElement("span");
c.className = "trip-time-list-lookup-icon";
c.onclick = function() {
if (n.classList.contains("hidden")) {
c.className = "trip-time-list-lookup-icon-close";
a.classList.add("hidden");
n.classList.remove("hidden")
} else {
c.className = "trip-time-list-lookup-icon";
a.classList.remove("hidden");
n.classList.add("hidden");
s.value = "";
for (var e = 0; e < i.childNodes.length; ++e) {
if (i.childNodes[e].classList.contains("hidden")) {
i.childNodes[e].classList.remove("hidden")
}
}
Ze(i)
}
};
t.appendChild(c);
for (var l = 0; l < C.tripTimes.length; ++l) {
var f = C.tripTimes[l];
for (var m = 0; m < f.properties.length; ++m) {
i.appendChild(xe(f.name, f.properties[m]))
}
}
o.innerHTML = getLabelForLocale("among", C.language) + i.childNodes.length + getLabelForLocale("listedTripTimes", C.language);
return e.addContent(i)
}
function Ze(e, t) {
if (t) {
var a = [];
var i = [];
var r = [];
var o = [];
for (var n = 0; n < e.childNodes.length; ++n) {
var s = e.childNodes[n];
var c = s.id.split("#");
var l = c[0];
var f = c[1];
if (lookupStringClean(l).indexOf(t) == 0) {
a.push(s)
} else if (lookupStringClean(f).indexOf(t) == 0) {
r.push(s)
} else if (lookupStringClean(l).indexOf(t) > 0) {
i.push(s)
} else if (lookupStringClean(f).indexOf(t) > 0) {
o.push(s)
}
}
var m = r.length;
var u = m + a.length;
var p = u + r.length;
for (var d = 0; d < a.length; ++d) {
var s = a[d];
e.insertBefore(s, e.childNodes[d])
}
for (var h = 0; h < r.length; ++h) {
var s = r[h];
e.insertBefore(s, e.childNodes[h + m])
}
for (var v = 0; v < i.length; ++v) {
var s = i[v];
e.insertBefore(s, e.childNodes[v + u])
}
for (var g = 0; g < o.length; ++g) {
var s = o[g];
e.insertBefore(s, e.childNodes[g + p])
}
} else {
var T = [];
for (var n = 0; n < e.childNodes.length; ++n) {
T.push(e.childNodes[n])
}
T.sort(function(e, t) {
if (e.id < t.id) return -1;
else if (e.id == t.id) return 0;
else return 1
});
for (var d = 0; d < T.length; ++d) {
e.insertBefore(T[d], e.childNodes[d])
}
}
}
function He() {
C.tripTimeMarkerGroup.eachLayer(function(e) {
C.tripTimeMarkerGroup.removeLayer(e)
});
C.tripTimeMarkerGroup.length = 0;
Ne()
}
WT3_LoadTrafficForecastTiles = function() {
if (C.trafficForecastLayer && C.mapObject.hasLayer(C.trafficForecastLayer)) {
C.mapObject.removeLayer(C.trafficForecastLayer)
}
if (typeof SAWT3_TrafficForecastTilesLocation != "undefined") {
C.SAWT["SAWT3_TrafficForecastTilesLocation"] = SAWT3_TrafficForecastTilesLocation;
if (C.trafficForecastDateTime) {
var e;
e = L.tileLayer(SAWT3_TrafficForecastTilesLocation + "/" + $e(C.trafficForecastDateTime, true) + "{z}/{x}/{y}.png", C.trafficForecastLayerOptions);
e.setZIndex(20);
e.addTo(C.mapObject);
C.trafficForecastLayer = e
}
}
};
WT3_LoadTrafficForecastSections = function() {
for (var e = 0; e < C.maxZoom - C.minZoom; ++e) {
C.trafficForecastMarkers[e].clearLayers();
if (C.mapObject.hasLayer(C.trafficForecastMarkers[e])) {
C.mapObject.removeLayer(C.trafficForecastMarkers[e])
}
}
var t = document.getElementsByTagName("head")[0];
if (typeof SAWT3_TrafficForecastTilesLocation != "undefined" && !C.trafficForecastSectionsLoaded && !C.trafficForecastSectionsLoading) {
if(window.location.href.indexOf("preprod") !== -1){
var a = SAWT3_TrafficForecastTilesLocation + "/sections.preprod.js";
}
else{
var a = SAWT3_TrafficForecastTilesLocation + "/sections.js";
}
var i = document.createElement("script");
i.src = a;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_TrafficForecastSectionsScript";
t.appendChild(i);
C.trafficForecastSectionsLoading = true
} else if (C.trafficForecastSectionsLoaded && C.trafficForecastDateTime) {
WT3_LoadTrafficForecastSectionStates()
}
if (C.trafficForecastGroups.length == 0) {
var a = SAWT3_TrafficForecastTilesLocation + "/groups.js";
var i = document.createElement("script");
i.src = a;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_TrafficForecastGroupsScript";
t.appendChild(i)
}
if (typeof trafficForecastThumbnails == "undefined") {
var a = SAWT3_TrafficForecastTilesLocation + "/sectionsThumbnails.js";
var i = document.createElement("script");
i.src = a;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_TrafficForecastSectionsThumbnailsScript";
t.appendChild(i)
}
};
WT3_LoadTrafficForecastSectionStates = function() {
var e = $e(C.trafficForecastDateTime, true);
if (e && typeof SAWT3_TrafficForecastTilesLocation != "undefined") {
var t = document.getElementsByTagName("head")[0];
var a = SAWT3_TrafficForecastTilesLocation + "/" + e + "sectionsState.js";
var i = document.getElementById("WT3_ForecastSectionStatesScript");
if (i) t.removeChild(i);
i = document.createElement("script");
i.src = a;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_" + e + "ForecastSectionStatesScript";
i.id = "WT3_ForecastSectionStatesScript";
t.appendChild(i)
}
if (!C.rushHours[e.split("/")[0]]) {
var t = document.getElementsByTagName("head")[0];
var r = SAWT3_TrafficForecastTilesLocation + "/" + e.split("/")[0] + "/rushHour.js";
var i = document.createElement("script");
i.src = r;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_" + e.split("/")[0] + "RushHourScript";
t.appendChild(i)
}
};
WT3_LoadTrafficForecastChartData = function() {
if (typeof SAWT3_TrafficForecastTilesLocation != "undefined" && C.trafficForecastDateTime) {
var e = $e(C.trafficForecastDateTime, false);
if (e) {
var t = document.getElementsByTagName("head")[0];
var a = SAWT3_TrafficForecastTilesLocation + "/" + e + "graphs.js";
var i = document.createElement("script");
i.src = a;
i.charset = "UTF-8";
i.type = "text/javascript";
i.id = "WT3_" + e + "ForecastDataScript";
t.appendChild(i)
}
}
};
WT3_LoadGeoJsonSegmentGeometry = function() {
var e = new XMLHttpRequest;
e.open("GET", SAWT3_SegmentRollOverGeoJsonGeometryLocation + "segmentGeometry.geojson");
e.send(null);
e.addEventListener("readystatechange", function() {
if (e.readyState === XMLHttpRequest.DONE) {
C.geoJsonSegmentGeometry = JSON.parse(e.responseText);
at.AddGeoJsonSegmentsToMap()
}
})
};
this.AddGeoJsonSegmentsToMap = function() {
var e = L.geoJSON(C.geoJsonSegmentGeometry.features, {
style: function() {
return {
color: "#333333",
weight: 8,
opacity: 0,
offset: 4
}
}
});
e.on("mouseover", function(a) {
e.eachLayer(function(e) {
if (e.feature.properties.id == a.layer.feature.properties.id) {
e.setStyle({
opacity: .5
});
var t = e.getPopup();
if (typeof t != "undefined") {
if (!e.isPopupOpen()) {
e.openPopup()
}
}
}
})
});
e.on("mouseout", function(a) {
e.eachLayer(function(e) {
if (e.feature.properties.id == a.layer.feature.properties.id) {
e.setStyle({
opacity: 0
});
var t = e.getPopup();
if (typeof t != "undefined") {
if (e.isPopupOpen()) {
e.closePopup()
}
}
}
})
});
C.mapObject.addLayer(e);
C.segmentRollOverLayers = e
};
WT3_LoadSegmentRollOverPopupData = function() {
if (typeof SAWT3_SegmentRollOverPopupDataLocation != "undefined") {
var e = document.getElementsByTagName("head")[0];
var t = document.getElementById("WT3_SegmentRollOverDataScript");
if (t) {
e.removeChild(t)
}
var a = document.createElement("script");
a.src = SAWT3_SegmentRollOverPopupDataLocation + "segmentPopupData.js";
a.charset = "UTF-8";
a.type = "text/javascript";
a.id = "WT3_SegmentRollOverDataScript";
e.appendChild(a)
}
};
WT3_AddSegmentRollOverPopupToLayers = function() {
if (C.segmentRollOverLayers) {
C.segmentRollOverLayers.eachLayer(function(e) {
e.unbindPopup()
})
}
if (typeof C.segmentRollOverLayers != "undefined" && typeof C.segmentRollOverPropeties != "undefined")
if (C.segmentRollOverLayers != null && C.segmentRollOverPropeties != null) {
C.segmentRollOverLayers.eachLayer(function(e) {
if (C.segmentRollOverPropeties[e.feature.properties.id]) {
var t = C.segmentRollOverPropeties[e.feature.properties.id];
var a = "Tronçon " + e.feature.properties.id + "";
for (var i in t) {
var r = t[i];
if (a != "") a = a + "
";
a = a + i + " : " + r
}
e.bindPopup(a)
}
})
} if (typeof SAWT3_SegmentRollOverPopupDataLocation != "undefined") {
C.SAWT["SAWT3_SegmentRollOverPopupDataLocation"] = SAWT3_SegmentRollOverPopupDataLocation
}
};
this.parseSegmentRollOverPopupData = function(e) {
if (C) {
if (e) {
C.segmentRollOverPropeties = e;
WT3_AddSegmentRollOverPopupToLayers()
}
}
};
resizeTrafficForecastChartBars = function() {
var e = document.getElementsByClassName("traffic-forecast-chart-bar");
if (e.length > 0) {
var t = document.createElement("div");
t.className = "traffic-forecast-chart-bar";
C.div.appendChild(t);
var a = parseInt(window.getComputedStyle(t).getPropertyValue("height"));
C.div.removeChild(t);
for (var i = 0; i < e.length; ++i) {
var r = e[i];
if (i == 0) {
r.style.height = a + "px"
} else {
var o = r.color == "r" ? {
min: .8,
max: 1
} : r.color == "o" ? {
min: .6,
max: .8
} : {
min: 0,
max: .6
};
r.style.height = (r.value * (o.max - o.min) + o.min) * a + "px"
}
}
}
};
WT3_ClearAndReloadTrafficForecastMarkers = function() {
if (C.trafficLayer == "forecast") {
for (var e = 0; e < C.maxZoom - C.minZoom; ++e) {
if (C.trafficForecastMarkers[e]) {
C.trafficForecastMarkers[e].clearLayers()
}
}
Re()
}
};
WT3_EnableSegmentRollOverFeature = function() {
WT3_LoadGeoJsonSegmentGeometry();
WT3_LoadSegmentRollOverPopupData();
var e = 0;
var t = setInterval(function() {
e = e + 1;
if (typeof C.segmentRollOverLayers != "undefined" && typeof C.segmentRollOverPropeties != "undefined")
if (C.segmentRollOverLayers != null && C.segmentRollOverPropeties != null) {
clearInterval(t);
WT3_AddSegmentRollOverPopupToLayers();
C.enableSegmentRollOver = true
} if (e >= 40) {
clearInterval(t);
console.log("Warning: Segment roll-over feature failed to load.")
}
}, 250)
};
this.parseSections = function(e, t, a) {
C.trafficForecastSectionsLoading = false;
if (t) {
var i = t.split("-");
C.trafficForecastMinDate = new Date(i[0], i[1] - 1, i[2])
}
if (a) {
var r = a.split("-");
C.trafficForecastMaxDate = new Date(r[0], r[1] - 1, r[2]);
C.trafficForecastMaxDate.setHours(23)
}
if (e) {
for (var o = 0; o < e.length; ++o) {
C.trafficForecastSections.push(new U(e[o]))
}
}
C.trafficForecastSectionsLoaded = true;
e = 0;
if (C.trafficForecastDateTime) {
WT3_LoadTrafficForecastSectionStates()
}
};
this.cleanMemSectionArray = function() {
var e = 10;
var t = Object.keys(C.trafficForecastSectionStates).length;
var a = 0;
for (key in C.trafficForecastSectionStates) {
if (a < t - e) {
delete C.trafficForecastSectionStates[key]
}
a++
}
};
this.parseSectionsState = function(e) {
if (e) {
var t = $e(C.trafficForecastDateTime, true);
if (!C.trafficForecastSectionStates[t]) {
C.trafficForecastSectionStates[t] = []
}
this.cleanMemSectionArray();
for (var a = 0; a < Object.keys(e).length; ++a) {
var i = Object.keys(e)[a];
C.trafficForecastSectionStates[t][i] = Ve(e[i])
}
}
e = 0;
Re()
};
this.parseTrafficForecastChartData = function(e) {
if (e) {
var t = $e(C.trafficForecastDateTime, false);
if (!C.trafficForecastChartData[t]) {
C.trafficForecastChartData[t] = []
}
for (var a = 0; a < e.length; ++a) {
C.trafficForecastChartData[t][e[a][0]] = {
values: e[a][1],
colors: e[a][2]
}
}
}
e = 0
};
this.parseTrafficForecastGroups = function(e) {
if (e && C.trafficForecastGroups.length == 0) {
for (var t = 0; t < e.length; ++t) {
C.trafficForecastGroups.push({
group: e[t][0],
sections: e[t][1]
})
}
}
e = 0
};
this.setRushHour = function(e, t) {
if (e) {
C.rushHours[e] = t;
if (C.trafficForecastDateTime) {
var a = e.split("-");
if (parseInt(a[0]) == C.trafficForecastDateTime.getFullYear() && parseInt(a[1]) == C.trafficForecastDateTime.getMonth() + 1 && parseInt(a[2]) == C.trafficForecastDateTime.getDate() && t == C.trafficForecastDateTime.getHours()) {
C.setTrafficForecastDateTime(C.trafficForecastDateTime)
}
}
}
};
var Re = function() {
if (C.trafficForecastDateTime) {
var e = C.mapObject.getZoom();
if (!C.trafficForecastMarkers[e - C.minZoom]) {
C.trafficForecastMarkers[e - C.minZoom] = L.markerGroup()
}
var t = $e(C.trafficForecastDateTime, true);
for (var a = 0; a < C.trafficForecastSections.length; ++a) {
var i = C.trafficForecastSections[a];
var r = -2;
for (var o = 0; o < i.properties.length; ++o) {
var n = i.properties[o];
if (C.trafficForecastSectionStates[t][n.id] && r < C.trafficForecastSectionStates[t][n.id]) {
r = C.trafficForecastSectionStates[t][n.id]
}
if (r == 2) break
}
if (r == -2) r = 0;
var s = L.marker(i.latlng, {
icon: trafficForecastIcon(C.markerIconSizes["forecast"], r)
});
s.on("click", function(e) {
Ge(e.latlng)
});
C.trafficForecastMarkers[e - C.minZoom].addLayer(s)
}
if (L.buttonInCustomControlBarIsActivated("forecasts") || !C.displayTrafficForecastButton) {
u()
}
}
};
var Ge = function(e) {
var t = e.lat;
var a = e.lng;
for (var i = 0; i < C.trafficForecastSections.length; ++i) {
var r = C.trafficForecastSections[i];
if (r.latlng.lat == t && r.latlng.lng == a) {
var o = L.popin({
title: getLabelForLocale("trafficForecast", C.language) + " - " + formatDate(C.language, C.trafficForecastDateTime) + "",
className: "forecast"
}).addTo(C.mapObject);
var n = document.createElement("ul");
n.id = "forecastSectionList";
o.addContent(n);
ze(r, o);
return o
}
}
};
var ze = function(e, t) {
var a = document.getElementById("forecastSectionList");
if (!a) return;
var i = document.createElement("li");
a.appendChild(i);
var r = "";
if (typeof trafficForecastThumbnails != "undefined" && e.properties[0] && e.properties[0].id && trafficForecastThumbnails[e.properties[0].id]) {
r = trafficForecastThumbnails[e.properties[0].id]
}
var o = document.createElement("img");
o.className = "forecast";
o.src = WT3_baseURL + "/forecast-thumbnails/100/" + r + ".png";
i.appendChild(o);
var n = document.createElement("div");
n.className = "forecast-description";
i.appendChild(n);
for (var s = 0; s < e.properties.length; ++s) {
var c = e.properties[s];
var l = document.createElement("div");
l.className = "forecast-direction";
n.appendChild(l);
var f = document.createElement("p");
f.className = "forecast-direction origin";
f.innerHTML = c.origin;
l.appendChild(f);
var m = document.createElement("p");
m.className = "forecast-direction destination";
m.innerHTML = c.destination;
l.appendChild(m);
l.section = c;
l.onclick = function() {
createSectionTrafficForecastChartPopin(t, this.section)
}
}
t.addContent(a)
};
createSectionTrafficForecastChartPopin = function(e, t) {
var a = L.popin({
title: getLabelForLocale("trafficForecast", C.language) + " - " + formatDate(C.language, C.trafficForecastDateTime) + "",
className: "forecast",
parentPopin: e,
backToDisplayText: getLabelForLocale("backToList", C.language)
}).addTo(C.mapObject);
var i = "";
if (e.groupName) {
var r = document.createElement("div");
a.addContent(r);
r.className = "trafficforecast-group-popin-title";
iconDiv = document.createElement("div");
iconDiv.className = "trafficforecast-group-popin-title-icon";
r.appendChild(iconDiv);
descriptionDiv = document.createElement("div");
descriptionDiv.className = "trafficforecast-group-popin-title-description";
r.appendChild(descriptionDiv);
descriptionDiv.innerHTML = e.groupName;
i = " with-group-title "
}
var o = document.createElement("h2");
o.innerHTML = t.origin + "" + t.destination;
o.className = "traffic-forecast-section-description" + i;
a.addContent(o);
var n = document.createElement("h3");
n.innerHTML = getLabelForLocale("trafficForecastChartTitle", C.language);
n.className = "traffic-forecast-chart-title" + i;
a.addContent(n);
var s = document.createElement("div");
s.className = "traffic-forecast-chart" + i;
a.addContent(s);
var c = document.createElement("div");
c.className = "traffic-forecast-chart-traffic-axis-arrow" + i;
s.appendChild(c);
var l = document.createElement("div");
l.className = "traffic-forecast-chart-time-axis-arrow" + i;
s.appendChild(l);
var f = document.createElement("div");
f.innerHTML = getLabelForLocale("traffic", C.language);
f.className = "traffic-forecast-chart-traffic-axis-legend" + i;
s.appendChild(f);
var m = $e(C.trafficForecastDateTime, false);
if (C.trafficForecastChartData[m] && C.trafficForecastChartData[m][t.id]) {
var u = document.createElement("div");
u.className = "traffic-forecast-chart-bar" + i;
C.div.appendChild(u);
var p = parseInt(window.getComputedStyle(u).getPropertyValue("height"));
C.div.removeChild(u);
var d = document.createElement("div");
d.className = "traffic-forecast-chart-bar" + i;
d.style.height = p + "px";
d.style.width = 1 + "px";
s.appendChild(d);
for (var h = 0; h < 24; ++h) {
var d = document.createElement("div");
d.value = C.trafficForecastChartData[m][t.id].values[h];
d.color = C.trafficForecastChartData[m][t.id].colors[h];
d.className = "traffic-forecast-chart-bar " + i + d.color;
var v = d.color == "r" ? {
min: .8,
max: 1
} : d.color == "o" ? {
min: .6,
max: .8
} : {
min: 0,
max: .6
};
d.style.height = (d.value * (v.max - v.min) + v.min) * p + "px";
s.appendChild(d)
}
var g = document.createElement("div");
g.className = "traffic-forecast-chart-time-axis-legend" + i;
g.id = "trafficForecastTimeLegend" + i;
s.appendChild(g);
for (var T = 0; T < 24; ++T) {
var b = document.createElement("div");
b.className = "traffic-forecast-chart-hour" + i;
if (T % 3 == 0) {
b.innerHTML = T
} else {
b.innerHTML = "-"
}
g.appendChild(b)
}
}
var y = document.createElement("div");
y.className = "traffic-forecast-chart-hour-day-legend" + i;
y.innerHTML = getLabelForLocale("hourOfTheDay", C.language);
a.addContent(y);
var S = document.createElement("div");
S.className = "traffic-forecast-chart-color-legend" + i;
var F = document.createElement("div");
F.className = "traffic-forecast-chart-color-legend-element" + i + " v";
S.appendChild(F);
var k = document.createElement("div");
k.className = "traffic-forecast-chart-color-legend-text" + i;
k.innerHTML = getLabelForLocale("freeFlow", C.language);
S.appendChild(k);
var w = document.createElement("div");
w.className = "traffic-forecast-chart-color-legend-element" + i + " o";
S.appendChild(w);
var D = document.createElement("div");
D.className = "traffic-forecast-chart-color-legend-text" + i;
D.innerHTML = getLabelForLocale("loaded", C.language);
S.appendChild(D);
var M = document.createElement("div");
M.className = "traffic-forecast-chart-color-legend-element" + i + " r";
S.appendChild(M);
var A = document.createElement("div");
A.className = "traffic-forecast-chart-color-legend-text" + i;
A.innerHTML = getLabelForLocale("saturated", C.language);
S.appendChild(A);
a.addContent(S);
return a
};
var Ue = function() {
var e = L.popin({
title: getLabelForLocale("trafficForecast", C.language) + " - " + formatDate(C.language, C.trafficForecastDateTime) + "",
className: "forecast"
}).addTo(C.mapObject);
var t = document.createElement("h2");
t.innerHTML = getLabelForLocale("selectHighway", C.language);
t.className = "traffic-forecast-group-list";
e.addContent(t);
var a = document.createElement("ul");
a.className = "trafficforecast-group-list";
e.addContent(a);
for (var i = 0; i < C.trafficForecastGroups.length; ++i) {
var r = document.createElement("li");
r.className = "trafficforecast-group-list-item";
r.index = i;
a.appendChild(r);
var o = document.createElement("div");
o.className = "trafficforecast-highway-icon";
r.appendChild(o);
var n = document.createElement("div");
n.className = "trafficforecast-group-description";
n.innerHTML = C.trafficForecastGroups[i].group;
r.appendChild(n);
r.onclick = function() {
Je(C.trafficForecastGroups[this.index], e)
}
}
return e
};
var Je = function(e, t) {
var a = L.popin({
title: getLabelForLocale("trafficForecast", C.language) + " - " + formatDate(C.language, C.trafficForecastDateTime) + "",
className: "forecast",
parentPopin: t,
backToDisplayText: getLabelForLocale("backToList", C.language)
}).addTo(C.mapObject);
a.groupName = e.group;
var i = document.createElement("div");
a.addContent(i);
i.className = "trafficforecast-group-popin-title";
iconDiv = document.createElement("div");
iconDiv.className = "trafficforecast-group-popin-title-icon";
i.appendChild(iconDiv);
descriptionDiv = document.createElement("div");
descriptionDiv.className = "trafficforecast-group-popin-title-description";
i.appendChild(descriptionDiv);
descriptionDiv.innerHTML = a.groupName;
var r = document.createElement("ul");
r.id = "forecastSectionList";
a.addContent(r);
var o = [];
for (var n = 0; n < e.sections.length; ++n) {
var s = Ye(e.sections[n]);
if (s && o.indexOf(s) < 0) {
o.push(s)
}
}
for (var c = 0; c < o.length; ++c) {
ze(o[c], a)
}
return a
};
var Ve = function(e) {
switch (e) {
case "fluide":
return 0;
case "charge":
return 1;
case "sature":
return 2;
case "inconnu":
return -1;
default:
return 0
}
};
var $e = function(e, t) {
var a = e.getFullYear();
var i = e.getMonth() + 1;
var r = e.getDate();
var o = e.getHours();
if (i < 10) i = "0" + i;
if (r < 10) r = "0" + r;
if (t) {
return a + "-" + i + "-" + r + "/" + o + "/"
} else {
return a + "-" + i + "-" + r + "/"
}
};
var Ye = function(e) {
for (var t = 0; t < C.trafficForecastSections.length; ++t) {
var a = C.trafficForecastSections[t];
for (var i = 0; i < a.properties.length; ++i) {
if (a.properties[i].id == e) {
return a
}
}
}
return
};
var qe = function() {
if (!C.trafficForecastSectionsLoading && !C.trafficForecastSectionsLoaded) {
WT3_LoadTrafficForecastSections()
}
if (C.trafficForecastSectionsLoading && !C.trafficForecastSectionsLoaded && C.createForecastDateSelectionScreenTries < 100) {
++C.createForecastDateSelectionScreenTries;
setTimeout(function() {
qe()
}, 200)
}
var e = document.getElementById("forecastSplashScreen");
if (!e) {
e = document.createElement("div");
e.className = "forecast-splash-screen";
e.id = "forecastSplashScreen";
C.div.appendChild(e)
}
if (C.trafficForecastSectionsLoaded) {
if (!C.initialTrafficForecastDateTime || C.initialTrafficForecastDateTime < C.trafficForecastMinDate || C.initialTrafficForecastDateTime > C.trafficForecastMaxDate) {
if (C.createForecastDateSelectionScreenTries >= 10) {
C.div.removeChild(e)
}
if (C.trafficForecastSectionsLoaded) {
C.createForecastDateSelectionScreenTries = 0;
C.setMouseEnabled(false);
if (e.getElementsByClassName("forecast-title").length == 0) {
var t = document.createElement("div");
t.className = "forecast-title";
var a = document.createElement("h1");
a.className = "forecast-title";
a.innerHTML = getLabelForLocale("trafficForecast", C.language);
t.appendChild(a);
var i = document.createElement("p");
i.className = "forecast-subtitle";
i.innerHTML = getLabelForLocale("trafficForecastAvailable", C.language);
t.appendChild(i);
var r = document.createElement("p");
r.className = "forecast-subtitle";
r.innerHTML = getLabelForLocale("trafficForecastFromToday", C.language) + " " + getLabelForLocale("trafficForecastToDate", C.language) + " " + formatDate(C.language, C.trafficForecastMaxDate);
t.appendChild(r);
e.appendChild(t);
var o = document.createElement("div");
o.className = "forecast-select";
var n = document.createElement("p");
n.className = "forecast-select";
n.innerHTML = getLabelForLocale("forecastDateSelectDescription", C.language);
o.appendChild(n);
forecastDateDiv = document.createElement("div");
forecastDateLabel = document.createElement("label");
forecastDateLabel.className = "forecast-datetime";
forecastDateLabel.innerHTML = getLabelForLocale("forecastDate", C.language);
forecastDateDiv.appendChild(forecastDateLabel);
forecastDateSelectInput = document.createElement("input");
forecastDateSelectInput.className = "forecast-select";
forecastDateSelectInput.id = "datePicker";
forecastDateSelectInput.readOnly = true;
var s = new Date;
s.setMinutes(0);
s.setSeconds(0);
s.setHours(s.getHours() + 1);
C.trafficForecastDatePicker = new Pikaday({
field: forecastDateSelectInput,
minDate: C.trafficForecastMinDate < s ? s : C.trafficForecastMinDate,
maxDate: C.trafficForecastMaxDate,
defaultDate: C.trafficForecastDateTime,
onSelect: function(e) {
var t = document.getElementById("timeSelect");
if (e.toDateString() == s.toDateString()) {
for (var a = 0; a < s.getHours(); a++) {
t.querySelector('option[value="' + a + '"]').disabled = true
}
} else {
var i = Array.prototype.slice.call(t.querySelectorAll("option"));
i.map(function(e) {
e.disabled = false
})
}
forecastDateSelectInput.value = formatDate(C.language, e);
if (forecastTimeSelect.selectedIndex > -1) {
var r = new Date(e);
r.setHours(forecastTimeSelect.value);
if (!o) {
var o = document.getElementById("forecastDateTimeSelectValidate")
}
o.value = r;
if (!o.classList.contains("enabled")) {
o.classList.add("enabled")
}
}
}
});
if (C.language == "FR") {
C.trafficForecastDatePicker._o.i18n = {
previousMonth: "Mois précédent",
nextMonth: "Mois suivant",
months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
weekdays: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
weekdaysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"]
};
C.trafficForecastDatePicker._o.firstDay = 1
}
forecastDateSelectInput.picker = C.trafficForecastDatePicker;
forecastDateDiv.appendChild(forecastDateSelectInput);
o.appendChild(forecastDateDiv);
forecastTimeDiv = document.createElement("div");
forecastTimeLabel = document.createElement("label");
forecastTimeLabel.className = "forecast-datetime";
forecastTimeLabel.innerHTML = getLabelForLocale("forecastTime", C.language);
forecastTimeDiv.appendChild(forecastTimeLabel);
forecastTimeSelect = document.createElement("select");
forecastTimeSelect.className = "forecast-select";
forecastTimeSelect.id = "timeSelect";
forecastTimeDiv.appendChild(forecastTimeSelect);
o.appendChild(forecastTimeDiv);
var c = Ke(C.language);
for (var l = 0; l < c.length; l++) {
forecastTimeSelect.appendChild(c[l])
}
if (C.trafficForecastDateTime) {
forecastTimeSelect.selectedIndex = C.trafficForecastDateTime.getHours()
} else {
forecastTimeSelect.selectedIndex = -1
}
forecastTimeSelect.onchange = function() {
if (this.selectedIndex > -1 && C.trafficForecastDatePicker._d >= C.trafficForecastMinDate && C.trafficForecastDatePicker._d <= C.trafficForecastMaxDate) {
if (!e) {
var e = document.getElementById("forecastDateTimeSelectValidate")
}
if (!e.classList.contains("enabled")) {
e.classList.add("enabled")
}
}
};
forecastDateSelectValidate = document.createElement("button");
forecastDateSelectValidate.className = "forecast-select";
forecastDateSelectValidate.id = "forecastDateTimeSelectValidate";
forecastDateSelectValidate.innerHTML = getLabelForLocale("forecastDateValidate", C.language);
forecastDateSelectValidate.onclick = function() {
if (this.classList.contains("enabled")) {
if (!e) {
var e = document.getElementById("timeSelect")
}
var t = new Date(C.trafficForecastDatePicker._d);
t.setHours(e.value);
C.setTrafficForecastDateTime(t);
if (!a) {
var a = document.getElementById("forecastSplashScreen")
}
a.parentNode.removeChild(a);
C.setMouseEnabled(true)
}
};
o.appendChild(forecastDateSelectValidate);
e.appendChild(o);
Xe();
if (C.trafficForecastDateTime) {
C.trafficForecastDatePicker.setDate(C.trafficForecastDateTime)
}
}
}
} else {
if (!C.trafficForecastDateTime) {
C.setTrafficForecastDateTime(C.initialTrafficForecastDateTime);
C.initialTrafficForecastDateTime = null;
e = document.getElementById("forecastSplashScreen");
if (e) {
C.div.removeChild(e)
}
}
}
}
};
var Xe = function() {
if (C.trafficForecastDatePicker && document.getElementById("datePicker")) {
if (typeof document.getElementById("datePicker").getBoundingClientRect === "function") {
C.trafficForecastDatePicker.offsetX = document.getElementById("datePicker").getBoundingClientRect().left
} else {
C.trafficForecastDatePicker.offsetX = document.getElementById("datePicker").offsetX
}
if (!C.trafficForecastDatePicker.el.classList.contains("is-hidden")) {
C.trafficForecastDatePicker.adjustPosition()
}
}
};
var Ke = function(e) {
var t = [];
switch (e) {
case "EN":
for (var a = 0; a < 24; ++a) {
var i = document.createElement("option");
i.value = a;
if (a == 0) {
i.innerHTML = "12:00 AM"
} else if (a < 12) {
i.innerHTML = a + ":00 AM"
} else if (a == 12) {
i.innerHTML = "12:00 PM"
} else {
i.innerHTML = a - 12 + ":00 PM"
}
t.push(i)
}
break;
default:
for (var a = 0; a < 24; ++a) {
var i = document.createElement("option");
i.value = a;
i.innerHTML = a < 10 ? "0" + a + "h00" : a + "h00";
t.push(i)
}
}
return t
};
var Qe = function() {
if (C.trafficForecastDateTime && C.displayTrafficForecastDateButton) {
var e = document.createElement("div");
var t = document.createElement("div");
t.className = "forecast-button date";
var a = C.trafficForecastDateTime.getDate();
if (C.language == "FR" && a < 10) a = "0" + a;
t.innerHTML = a;
e.appendChild(t);
var i = document.createElement("div");
i.className = "forecast-button month";
i.innerHTML = getMonthForLocale(C.language, C.trafficForecastDateTime);
e.appendChild(i);
return e
}
};
var et = function() {
if (C.trafficForecastDateTime && C.displayTrafficForecastTimeButtons) {
var e = document.createElement("div");
var t = document.createElement("div");
t.className = "forecast-button previous";
var a = document.createElement("div");
a.className = "forecast-button next";
var i = function() {
var e = new Date;
e.setMinutes(0);
e.setSeconds(0);
e.setHours(e.getHours() + 1);
if (C.trafficForecastDateTime <= e || C.trafficForecastDateTime <= C.trafficForecastMinDate) {
t.classList.add("unavailable")
} else {
t.classList.remove("unavailable")
}
if (C.trafficForecastDateTime >= C.trafficForecastMaxDate) {
a.classList.add("unavailable")
} else {
a.classList.remove("unavailable")
}
};
if (C.trafficForecastDateTime > C.trafficForecastMinDate) {
t.onclick = function(e) {
var t = new Date;
t.setMinutes(0);
t.setSeconds(0);
t.setHours(t.getHours() + 1);
if (C.trafficForecastDateTime > t) {
if (C.mapObject.hasLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])) {
C.mapObject.removeLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])
}
C.trafficForecastDateTime.setHours(C.trafficForecastDateTime.getHours() - 1);
C.setTrafficForecastDateTime(C.trafficForecastDateTime)
}
i()
}
}
i();
e.appendChild(t);
var r = C.trafficForecastDateTime.getFullYear();
var o = C.trafficForecastDateTime.getMonth() + 1;
if (o < 10) o = "0" + o;
var n = C.trafficForecastDateTime.getDate();
if (n < 10) n = "0" + n;
var s = r + "-" + o + "-" + n;
var c = C.rushHours[s];
var l = getHoursForLocale(C.language, C.trafficForecastDateTime);
if (C.trafficForecastDateTime.getHours() == c) {
var f = tt(l)
} else {
var f = document.createElement("div");
f.id = "trafficForecastTime";
f.className = "forecast-button time description";
f.innerHTML = l
}
e.appendChild(f);
if (C.trafficForecastDateTime < C.trafficForecastMaxDate) {
a.onclick = function(e) {
if (C.mapObject.hasLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])) {
C.mapObject.removeLayer(C.trafficForecastMarkers[C.mapObject.getZoom() - C.minZoom])
}
C.trafficForecastDateTime.setHours(C.trafficForecastDateTime.getHours() + 1);
C.setTrafficForecastDateTime(C.trafficForecastDateTime)
}
}
i();
e.appendChild(a);
return e
}
};
var tt = function(e) {
var t = document.getElementById("trafficForecastTime");
if (t) {
t.parentNode.removeChild(t)
}
t = document.createElement("div");
t.id = "trafficForecastTime";
t.className = "forecast-button time description rushhour";
t.innerHTML = e;
var a = document.createElement("p");
a.className = "rushhour";
t.appendChild(a);
a.innerHTML = getLabelForLocale("trafficForecastRushHour", C.language);
return t
}
};
var lookupStringClean = function(e) {
return e.toLowerCase().replace(/'/g, "").replace(/ /g, "").replace(/\//g, "").replace(/-/g, "").replace(/_/g, "").replace(/\(/g, "").replace(/\)/g, "").replace(/à/g, "a").replace(/â/g, "a").replace(/é/g, "e").replace(/è/g, "e").replace(/ê/g, "e").replace(/î/g, "i").replace(/ô/g, "o").replace(/û/g, "u").replace(/ù/g, "u")
};
var getHoursForLocale = function(e, t) {
if (t) {
var a = t.getHours();
switch (e) {
case "EN":
if (a == 0) {
return "12 AM"
} else if (a < 12) {
return a + " AM"
} else if (a == 12) {
return "12 PM"
} else {
a -= 12;
return a + " PM"
}
default:
if (a < 10) a = "0" + a;
return a + "h"
}
}
};
var getMonthForLocale = function(e, t) {
if (t) {
switch (t.getMonth()) {
case 0:
return getLabelForLocale("jan", e);
case 1:
return getLabelForLocale("feb", e);
case 2:
return getLabelForLocale("mar", e);
case 3:
return getLabelForLocale("apr", e);
case 4:
return getLabelForLocale("mai", e);
case 5:
return getLabelForLocale("jun", e);
case 6:
return getLabelForLocale("jul", e);
case 7:
return getLabelForLocale("aug", e);
case 8:
return getLabelForLocale("sep", e);
case 9:
return getLabelForLocale("oct", e);
case 10:
return getLabelForLocale("nov", e);
case 11:
return getLabelForLocale("dec", e)
}
}
};
function formatDate(e, t) {
if (t) {
switch (e) {
case "EN":
return getMonthForLocale(e, t) + " " + t.getDate() + ", " + t.getFullYear();
case "FR":
var a = t.getDate();
if (a < 10) a = "0" + a;
return a + " " + getMonthForLocale(e, t) + " " + t.getFullYear();
default:
return t.toLocaleDateString(e)
}
}
}
function formatDateTime(e, t) {
if (!e instanceof Date) return "";
if (!t) {
return e.toLocaleString()
}
var a = e.getFullYear();
var i = "0" + (e.getMonth() + 1);
i = i.substring(i.length - 2);
var r = "0" + e.getDate();
r = r.substring(r.length - 2);
var o = "0" + e.getHours();
o = o.substring(o.length - 2);
var n = "0" + e.getMinutes();
n = n.substring(n.length - 2);
switch (t) {
case "FR":
return r + "/" + i + "/" + a + " " + o + ":" + n;
case "EN":
if (o == 0) {
return i + "/" + r + "/" + a + " " + 12 + ":" + n + " AM"
} else if (o < 12) {
o = parseInt(o);
return i + "/" + r + "/" + a + " " + o + ":" + n + " AM"
} else if (o == 12) {
return i + "/" + r + "/" + a + " " + o + ":" + n + " PM"
} else {
o = parseInt(o) - 12;
return i + "/" + r + "/" + a + " " + o + ":" + n + " PM"
}
default:
return e.toLocaleString()
}
}
var _translations = Array();
_translations["EN"] = {
showInformation: "Display traffic information",
showDisruptions: "Display disruptions",
showExits: "Display exits",
showAreas: "Display areas",
showUserLocation: "Move to your location",
geolocationError: "We were not allowed to geolocate you",
showWebcams: "Display webcams",
zoomIn: "Zoom in",
zoomOut: "Zoom out",
attribution: "OpenStreetMap contributors, ©Autoroutes Trafic "+(new Date()).getFullYear(),
dataTime: "Last update: ",
updateError: "/!\\ Last map update failed",
junction: "Junction",
exit: "Exit",
restArea: "Rest area",
serviceArea: "Service area",
abbreviatedNumber: "#",
toll: "Toll gate",
tollWaitingTime: "Wait at the toll gate",
retentionDelay: "Retention delay",
trafficAlertPopupTitle: "Traffic Alert",
webcamError: "Error while reading the video.",
fullScreenMap: "Full screen map",
realTimeTraffic: "Real time traffic",
webcam: "Webcam",
tripTime: "Journey time",
tripTimeLookup: "Search in journey times",
tripTimeFromList: "Time from: ",
tripTimeToList: "Time to:",
among: "In the ",
from: "From",
startingFrom: "Starting from ",
to: "To",
delayToNormalTime: "Delay",
insteadOf: "instead of",
webcamThumbnail: "Webcam thumbnail",
backToList: "Back to list",
backToWebcamList: "Back to webcam list",
showTripTimeList: "Show journey time list",
pickTripTimeLocation: "Select a location",
listedTripTimes: " locations found",
tripTimeLookupInputPlaceholder: "Enter a location",
aboutPopinTitle: "About",
updateErrorPopinTitle: "Data update failed",
updateErrorPopinNetwork: "Network connection failed!",
updateErrorPopinNextUpdate: "Next update in 3 minutes.",
updateErrorPopinRefreshLink: "Update now",
updating: "Updating, please wait...",
trafficForecast: "Traffic forecast",
trafficForecastAvailable: "Traffic forecast available : ",
trafficForecastFromToday: "from today",
trafficForecastToDate: "to",
forecastDateSelectPopinTitle: "Traffic forecast",
forecastDateSelectDescription: "Traffic forecast for :",
forecastDate: "Day :",
forecastTime: "Time :",
forecastDateValidate: "See traffic forecast",
trafficForecastFor: "Traffic forecast for : ",
trafficForecastRushHour: "busiest hour",
openForecastDateSelectPopin: "Select a new date for traffic forecast",
trafficForecastChartTitle: "24 hours traffic forecast",
traffic: "Traffic",
display24hTraffic: "24h traffic bargraph",
hourOfTheDay: "Hour of the day",
freeFlow: "Free flow",
loaded: "Loaded",
saturated: "Saturated",
selectHighway: "Select a highway",
jan: "January",
feb: "February",
mar: "March",
apr: "April",
may: "May",
jun: "June",
jul: "July",
aug: "August",
sep: "September",
oct: "October",
nov: "November",
dec: "December",
weatherForecastFor: "Weather forecast for : ",
weatherForecastHourSuffix: "",
dates: {
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
},
nearestWheaterForecastMarker: "Nearest weather forecast location"
};
_translations["FR"] = {
showInformation: "Afficher les informations",
showDisruptions: "Afficher les perturbations",
showExits: "Afficher les échangeurs",
showAreas: "Afficher les aires",
showUserLocation: "Afficher votre position",
geolocationError: "Nous n'avons pas obtenu l'autorisation de vous géolocaliser",
showWebcams: "Afficher les webcams",
zoomIn: "Zoomer",
zoomOut: "Dézoomer",
attribution: "Les contributeurs OpenStreetMap, ©Autoroutes Trafic 2024",
dataTime: "Dernière mise à jour : ",
updateError: "/!\\ Echec de la dernière mise à jour",
junction: "Bifurcation",
exit: "Echangeur",
restArea: "Aire de repos",
serviceArea: "Aire de service",
abbreviatedNumber: "n°",
toll: "Barrière de péage",
tollWaitingTime: "Attente au péage",
retentionDelay: "Durée de stockage",
trafficAlertPopupTitle: "Alerte info trafic",
webcamError: "Erreur de lecture de la vidéo.",
fullScreenMap: "Carte plein écran",
realTimeTraffic: "Trafic temps réel",
webcam: "Webcam",
tripTime: "Temps de parcours",
tripTimeLookup: "Recherche de temps de parcours",
tripTimeFromList: "Temps de parcours depuis :",
tripTimeToList: "Temps de parcours vers :",
among: "Parmi les ",
from: "De",
startingFrom: "Au départ de ",
to: "Vers",
delayToNormalTime: "Retard",
insteadOf: "au lieu de",
webcamThumbnail: "Vignette pour la webcam",
backToList: "Retour à la liste",
backToWebcamList: "Retour à la liste des webcams",
showTripTimeList: "Afficher la liste des temps de parcours",
pickTripTimeLocation: "Sélectionnez un point de départ ou d'arrivée",
listedTripTimes: " points de départ ou d'arrivée",
tripTimeLookupInputPlaceholder: "Saisissez un point de départ ou d'arrivée",
aboutPopinTitle: "À propos",
updateErrorPopinTitle: "Mise à jour des données impossible",
updateErrorPopinNetwork: "Connexion réseau impossible !",
updateErrorPopinNextUpdate: "Prochaine tentative dans 3 minutes.",
updateErrorPopinRefreshLink: "Mettre à jour maintenant",
updating: "Mise à jour en cours...",
trafficForecast: "Prévisions de trafic",
trafficForecastAvailable: "Prévisions de trafic disponibles : ",
trafficForecastFromToday: "d'aujourd'hui",
trafficForecastToDate: "au",
forecastDateSelectPopinTitle: "Prévisions de trafic",
forecastDateSelectDescription: "Consulter les prévisions pour :",
forecastDate: "Date :",
forecastTime: "Heure :",
forecastDateValidate: "Voir les prévisions",
trafficForecastFor: "Prévisions pour le : ",
trafficForecastRushHour: "heure la plus chargée",
openForecastDateSelectPopin: "Choisir une nouvelle date pour les prévisions",
trafficForecastChartTitle: "Prévisions de trafic sur 24 heures",
traffic: "Trafic",
display24hTraffic: "Histogramme du trafic sur 24h",
hourOfTheDay: "Heure de la journée",
freeFlow: "Fluide",
loaded: "Dense",
saturated: "Saturé",
selectHighway: "Sélectionnez une autoroute",
jan: "janvier",
feb: "février",
mar: "mars",
apr: "avril",
may: "mai",
jun: "juin",
jul: "juillet",
aug: "août",
sep: "septembre",
oct: "octobre",
nov: "novembre",
dec: "décembre",
weatherForecastFor: "Prévisions pour le : ",
weatherForecastHourSuffix: "h",
dates: {
months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
weekdays: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
weekdaysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"]
},
nearestWheaterForecastMarker: "Point météo le plus proche"
};
var getLabelForLocale = function(e, t) {
if (!(t in _translations)) {
throw new Error("Language " + t + " is not loaded");
return e
} else if (e in _translations[t]) {
return _translations[t][e]
} else {
return e
}
};
function getLocalTimeISOoffsetMarker() {
var e = new Date;
var t;
var a;
var i = e.getTimezoneOffset();
var r, o, n = "";
r = parseInt(i) >= 0 ? "+" : "-";
i = Math.abs(i);
o = "0" + parseInt(i / 60);
o = o.substring(o.length - 2);
n = "0" + i % 60;
n = n.substring(n.length - 2);
return r + o + ":" + n
}
function htmlDecode(e) {
var t = document.createElement("div");
t.innerHTML = e;
return t.childNodes.length === 0 ? "" : t.childNodes[0].nodeValue
}
if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== "undefined") {
Object.defineProperty(HTMLElement.prototype, "classList", {
get: function() {
var r = this;
function e(i) {
return function(e) {
var t = r.className.split(/\s+/),
a = t.indexOf(e);
i(t, a, e);
r.className = t.join(" ")
}
}
var t = {
add: e(function(e, t, a) {
~t || e.push(a)
}),
remove: e(function(e, t) {
~t && e.splice(t, 1)
}),
toggle: e(function(e, t, a) {
~t ? e.splice(t, 1) : e.push(a)
}),
contains: function(e) {
return !!~r.className.split(/\s+/).indexOf(e)
},
item: function(e) {
return r.className.split(/\s+/)[e] || null
}
};
Object.defineProperty(t, "length", {
get: function() {
return r.className.split(/\s+/).length
}
});
return t
}
})
}
function informationIcon(e) {
return L.divIcon({
className: "information-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function roadworksIcon(e) {
return L.divIcon({
className: "roadworks-icon-class",
iconSize: null,
iconAnchor: [e[0] / 2, e[1] / 1.5]
})
}
function incidentIcon(e) {
return L.divIcon({
className: "incident-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function accidentIcon(e) {
return L.divIcon({
className: "accident-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function closureIcon(e) {
return L.divIcon({
className: "closure-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function trafficjamIcon(e) {
return L.divIcon({
className: "trafficjam-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function weatherForcastIcon(e, t, a, i, r) {
if (typeof a == "undefined") {
a = ""
} else {
a = a + "C"
}
if (typeof i == "undefined") {
i = ""
} else {
i = i + "C"
}
var o = '';
o += '
';
o += '
';
o += '' + a + "";
o += '' + i + "";
o += '' + r + "";
o += "
";
o += "
";
switch (t) {
case "00":
case 0:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--00",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "01":
case 1:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--01",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "02":
case 2:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--02",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "03":
case 3:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--03",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "04":
case 4:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--04",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "05":
case 5:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--05",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "06":
case 6:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--06",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "07":
case 7:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--07",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "08":
case 8:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--08",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "09":
case 9:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--09",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "10":
case 10:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--10",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "11":
case 11:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--11",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
case "12":
case 12:
return L.divIcon({
className: "weatherForcast-icon-class weatherForcast--12",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break;
default:
return L.divIcon({
className: "weatherForcast-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center"),
html: o
});
break
}
}
function webcamIcon(e, t) {
if (t == 1) {
return L.divIcon({
className: "webcam-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
if (t > 9) {
return L.divIcon({
className: "webcam-icon-class-10",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
return L.divIcon({
className: "webcam-icon-class-" + t,
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function tripTimeIcon(e, t) {
if (t == 1) {
return L.divIcon({
className: "triptime-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "bottom left")
})
}
if (t > 9) {
return L.divIcon({
className: "triptime-icon-class-10",
iconSize: null,
iconAnchor: getIconAnchor(e, "bottom left")
})
}
return L.divIcon({
className: "triptime-icon-class-" + t,
iconSize: null,
iconAnchor: getIconAnchor(e, "bottom left")
})
}
function retentionAreaIcon(e) {
return L.divIcon({
className: "retentionarea-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function tollWaitingTimeIcon(e) {
return L.divIcon({
className: "tollwaitingtime-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
})
}
function userLocationIcon(e) {
return L.divIcon({
className: "userlocation-icon-class",
iconSize: null,
iconAnchor: getIconAnchor(e, "bottom middle")
})
}
function trafficForecastIcon(e, t) {
var a = L.divIcon({
iconSize: null,
iconAnchor: getIconAnchor(e, "center")
});
switch (t) {
case -1:
a.options.className = "forecast-icon-class unknown";
break;
case 1:
a.options.className = "forecast-icon-class heavy";
break;
case 2:
a.options.className = "forecast-icon-class saturated";
break;
default:
a.options.className = "forecast-icon-class freeflow";
break
}
return a
}
function getIconAnchor(e, t) {
if (!e) return;
switch (t) {
case "top left":
return [0, 0];
case "top right":
return [e[0], 0];
case "bottom left":
return [0, e[1]];
case "bottom right":
return [e[0], e[1]];
case "bottom middle":
return [e[0] / 2, e[1]];
case "center":
return [e[0] / 2, e[1] / 2];
default:
return [e[0] / 2, e[1] / 2]
}
}
L.customControlBarButtonHandlers = new Array;
L.Control.CustomButton = L.Control.extend({
onAdd: function() {
this.activated = false;
var e = "leaflet-bar-part";
if (this.options.controlcssclass) {
e = e + " " + this.options.controlcssclass
}
if (this.options.container) {
var t = this.options.container;
this.link = L.DomUtil.create("a", e, this.options.container)
}
if (this.options.innerHTML) {
this.link.innerHTML = this.options.innerHTML
}
this.link.href = "javascript:void(0);";
if (this.options.title) {
this.link.title = this.options.title
}
L.DomEvent.on(this.link, "click", this._click, this);
return t
},
appendChild: function(e, t) {
if (!t) {
for (var a = 0; a < this.link.childNodes.length; ++a) {
this.link.removeChild(this.link.childNodes[a])
}
}
this.link.appendChild(e)
},
_click: function(e) {
if (!this.options.defaultClick) {
L.DomEvent.stopPropagation(e);
L.DomEvent.preventDefault(e);
this.intendedFunction()
}
},
_activate: function() {
if (this.options.controlcssclass) {
if (L.DomUtil.hasClass(this.link, this.options.controlcssclass)) {
L.DomUtil.removeClass(this.link, this.options.controlcssclass)
}
}
if (this.options.controlcssclassactivated) {
if (!L.DomUtil.hasClass(this.link, this.options.controlcssclassactivated)) {
L.DomUtil.addClass(this.link, this.options.controlcssclassactivated)
}
}
this.activated = true
},
_desactivate: function() {
if (this.options.controlcssclassactivated) {
if (L.DomUtil.hasClass(this.link, this.options.controlcssclassactivated)) {
L.DomUtil.removeClass(this.link, this.options.controlcssclassactivated)
}
}
if (this.options.controlcssclass) {
if (!L.DomUtil.hasClass(this.link, this.options.controlcssclass)) {
L.DomUtil.addClass(this.link, this.options.controlcssclass)
}
}
this.activated = false
}
});
L.customControlBar = function(e, t) {
if (t.buttons && t.position)
if (t.buttons.length > 0) {
var a = t.buttons.length;
if (t.direction == "horizontal") {
var i = L.DomUtil.create("div", "leaflet-bar horizontal leaflet-customButtonBar leaflet-control")
} else {
var i = L.DomUtil.create("div", "leaflet-bar leaflet-customButtonBar leaflet-control")
}
for (var r = 0; r < a; r++) {
var o = new L.Control.CustomButton;
o.options.container = i;
o.options.position = t.position;
if (typeof t.buttons[r].intendedFunction === "function") {
o.intendedFunction = t.buttons[r].intendedFunction
}
if (t.buttons[r].controlcssclass) {
o.options.controlcssclass = t.buttons[r].controlcssclass
}
if (t.buttons[r].controlcssclassactivated) {
o.options.controlcssclassactivated = t.buttons[r].controlcssclassactivated
}
if (t.buttons[r].title) {
o.options.title = t.buttons[r].title
}
if (t.buttons[r].activatedatstartup) {
o.options.activatedatstartup = true
}
if (t.buttons[r].innerHTML) {
o.options.innerHTML = t.buttons[r].innerHTML
}
if (t.buttons[r].defaultClick) {
o.options.defaultClick = t.buttons[r].defaultClick
}
if (t.buttons[r].buttonname) {
o.options.buttonname = t.buttons[r].buttonname;
L.customControlBarButtonHandlers[t.buttons[r].buttonname] = o
}
if (e == "") {} else if (e) {
e.addControl(o)
}
}
}
};
L.buttonInCustomControlBarIsActivated = function(e) {
if (L.customControlBarButtonHandlers[e]) {
return L.customControlBarButtonHandlers[e].activated
} else {
return false
}
};
L.activateButtonInCustomControlBar = function(e) {
if (L.customControlBarButtonHandlers[e]) {
L.customControlBarButtonHandlers[e]._activate()
}
};
L.desactivateButtonInCustomControlBar = function(e) {
if (L.customControlBarButtonHandlers[e]) {
L.customControlBarButtonHandlers[e]._desactivate()
}
};
L.appendChildToButtonInCustomControlBar = function(e, t, a) {
if (L.customControlBarButtonHandlers[e]) {
L.customControlBarButtonHandlers[e].appendChild(t, a)
}
};
L.popin = function(e) {
if (e) {
return new L.Popin(e)
} else {
return new L.Popin
}
};
L.Popin = L.Class.extend({
includes: L.Evented,
options: {
closeButton: true
},
initialize: function(e) {
if (e) {
L.setOptions(this, e)
}
this._div = L.DomUtil.create("div", "leaflet-popin", this._container);
this._centerDiv = L.DomUtil.create("div", "leaflet-popin-center", this._div);
this._titleDiv = L.DomUtil.create("div", "leaflet-popin-title", this._centerDiv);
this._titleSpan = L.DomUtil.create("span", "leaflet-popin-title", this._titleDiv);
if (this.options.closeButton) this._closeSpan = L.DomUtil.create("span", "leaflet-popin-close", this._titleDiv);
this._contentDiv = L.DomUtil.create("div", "leaflet-popin-content", this._centerDiv);
if (this.options.parentPopin) {
this.options.parentPopinScrollTop = this.options.parentPopin._contentDiv.scrollTop;
this.options.parentPopin.remove();
this._backDiv = L.DomUtil.create("div", "back-to-list", this._contentDiv);
this._backDiv.popin = this;
this._backLink = L.DomUtil.create("a", "back-to-list", this._backDiv);
this._backLink.href = "javascript:void(0);";
if (this.options.backToDisplayText) {
L.DomUtil.create("span", "back-to-list", this._backLink).innerHTML = this.options.backToDisplayText
}
this._backDiv.onclick = function() {
this.popin.options.parentPopin.addTo(this.popin._map);
this.popin.options.parentPopin._contentDiv.scrollTop = this.popin.options.parentPopinScrollTop;
this.popin.remove(true);
this.popin = 0
}
}
this._contentBlurTopDiv = L.DomUtil.create("div", "hidden blur top", this._contentDiv);
this._contentBlurBottomDiv = L.DomUtil.create("div", "hidden blur bottom", this._contentDiv);
this._contentDiv.popin = this;
this._contentDiv.onscroll = function(e) {
this.popin.blurListItems()
};
if (this.options.title) {
this._titleSpan.innerHTML = this.options.title
}
if (this.options.className) {
this.addClass(this.options.className)
}
if (this.options.closeButton) {
this._closeSpan.popin = this;
this._closeSpan.addEventListener("click", function() {
this.popin.remove()
}, false);
this._div.popin = this;
this._div.addEventListener("click", function(e) {
if (e.target === this.popin._div) {
this.popin.remove()
}
})
}
},
remove: function(e) {
this.onRemove(this._map, e);
return this
},
onAdd: function(e) {
this._map = e;
e.getContainer().appendChild(this._div);
e.dragging.disable();
e.touchZoom.disable();
e.doubleClickZoom.disable();
if (e.scrollWheelZoom) e.scrollWheelZoom.disable();
e.boxZoom.disable();
if (e.tap) e.tap.disable();
e.popin = this;
e.on("resize", function() {
this.popin.blurListItems()
});
var t = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (t || 1 == 1) {
window.popin = this;
window.onscroll = function() {
window.popin.blurListItems()
}
}
},
addTo: function(e) {
this.onAdd(e);
return this
},
onRemove: function(e, t) {
if (this.timer) clearInterval(this.timer);
e.getContainer().removeChild(this._div);
if (!this.options.parentPopin || !t) {
e.dragging.enable();
e.touchZoom.enable();
e.doubleClickZoom.enable();
if (e.scrollWheelZoom) e.scrollWheelZoom.enable();
e.boxZoom.enable();
if (e.tap) e.tap.enable()
}
if (this.options.parentPopin) {
window.popin = this.options.parentPopin
}
this._map = null
},
title: "",
getTitle: function() {
return this.title
},
setTitle: function(e) {
if (e && typeof e === "string") {
this.title = e;
this._titleSpan.innerHTML = e
}
},
className: "leaflet-popin",
setClassName: function(e) {
if (e && typeof e === "string") {
this.className = e;
this._div.className = this.className
}
},
addClass: function(e) {
if (e && typeof e === "string") {
this._div.classList.add(e);
this._centerDiv.classList.add(e);
this._titleDiv.classList.add(e);
if (this._closeSpan) this._closeSpan.classList.add(e);
this._contentDiv.classList.add(e)
}
},
removeClass: function(e) {
if (e && typeof e === "string" && this._div.classList.contains(e)) {
this._div.classList.remove(e);
this._centerDiv.classList.remove(e);
this._titleDiv.classList.remove(e);
if (this._closeSpan) this._closeSpan.classList.remove(e);
this._contentDiv.classList.remove(e)
}
},
addContent: function(e) {
try {
this._contentDiv.appendChild(e)
} catch (e) {
console.log(e)
}
this.blurListItems();
return this
},
removeContent: function(e) {
try {
this._contentDiv.removeChild(e)
} catch (e) {
console.log(e)
}
return this
},
clearContent: function(e) {
var t = [];
if (e) {
for (var a = 0; a < this._contentDiv.childNodes.length; ++a) {
if (this._contentDiv.childNodes[a].nodeName.toLowerCase() == e.toLowerCase()) {
t.push(this._contentDiv.childNodes[a])
}
}
} else {
for (var a = 0; a < this._contentDiv.childNodes; ++a) {
t.push(this._contentDiv.childNodes[a])
}
}
for (var i = 0; i < t.length; ++i) {
this.removeContent(t[i])
}
return this
},
blurListItems: function() {
var e = false;
var t = this._contentDiv.querySelectorAll("ul");
for (var a = 0; a < t.length; ++a) {
if (!t[a].classList.contains("hidden")) {
e = true;
break
}
}
var i = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (i) {
this._contentBlurTopDiv.style.position = "fixed";
this._contentBlurBottomDiv.style.position = "fixed"
}
var r = this._contentDiv.getBoundingClientRect();
if (e) {
if (this._contentDiv.scrollTop > 0) {
this._contentBlurTopDiv.classList.remove("hidden");
if (i) this._contentBlurTopDiv.style.top = r.top + "px"
} else {
this._contentBlurTopDiv.classList.add("hidden")
}
if (this._contentDiv.scrollTop + this._contentDiv.clientHeight < this._contentDiv.scrollHeight) {
this._contentBlurBottomDiv.classList.remove("hidden");
if (i) this._contentBlurBottomDiv.style.top = r.bottom - this._contentBlurBottomDiv.clientHeight + "px"
} else {
this._contentBlurBottomDiv.classList.add("hidden")
}
}
}
});
L.menuBar = function(e) {
if (e) {
return new L.MenuBar(e)
} else {
return new L.MenuBar
}
};
L.MenuBar = L.Class.extend({
includes: L.Evented,
options: {
generalInfo: true,
aboutButton: true
},
initialize: function(e) {
if (e) {
L.setOptions(this, e)
}
this._div = L.DomUtil.create("div", this.className, this._container);
if (this.options.sideBar) {
this._burgerMenuDiv = L.DomUtil.create("div", "leaflet-menu-bar-element burger-menu", this._div);
this._burgerMenuLink = L.DomUtil.create("a", "leaflet-menu-bar-element burger-menu", this._burgerMenuDiv);
this._burgerMenuDiv.sideBar = this.options.sideBar;
this._burgerMenuDiv.onclick = function() {
this.parentNode.classList.add("hidden");
this.sideBar.show()
}
}
if (this.options.generalInfo) {
this._generalInfoDiv = L.DomUtil.create("div", "leaflet-menu-bar-element general-info", this._div);
this._title = L.DomUtil.create("h1", "general-info-title", this._generalInfoDiv);
this._subtitle = L.DomUtil.create("p", "general-info-subtitle", this._generalInfoDiv)
}
if (this.options.aboutButton) {
this._aboutDiv = L.DomUtil.create("div", "leaflet-menu-bar-element about", this._div);
this._aboutLink = L.DomUtil.create("a", "leaflet-menu-bar-element about", this._aboutDiv);
this._aboutLink.menuBar = this;
if (this.options.aboutPopinContentFile) {
this.getAboutContent(this.options.aboutPopinContentFile)
}
this._aboutLink.onclick = function() {
if (typeof WT3_AboutPopinContent != "undefined" && this.menuBar._map) {
return L.popin({
title: this.menuBar.options.aboutPopinTitle,
className: "about-popin"
}).addTo(this.menuBar._map).addContent(WT3_AboutPopinContent)
}
}
}
},
remove: function() {
this.onRemove(this._map);
return this
},
onAdd: function(e) {
this._map = e;
this._map.getContainer().appendChild(this._div)
},
addTo: function(e) {
this.onAdd(e);
return this
},
onRemove: function(e) {
e.getContainer().removeChild(this._div)
},
className: "leaflet-control leaflet-bar leaflet-menu-bar",
setClassName: function(e) {
if (e && typeof e === "string") {
this.className = e;
this._div.className = this.className
}
},
addClass: function(e) {
if (e && typeof e === "string") {
this.className += " " + e;
this._div.className = this.className
}
},
removeClass: function(e) {
if (e && typeof e === "string" && this._div.classList.contains(e)) {
this._div.classList.remove(e)
}
},
addContent: function(e, t) {
try {
this._contentDiv.childNodes.splice(t, 0, e)
} catch (e) {
console.log(e)
}
},
setTitle: function(e) {
if (e && typeof e === "string") {
this._title.innerHTML = e
}
},
setSubTitle: function(e) {
if (e && typeof e === "string") {
this._subtitle.innerHTML = e
}
},
getAboutContent: function(e) {
var t = document.createElement("script");
t.src = e;
t.charset = "UTF-8";
t.type = "text/javascript";
t.id = "WT3_MenuBarAboutPopinContent";
t.async = true;
document.body.appendChild(t);
document.body.removeChild(t)
},
setAboutPopinTitle: function(e) {
this.options.aboutPopinTitle = e
}
});
L.sideBar = function(e) {
return new L.SideBar(e)
};
L.SideBar = L.Class.extend({
includes: L.Evented,
options: {
items: []
},
initialize: function(e) {
L.setOptions(this, e);
this._nav = L.DomUtil.create("nav", this.className, this._container);
this._menuDiv = L.DomUtil.create("div", "menu", this._nav);
this._menuDiv.innerHTML = "Menu";
this._menuDiv.sideBar = this;
this._menuDiv.onclick = function() {
this.sideBar.hide()
};
this._list = L.DomUtil.create("ul", this.className, this._nav);
for (var t = 0; t < this.options.items.length; ++t) {
this.addItem(this.options.items[t])
}
},
remove: function() {
this.onRemove(this._map);
return this
},
onAdd: function(e) {
this._map = e;
e.getContainer().appendChild(this._nav);
this.hide()
},
addTo: function(e) {
this.onAdd(e);
return this
},
onRemove: function(e) {
e.getContainer().removeChild(this._nav)
},
className: "leaflet-control leaflet-sidebar",
setClassName: function(e) {
if (e && typeof e === "string") {
this.className = e;
this._nav.className = this.className
}
},
addClass: function(e) {
if (e && typeof e === "string") {
this._nav.classList.add(e)
}
},
removeClass: function(e) {
if (e && typeof e === "string" && this._nav.classList.contains(e)) {
this._nav.classList.remove(e)
}
},
addItem: function(e) {
if (e["displayText"] && e["url"]) {
var t = L.DomUtil.create("li", "leaflet-sidebar-item", this._list);
var a = L.DomUtil.create("a", "leaflet-sidebar-item", t);
a.href = e["url"];
var i = L.DomUtil.create("div", "", a);
i.innerHTML = e["displayText"];
if (e["className"]) t.classList.add(e["className"])
}
},
show: function() {
this.removeClass("hidden")
},
hide: function() {
this.addClass("hidden");
var e = document.getElementsByClassName("leaflet-menu-bar")[0];
if (e) {
e.classList.remove("hidden")
}
}
});
if (typeof window.$ !== "undefined") {
$(document).ready(function() {
//custom override for SFTRF to make them compliant with v3.3
$('link[href="../css/surcharge-infotrafic.css"]').prop("href","https://wt3.autoroutes-trafic.fr/css/sftrf-custom.css");
});
}
// Google tag (gtag.js)
var gaScript = document.createElement('script');
gaScript.async = true;
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-KW8TB3NY9Y';
document.head.appendChild(gaScript);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-KW8TB3NY9Y');
//# sourceMappingURL=webtrafic.js.map