Switch to using js-cookie to manage cookies from javascript
This commit is contained in:
parent
84abb70f17
commit
32cc04fa5c
6 changed files with 15 additions and 15 deletions
|
@ -1,8 +1,8 @@
|
|||
//= require jquery3
|
||||
//= require jquery_ujs
|
||||
//= require jquery.timers
|
||||
//= require jquery.cookie/jquery.cookie
|
||||
//= require jquery.throttle-debounce
|
||||
//= require js-cookie/src/js.cookie
|
||||
//= require popper
|
||||
//= require bootstrap-sprockets
|
||||
//= require osm
|
||||
|
|
|
@ -188,17 +188,17 @@ $(document).ready(function () {
|
|||
map.getLayersCode(),
|
||||
map._object);
|
||||
|
||||
$.removeCookie("_osm_location");
|
||||
$.cookie("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/" });
|
||||
Cookies.remove("_osm_location");
|
||||
Cookies.set("_osm_location", OSM.locationCookie(map), { secure: true, expires: expiry, path: "/" });
|
||||
});
|
||||
|
||||
if ($.cookie("_osm_welcome") !== "hide") {
|
||||
if (Cookies.get("_osm_welcome") !== "hide") {
|
||||
$(".welcome").addClass("visible");
|
||||
}
|
||||
|
||||
$(".welcome .close").on("click", function () {
|
||||
$(".welcome").removeClass("visible");
|
||||
$.cookie("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/" });
|
||||
Cookies.set("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/" });
|
||||
});
|
||||
|
||||
var bannerExpiry = new Date();
|
||||
|
@ -209,7 +209,7 @@ $(document).ready(function () {
|
|||
$("#banner").hide();
|
||||
e.preventDefault();
|
||||
if (cookieId) {
|
||||
$.cookie(cookieId, "hide", { secure: true, expires: bannerExpiry, path: "/" });
|
||||
Cookies.set(cookieId, "hide", { secure: true, expires: bannerExpiry, path: "/" });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -327,14 +327,14 @@ OSM.Directions = function (map) {
|
|||
}
|
||||
|
||||
var chosenEngineIndex = findEngine("fossgis_osrm_car");
|
||||
if ($.cookie("_osm_directions_engine")) {
|
||||
chosenEngineIndex = findEngine($.cookie("_osm_directions_engine"));
|
||||
if (Cookies.get("_osm_directions_engine")) {
|
||||
chosenEngineIndex = findEngine(Cookies.get("_osm_directions_engine"));
|
||||
}
|
||||
setEngine(chosenEngineIndex);
|
||||
|
||||
select.on("change", function (e) {
|
||||
chosenEngine = engines[e.target.selectedIndex];
|
||||
$.cookie("_osm_directions_engine", chosenEngine.id, { secure: true, expires: expiry, path: "/" });
|
||||
Cookies.set("_osm_directions_engine", chosenEngine.id, { secure: true, expires: expiry, path: "/" });
|
||||
getRoute(true, true);
|
||||
});
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ OSM = {
|
|||
mapParams.lon = parseFloat(params.mlon);
|
||||
mapParams.lat = parseFloat(params.mlat);
|
||||
mapParams.zoom = parseInt(params.zoom || 12);
|
||||
} else if (loc = $.cookie('_osm_location')) {
|
||||
} else if (loc = Cookies.get('_osm_location')) {
|
||||
loc = loc.split("|");
|
||||
mapParams.lon = parseFloat(loc[0]);
|
||||
mapParams.lat = parseFloat(loc[1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue