Format name and creator

This commit is contained in:
Norbert Renner 2021-03-19 12:22:20 +01:00
parent da9ffd9224
commit 265583e0c5
6 changed files with 12 additions and 4 deletions

View file

@ -286,6 +286,7 @@ gulp.task('bump:html', function () {
return gulp
.src('./index.html')
.pipe(replace(/<sup class="version">(.*)<\/sup>/, '<sup class="version">' + pkg.version + '</sup>'))
.pipe(replace(/BR.version = '(.*?)';/, "BR.version = '" + pkg.version + "';"))
.pipe(gulp.dest('.'));
});

View file

@ -1143,6 +1143,7 @@
<script>
// global package prefix for BRouter web application
BR = {};
BR.version = '0.15.1';
console.log(
'\r\n###\r\n### BRouter-Web\r\n###\r\n### Please note that the routing API used here is not public!\r\n###\r\n'

View file

@ -46,13 +46,14 @@ BR.Export = L.Class.extend({
_export: function (e) {
var exportForm = document.forms['export'];
var format = exportForm['format'].value || $('#export-format input:radio:checked').val();
var name = encodeURIComponent(exportForm['trackname'].value);
var name = exportForm['trackname'].value;
var nameUri = encodeURIComponent(name);
var includeWaypoints = exportForm['include-waypoints'].checked;
e.preventDefault();
if (true) {
var uri = this.router.getUrl(this.latLngs, this.pois.getMarkers(), null, format, name, includeWaypoints);
var uri = this.router.getUrl(this.latLngs, this.pois.getMarkers(), null, format, nameUri, includeWaypoints);
// var evt = document.createEvent('MouseEvents');
// evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
@ -69,6 +70,9 @@ BR.Export = L.Class.extend({
_formatTrack: function (format, name, includeWaypoints) {
const track = BR.Export._concatTotalTrack(this.segments);
if (name) {
track.features[0].properties.name = name;
}
this._addPois(track);
if (includeWaypoints) {
this._addRouteWaypoints(track);

View file

@ -49,6 +49,7 @@ BR.Gpx = {
const gpxTransform = new GpxTransform(voiceHintsTransform);
let gpx = togpx(geoJson, {
creator: 'BRouter-Web ' + BR.version,
featureTitle: function () {},
featureDescription: function () {},
featureCoordTimes: function () {},

View file

@ -95,7 +95,7 @@ BR.Diff.diffPrettyHtml = function (diffs, contextLen = 2) {
// TODO remove
// copied from Gpx.test.js
BR.Diff.adoptGpx = function (gpx, replaceCreator = true) {
const creator = 'togpx';
const creator = 'BRouter-Web 0.15.1';
const name = 'Track';
const newline = '\n';

View file

@ -1,4 +1,5 @@
BR = {};
BR.version = '1.5.1';
turf = require('@turf/turf');
togpx = require('togpx');
require('leaflet');
@ -15,7 +16,7 @@ const path = 'tests/format/data/';
// resolve intended/accepted differences before comparing
function adoptGpx(gpx, replaceCreator = true) {
const creator = 'togpx';
const creator = 'BRouter-Web 1.5.1';
const name = 'Track';
const newline = '\n';