From 44a990083f70eb5af835e7c5089e87b742ef77c8 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Thu, 4 Feb 2016 13:00:17 +0100 Subject: [PATCH] map: allow rename of topic in map popups --- docroot/last/config.js | 9 +++++++++ docroot/last/config.js.sample | 9 +++++++++ docroot/last/functions.js | 5 ++++- docroot/last/index.html | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 docroot/last/config.js create mode 100644 docroot/last/config.js.sample diff --git a/docroot/last/config.js b/docroot/last/config.js new file mode 100644 index 0000000..f383fd8 --- /dev/null +++ b/docroot/last/config.js @@ -0,0 +1,9 @@ + +/* + * Optionally rename the topic in the location popup on the map + */ + +var renames = { + 'owntracks/jjolie/phone' : 'Jane Jolie', + 'owntracks/john/android' : "John Smith", +}; diff --git a/docroot/last/config.js.sample b/docroot/last/config.js.sample new file mode 100644 index 0000000..f383fd8 --- /dev/null +++ b/docroot/last/config.js.sample @@ -0,0 +1,9 @@ + +/* + * Optionally rename the topic in the location popup on the map + */ + +var renames = { + 'owntracks/jjolie/phone' : 'Jane Jolie', + 'owntracks/john/android' : "John Smith", +}; diff --git a/docroot/last/functions.js b/docroot/last/functions.js index 55f9f1d..0bb942f 100644 --- a/docroot/last/functions.js +++ b/docroot/last/functions.js @@ -129,8 +129,11 @@ function map_marker(loc) var dt = moment.utc(loc.tst * 1000).local(); + var userdev = username + "/" + device; + userdev = renames[userdev] ? renames[userdev] : userdev; + var data = { - userdev: username + "/" + device, + userdev: userdev, ghash: loc.ghash ? loc.ghash : 'unknown', addr: loc.addr, lat: loc.lat, diff --git a/docroot/last/index.html b/docroot/last/index.html index 2a23046..a2227b0 100644 --- a/docroot/last/index.html +++ b/docroot/last/index.html @@ -31,6 +31,7 @@ +