//= require richtext
//= require querystring
-var qs = require("querystring-component");
-
/*
* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
window.updateLinks = function (loc, zoom, layers, object) {
$(".geolink").each(function (index, link) {
- var href = link.href.split(/[?#]/)[0],
- args = qs.parse(link.search.substring(1)),
+ var querystring = require("querystring-component"),
+ href = link.href.split(/[?#]/)[0],
+ args = querystring.parse(link.search.substring(1)),
editlink = $(link).hasClass("editlink");
delete args.node;
args[object.type] = object.id;
}
- var query = qs.stringify(args);
+ var query = querystring.stringify(args);
if (query) href += "?" + query;
args = {
+//= require querystring
+
$(document).ready(function () {
+ var querystring = require("querystring-component");
var id = $("#id-embed");
if (id.data("key")) {
params.gpx = hashParams.gpx;
}
- id.attr("src", id.data("url") + "#" + qs.stringify(params));
+ id.attr("src", id.data("url") + "#" + querystring.stringify(params));
} else {
alert(I18n.t("site.edit.id_not_configured"));
}
//= require index/query
//= require router
//= require bowser
+//= require querystring
$(document).ready(function () {
+ var querystring = require("querystring-component");
+
var loaderTimeout;
var map = new L.OSM.Map("map", {
var iframe = $("<iframe>")
.hide()
.appendTo("body")
- .attr("src", url + qs.stringify(query))
+ .attr("src", url + querystring.stringify(query))
.on("load", function () {
$(this).remove();
loaded = true;
};
page.load = function () {
- var params = qs.parse(location.search.substring(1));
+ var params = querystring.parse(location.search.substring(1));
if (params.query) {
$("#sidebar .search_form input[name=query]").value(params.query);
}
+//= require querystring
+
OSM.initializeContextMenu = function (map) {
+ var querystring = require("querystring-component");
+
map.contextmenu.addItem({
text: I18n.t("javascripts.context.directions_from"),
callback: function directionsFromHere(e) {
lat = latlng.lat.toFixed(precision),
lng = latlng.lng.toFixed(precision);
- OSM.router.route("/directions?" + qs.stringify({
+ OSM.router.route("/directions?" + querystring.stringify({
from: lat + "," + lng,
to: $("#route_to").val()
}));
lat = latlng.lat.toFixed(precision),
lng = latlng.lng.toFixed(precision);
- OSM.router.route("/directions?" + qs.stringify({
+ OSM.router.route("/directions?" + querystring.stringify({
from: $("#route_from").val(),
to: lat + "," + lng
}));
//= require_self
//= require_tree ./directions
+//= require querystring
OSM.Directions = function (map) {
+ var querystring = require("querystring-component");
+
var awaitingGeocode; // true if the user has requested a route, but we're waiting on a geocode result
var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back
var chosenEngine;
var from = endpoints[0].latlng,
to = endpoints[1].latlng;
- OSM.router.route("/directions?" + qs.stringify({
+ OSM.router.route("/directions?" + querystring.stringify({
from: $("#route_to").val(),
to: $("#route_from").val(),
route: to.lat + "," + to.lng + ";" + from.lat + "," + from.lng
var precision = OSM.zoomPrecision(map.getZoom());
- OSM.router.replace("/directions?" + qs.stringify({
+ OSM.router.replace("/directions?" + querystring.stringify({
engine: chosenEngine.id,
route: o.lat.toFixed(precision) + "," + o.lng.toFixed(precision) + ";" +
d.lat.toFixed(precision) + "," + d.lng.toFixed(precision)
getRoute(true, true);
});
- var params = qs.parse(location.search.substring(1)),
+ var params = querystring.parse(location.search.substring(1)),
route = (params.route || "").split(";"),
from = route[0] && L.latLng(route[0].split(",")),
to = route[1] && L.latLng(route[1].split(","));
+//= require querystring
+
OSM.NewNote = function (map) {
+ var querystring = require("querystring-component");
+
var noteLayer = map.noteLayer,
content = $("#sidebar_content"),
page = {},
map.addLayer(noteLayer);
- var params = qs.parse(path.substring(path.indexOf("?") + 1));
+ var params = querystring.parse(path.substring(path.indexOf("?") + 1));
var markerLatlng;
if (params.lat && params.lon) {
//= require jquery.simulate
+//= require querystring
OSM.Query = function (map) {
+ var querystring = require("querystring-component");
+
var url = OSM.OVERPASS_URL,
queryButton = $(".control-query .control-button"),
uninterestingTags = ["source", "source_ref", "source:ref", "history", "attribution", "created_by", "tiger:county", "tiger:tlid", "tiger:upload_uuid", "KSJ2:curve_id", "KSJ2:lat", "KSJ2:lon", "KSJ2:coordinate", "KSJ2:filename", "note:ja"],
};
page.load = function (path, noCentre) {
- var params = qs.parse(path.substring(path.indexOf("?") + 1)),
+ var params = querystring.parse(path.substring(path.indexOf("?") + 1)),
latlng = L.latLng(params.lat, params.lon);
if (!window.location.hash && !noCentre && !map.getBounds().contains(latlng)) {
//= require jquery.simulate
+//= require querystring
OSM.Search = function (map) {
+ var querystring = require("querystring-component");
+
$(".search_form input[name=query]").on("input", function (e) {
if ($(e.target).val() === "") {
$(".describe_location").fadeIn(100);
var page = {};
page.pushstate = page.popstate = function (path) {
- var params = qs.parse(path.substring(path.indexOf("?") + 1));
+ var params = querystring.parse(path.substring(path.indexOf("?") + 1));
$(".search_form input[name=query]").val(params.query);
$(".describe_location").hide();
OSM.loadSidebarContent(path, page.load);
+//= require querystring
+
L.extend(L.LatLngBounds.prototype, {
getSize: function () {
return (this._northEast.lat - this._southWest.lat) *
params.mlon = latLng.lng.toFixed(precision);
}
- var url = window.location.protocol + "//" + OSM.SERVER_URL + "/",
- query = qs.stringify(params),
+ var querystring = require("querystring-component"),
+ url = window.location.protocol + "//" + OSM.SERVER_URL + "/",
+ query = querystring.stringify(params),
hash = OSM.formatHash(this);
if (query) url += "?" + query;
params[this._object.type] = this._object.id;
}
- var query = qs.stringify(params);
+ var querystring = require("querystring-component"),
+ query = querystring.stringify(params);
if (query) {
str += "?" + query;
}
+//= querystring
+
$(document).ready(function () {
+ var querystring = require("querystring-component");
+
// Preserve location hash in referer
if (window.location.hash) {
$("#referer").val($("#referer").val() + window.location.hash);
// Attach referer to authentication buttons
$(".auth_button").each(function () {
- var params = qs.parse(this.search.substring(1));
+ var params = querystring.parse(this.search.substring(1));
params.referer = $("#referer").val();
- this.search = qs.stringify(params);
+ this.search = querystring.stringify(params);
});
// Add click handler to show OpenID field
if (referer) {
args.referer = referer;
}
- window.location = action + "?" + qs.stringify(args);
+ window.location = action + "?" + querystring.stringify(args);
return false;
});
});
//= depend_on settings.yml
//= depend_on settings.local.yml
+//= require querystring
OSM = {
<% if defined?(PIWIK) %>
},
parseHash: function(hash) {
- var args = {};
+ var querystring = require("querystring-component"),
+ args = {};
var i = hash.indexOf('#');
if (i < 0) {
return args;
}
- hash = qs.parse(hash.substr(i + 1));
+ hash = querystring.parse(hash.substr(i + 1));
var map = (hash.map || '').split('/'),
zoom = parseInt(map[0], 10),
"L": "readonly",
"OSM": "writable",
"Piwik": "readonly",
- "querystring": "readonly",
"require": "readonly",
"updateLinks": "readonly"
},