Increase prettier maxwidth to 120

This commit is contained in:
Gautier Pelloux-Prayer 2019-08-07 18:21:49 +02:00 committed by Gautier P
parent ce9e34283b
commit d31be926d2
27 changed files with 248 additions and 956 deletions

View file

@ -1,4 +1,5 @@
{
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
}

View file

@ -256,13 +256,11 @@ https://css-tricks.com/svg-line-animation-works/
width: 8px;
margin-left: 1px;
background-image: linear-gradient(to right, #f0f0f0 0%, #e9e9e9 100%);
box-shadow: inset -1px -0px 1px rgba(55, 55, 55, 0.3),
inset 1px 0px 1px rgba(230, 230, 230, 1);
box-shadow: inset -1px -0px 1px rgba(55, 55, 55, 0.3), inset 1px 0px 1px rgba(230, 230, 230, 1);
}
.slider.slider-horizontal .slider-track {
background-image: linear-gradient(to bottom, #f0f0f0 0%, #e9e9e9 100%);
box-shadow: inset -0px -1px 1px rgba(55, 55, 55, 0.3),
inset 0px 1px 1px rgba(230, 230, 230, 1);
box-shadow: inset -0px -1px 1px rgba(55, 55, 55, 0.3), inset 0px 1px 1px rgba(230, 230, 230, 1);
}
.control-slider:hover #route .slider-track,
@ -291,8 +289,7 @@ https://css-tricks.com/svg-line-animation-works/
/* bootstrap .btn-secondary */
background-image: linear-gradient(to bottom, #fff 0, #e0e0e0 100%);
background-repeat: repeat-x;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),
0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
border: 1px solid #adadad;
}
@ -467,8 +464,7 @@ table.dataTable.display tbody tr.even:hover {
}
.tree-code {
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console,
monospace;
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
margin-right: 7px;
color: #666; /* like root nodes, jstree-disabled */
}
@ -497,8 +493,7 @@ table.dataTable.display tbody tr.even:hover {
border: 1px solid #ddd;
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console,
monospace;
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
line-height: 1.2em;
}

View file

@ -30,9 +30,7 @@ var debug = false;
var paths = {
// see overrides in package.json
scriptsConfig: mainNpmFiles().filter(f =>
RegExp('url-search-params/.*\\.js', 'i').test(f)
),
scriptsConfig: mainNpmFiles().filter(f => RegExp('url-search-params/.*\\.js', 'i').test(f)),
scripts: [
'node_modules/jquery/dist/jquery.js',
'node_modules/tether/dist/js/tether.js',
@ -58,18 +56,10 @@ var paths = {
'js/index.js'
]),
styles: mainNpmFiles()
.filter(
f =>
RegExp('.*\\.css', 'i').test(f) &&
!RegExp('.*\\.min\\.css', 'i').test(f)
)
.filter(f => RegExp('.*\\.css', 'i').test(f) && !RegExp('.*\\.min\\.css', 'i').test(f))
.concat('css/*.css'),
images: mainNpmFiles().filter(f =>
RegExp('.*.+(png|gif|svg)', 'i').test(f)
),
fonts: mainNpmFiles().filter(f =>
RegExp('font-awesome/fonts/.*', 'i').test(f)
),
images: mainNpmFiles().filter(f => RegExp('.*.+(png|gif|svg)', 'i').test(f)),
fonts: mainNpmFiles().filter(f => RegExp('font-awesome/fonts/.*', 'i').test(f)),
locales: 'locales/*.json',
layers: 'layers/**/*.geojson',
layersDestName: 'layers.js',
@ -195,9 +185,7 @@ gulp.task('inject', function() {
read: false
});
return target
.pipe(inject(sources, { relative: true }))
.pipe(gulp.dest('.'));
return target.pipe(inject(sources, { relative: true })).pipe(gulp.dest('.'));
});
var pkg = require('./package.json');
@ -215,9 +203,7 @@ gulp.task('release:init', function(cb) {
}
ghToken = gutil.env.token;
if (!ghToken) {
return cb(
new Error('--token is required (github personnal access token')
);
return cb(new Error('--token is required (github personnal access token'));
}
if (ghToken.length != 40) {
return cb(new Error('--token length must be 40'));
@ -228,11 +214,7 @@ gulp.task('release:init', function(cb) {
git.status({ args: '--porcelain', quiet: true }, function(err, stdout) {
if (err) return cb(err);
if (stdout.length > 0) {
return cb(
new Error(
'Repository is not clean. Please commit or stash your pending modification'
)
);
return cb(new Error('Repository is not clean. Please commit or stash your pending modification'));
}
cb();
@ -250,21 +232,14 @@ gulp.task('bump:json', function() {
gulp.task('bump:html', function() {
return gulp
.src('./index.html')
.pipe(
replace(
/<sup class="version">(.*)<\/sup>/,
'<sup class="version">' + nextVersion + '</sup>'
)
)
.pipe(replace(/<sup class="version">(.*)<\/sup>/, '<sup class="version">' + nextVersion + '</sup>'))
.pipe(gulp.dest('.'));
});
gulp.task('bump', gulp.series('bump:json', 'bump:html'));
gulp.task('release:commit', function() {
return gulp
.src(['./index.html', './package.json'])
.pipe(git.commit('release: ' + nextVersion));
return gulp.src(['./index.html', './package.json']).pipe(git.commit('release: ' + nextVersion));
});
gulp.task('release:tag', function(cb) {
@ -277,12 +252,7 @@ gulp.task('release:push', function(cb) {
gulp.task('i18next', function() {
return gulp
.src([
'index.html',
'locales/keys.js',
'layers/config/overrides.js',
'js/**/*.js'
])
.src(['index.html', 'locales/keys.js', 'layers/config/overrides.js', 'js/**/*.js'])
.pipe(sort())
.pipe(
scanner({
@ -321,12 +291,7 @@ gulp.task('layers', function() {
'// Licensed under the MIT License (https://github.com/nrenner/brouter-web#license + Credits and Licenses),\n' +
'// except JOSM imagery database (dataSource=JOSM) is licensed under Creative Commons (CC-BY-SA),\n' +
'// see https://josm.openstreetmap.de/wiki/Maps#Otherimportantinformation\n';
return Buffer.from(
header +
'BR.layerIndex = ' +
JSON.stringify(data, null, 2) +
';'
);
return Buffer.from(header + 'BR.layerIndex = ' + JSON.stringify(data, null, 2) + ';');
})
)
.pipe(gulp.dest(paths.dest))
@ -335,17 +300,7 @@ gulp.task('layers', function() {
gulp.task(
'default',
gulp.series(
'clean',
'scripts_config',
'layers_config',
'layers',
'scripts',
'styles',
'images',
'fonts',
'locales'
)
gulp.series('clean', 'scripts_config', 'layers_config', 'layers', 'scripts', 'styles', 'images', 'fonts', 'locales')
);
gulp.task(
@ -359,12 +314,9 @@ gulp.task(
gulp.task('release:zip', function() {
gutil.log(gutil.colors.green('Build brouter-web.' + nextVersion + '.zip'));
return gulp
.src(
['dist/**', 'index.html', 'config.template.js', 'keys.template.js'],
{
.src(['dist/**', 'index.html', 'config.template.js', 'keys.template.js'], {
base: '.'
}
)
})
.pipe(zip('brouter-web.' + nextVersion + '.zip'))
.pipe(gulp.dest('.'));
});

View file

@ -3,10 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title data-i18n="title">BRouter web client</title>
@ -27,32 +24,16 @@
>
<span class="fa fa-bars"></span>
</button>
<a
class="navbar-brand order-md-last"
href="#"
data-toggle="modal"
data-target="#about"
<a class="navbar-brand order-md-last" href="#" data-toggle="modal" data-target="#about"
>BRouter-Web <sup class="version">0.10.3</sup></a
>
<div class="collapse navbar-collapse" id="collapsingNavbar">
<div class="navbar-nav">
<form class="form-inline">
<div class="form-group">
<select
class="selectpicker show-tick"
data-width="250px"
id="profile-alternative"
multiple
>
<optgroup
label="Profile"
data-max-options="1"
data-icon="fa-bicycle"
id="profile"
>
<option data-i18n="navbar.profile.custom"
>Custom
</option>
<select class="selectpicker show-tick" data-width="250px" id="profile-alternative" multiple>
<optgroup label="Profile" data-max-options="1" data-icon="fa-bicycle" id="profile">
<option data-i18n="navbar.profile.custom">Custom </option>
</optgroup>
<optgroup
label="Alternative"
@ -60,27 +41,12 @@
data-icon="fa-random"
id="alternative"
>
<option
data-i18n="navbar.alternative.original"
value="0"
selected
<option data-i18n="navbar.alternative.original" value="0" selected
>Original
</option>
<option
data-i18n="navbar.alternative.first"
value="1"
>1st alternative
</option>
<option
data-i18n="navbar.alternative.second"
value="2"
>2nd alternative
</option>
<option
data-i18n="navbar.alternative.third"
value="3"
>3rd alternative
</option>
<option data-i18n="navbar.alternative.first" value="1">1st alternative </option>
<option data-i18n="navbar.alternative.second" value="2">2nd alternative </option>
<option data-i18n="navbar.alternative.third" value="3">3rd alternative </option>
</optgroup>
</select>
</div>
@ -96,11 +62,7 @@
aria-haspopup="true"
aria-expanded="false"
>
<span
class="fa fa-lg fa-cloud-download"
aria-hidden="true"
>
</span>
<span class="fa fa-lg fa-cloud-download" aria-hidden="true"> </span>
<span data-i18n="navbar.export">Export</span>
</a>
</div>
@ -115,17 +77,10 @@
aria-haspopup="true"
aria-expanded="false"
>
<span
class="fa fa-lg fa-cloud-upload"
aria-hidden="true"
>
</span>
<span class="fa fa-lg fa-cloud-upload" aria-hidden="true"> </span>
<span data-i18n="navbar.load.title">Load</span>
</a>
<div
class="dropdown-menu"
aria-labelledby="navbarLoadDropdown"
>
<div class="dropdown-menu" aria-labelledby="navbarLoadDropdown">
<a
class="dropdown-item"
data-i18n="navbar.load.nogos"
@ -137,15 +92,8 @@
</div>
</div>
<div class="nav-item">
<a
class="nav-link"
href="#"
data-toggle="modal"
data-target="#about"
><span
class="fa fa-lg fa-info-circle"
aria-hidden="true"
></span
<a class="nav-link" href="#" data-toggle="modal" data-target="#about"
><span class="fa fa-lg fa-info-circle" aria-hidden="true"></span
><span data-i18n="navbar.about">About</span></a
>
</div>
@ -166,12 +114,7 @@
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" data-i18n="credits">Credits</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@ -179,35 +122,21 @@
<dl>
<dt data-i18n="credits.brouter">BRouter</dt>
<dd data-i18n="[html]credits.brouter-license">
<a
target="_blank"
href="http://brouter.de/brouter"
>BRouter</a
>
<a target="_blank" href="http://brouter.de/brouter">BRouter</a>
&copy; Arndt Brenschede
</dd>
<dt data-i18n="credits.map-data">Map data</dt>
<dd data-i18n="[html]credits.openstreetmap">
&copy;
<a
target="_blank"
href="https://www.openstreetmap.org/copyright"
<a target="_blank" href="https://www.openstreetmap.org/copyright"
>OpenStreetMap contributors</a
>
under
<a
target="_blank"
href="https://opendatacommons.org/licenses/odbl/"
>ODbL</a
>
<a target="_blank" href="https://opendatacommons.org/licenses/odbl/">ODbL</a>
</dd>
<dd data-i18n="[html]credits.nominatim">
Search by
<a
href="https://wiki.openstreetmap.org/wiki/Nominatim"
target="_blank"
>Nominatim</a
>
<a href="https://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim</a>
</dd>
</dl>
<h5 data-i18n="credits.map-tiles">Map tiles</h5>
@ -232,12 +161,7 @@
<h4 class="modal-title" data-i18n="layers.customize">
Customize layers
</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@ -306,72 +230,43 @@
<h4 class="modal-title" data-i18n="about.title">
About
</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p data-i18n="[html]about.description">
Online service of the BRouter routing engine. For
the offline Android app and more information see
<a href="http://brouter.de/" target="_blank"
>brouter.de</a
>.
Online service of the BRouter routing engine. For the offline Android app and more
information see
<a href="http://brouter.de/" target="_blank">brouter.de</a>.
</p>
<p><i data-i18n="about.contact">Contact:</i><br /></p>
<ul>
<li>
<a
href="https://groups.google.com/group/osm-android-bikerouting"
target="_blank"
><span data-i18n="about.support"
>General discussions/questions,
support</span
></a
<a href="https://groups.google.com/group/osm-android-bikerouting" target="_blank"
><span data-i18n="about.support">General discussions/questions, support</span></a
>
</li>
<li>
<a
href="https://webchat.oftc.net/?channels=#brouter"
target="_blank"
><span data-i18n="about.chat"
>Chat with users and developers</span
></a
<a href="https://webchat.oftc.net/?channels=#brouter" target="_blank"
><span data-i18n="about.chat">Chat with users and developers</span></a
>
</li>
<li>
<span data-i18n="about.bug-reports"
>Bug reports and feature requests:</span
>
<span data-i18n="about.bug-reports">Bug reports and feature requests:</span>
<ul>
<li>
<a
href="https://github.com/abrensch/brouter/issues"
target="_blank"
>
<span
data-i18n="about.bug-reports-back"
>server/backend, routing engine,
Android app, profiles,
brouter.de site</span
<a href="https://github.com/abrensch/brouter/issues" target="_blank">
<span data-i18n="about.bug-reports-back"
>server/backend, routing engine, Android app, profiles, brouter.de
site</span
>
</a>
</li>
<li>
<a
href="https://github.com/nrenner/brouter-web/issues"
target="_blank"
>
<span
data-i18n="about.bug-reports-front"
>web client/frontend.</span
>
<a href="https://github.com/nrenner/brouter-web/issues" target="_blank">
<span data-i18n="about.bug-reports-front">web client/frontend.</span>
</a>
</li>
</ul>
@ -383,30 +278,15 @@
<div data-i18n="[html]about.data-description">
This is based on
<a
href="https://www.openstreetmap.org"
target="_blank"
>OpenStreetMap</a
>. It is usually updated once a week when a new
Planet file is available, see dates of
<a
href="http://brouter.de/brouter/segments4/"
target="_blank"
>data files</a
>.
<a href="https://www.openstreetmap.org" target="_blank">OpenStreetMap</a>. It is usually
updated once a week when a new Planet file is available, see dates of
<a href="http://brouter.de/brouter/segments4/" target="_blank">data files</a>.
</div>
<p data-i18n="[html]about.details">
<i
><a
href="http://brouter.de/privacypolicy.html"
target="_blank"
>Privacy Policy</a
></i
<i><a href="http://brouter.de/privacypolicy.html" target="_blank">Privacy Policy</a></i
>,
<i
><a
href="https://github.com/nrenner/brouter-web#credits-and-licenses"
target="_blank"
><a href="https://github.com/nrenner/brouter-web#credits-and-licenses" target="_blank"
>Credits</a
></i
>,
@ -418,13 +298,7 @@
></i
>
and
<i
><a
href="https://github.com/nrenner/brouter-web#readme"
target="_blank"
>more info</a
></i
>
<i><a href="https://github.com/nrenner/brouter-web#readme" target="_blank">more info</a></i>
on the client.
</p>
</div>
@ -447,49 +321,23 @@
<h4 class="modal-title" data-i18n="loadNogos.title">
Load no-go areas
</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p
id="nogoError"
class="invalid-feedback"
style="display: none;"
></p>
<p id="nogoError" class="invalid-feedback" style="display: none;"></p>
<form>
<fieldset>
<legend data-i18n="loadNogos.source">
Source
</legend>
<p>
<label
for="nogoURL"
data-i18n="loadNogos.url"
>URL:
</label>
<input
type="text"
name="nogoURL"
id="nogoURL"
/><br />
<label for="nogoURL" data-i18n="loadNogos.url">URL: </label>
<input type="text" name="nogoURL" id="nogoURL" /><br />
or<br />
<label
for="nogoFile"
data-i18n="loadNogos.file"
>File (.geojson):
</label>
<input
type="file"
accept=".geojson"
name="nogoFile"
id="nogoFile"
/>
<label for="nogoFile" data-i18n="loadNogos.file">File (.geojson): </label>
<input type="file" accept=".geojson" name="nogoFile" id="nogoFile" />
</p>
</fieldset>
<fieldset>
@ -497,46 +345,22 @@
Default properties
</legend>
<p>
<label
for="nogoWeight"
data-i18n="loadNogos.nogoWeight"
<label for="nogoWeight" data-i18n="loadNogos.nogoWeight"
>No-go weight (-1 means impassable):
</label>
<input
type="number"
name="nogoWeight"
id="nogoWeight"
value="-1"
min="-1"
/>
<input type="number" name="nogoWeight" id="nogoWeight" value="-1" min="-1" />
</p>
<p>
<label
for="nogoRadius"
data-i18n="loadNogos.nogoRadius"
<label for="nogoRadius" data-i18n="loadNogos.nogoRadius"
>No-go radius for points (in meters):
</label>
<input
type="number"
name="nogoRadius"
id="nogoRadius"
value="20"
min="0"
/>
<input type="number" name="nogoRadius" id="nogoRadius" value="20" min="0" />
</p>
<p>
<label
for="nogoBuffer"
data-i18n="loadNogos.nogoBuffer"
<label for="nogoBuffer" data-i18n="loadNogos.nogoBuffer"
>Buffer no-go areas (in meters):
</label>
<input
type="number"
name="nogoBuffer"
id="nogoBuffer"
value="0"
min="0"
/>
<input type="number" name="nogoBuffer" id="nogoBuffer" value="0" min="0" />
</p>
</fieldset>
<div class="modal-footer">
@ -579,41 +403,22 @@
<h4 class="modal-title" data-i18n="export.title">
Export route
</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form name="export">
<div class="form-group row">
<label
class="col-form-label col-sm-2"
data-i18n="export.trackname"
>Name</label
>
<label class="col-form-label col-sm-2" data-i18n="export.trackname">Name</label>
<div class="col-sm-10">
<input
type="text"
class="form-control"
id="trackname"
/>
<span
id="trackname-message"
class="validation-warning"
></span>
<input type="text" class="form-control" id="trackname" />
<span id="trackname-message" class="validation-warning"></span>
</div>
</div>
<fieldset id="export-format" class="form-group">
<div class="row">
<legend
class="col-form-label col-sm-2"
data-i18n="export.format"
>
<legend class="col-form-label col-sm-2" data-i18n="export.format">
Format
</legend>
<div class="col-sm-10">
@ -627,17 +432,11 @@
value="gpx"
checked
/>
<span
data-i18n="export.format_gpx"
>GPX</span
>
<span data-i18n="export.format_gpx">GPX</span>
</label>
</div>
<div class="form-check">
<label
class="form-check-label"
for="format-kml"
>
<label class="form-check-label" for="format-kml">
<input
class="form-check-input"
id="format-kml"
@ -645,17 +444,11 @@
name="format"
value="kml"
/>
<span
data-i18n="export.format_kml"
>KML</span
>
<span data-i18n="export.format_kml">KML</span>
</label>
</div>
<div class="form-check">
<label
class="form-check-label"
for="format-geojson"
>
<label class="form-check-label" for="format-geojson">
<input
class="form-check-input"
id="format-geojson"
@ -663,17 +456,11 @@
name="format"
value="geojson"
/>
<span
data-i18n="export.format_geojson"
>GeoJSON</span
>
<span data-i18n="export.format_geojson">GeoJSON</span>
</label>
</div>
<div class="form-check">
<label
class="form-check-label"
for="format-csv"
>
<label class="form-check-label" for="format-csv">
<input
class="form-check-input"
id="format-csv"
@ -681,10 +468,7 @@
name="format"
value="csv"
/>
<span
data-i18n="export.format_csv"
>CSV</span
>
<span data-i18n="export.format_csv">CSV</span>
</label>
</div>
</div>
@ -692,10 +476,7 @@
</fieldset>
<fieldset id="export-includes" class="form-group">
<div class="row">
<legend
class="col-form-label col-sm-2"
data-i18n="export.include"
>
<legend class="col-form-label col-sm-2" data-i18n="export.include">
Include
</legend>
<div class="col-sm-10">
@ -707,10 +488,7 @@
type="checkbox"
name="include-waypoints"
/>
<span
data-i18n="export.include_waypoints"
>Waypoints</span
>
<span data-i18n="export.include_waypoints">Waypoints</span>
</label>
</div>
</div>
@ -744,12 +522,7 @@
<div id="sidebarTabs" class="leaflet-sidebar-tabs collapsed">
<ul role="tablist">
<li>
<a
href="#tab_layers_control"
role="tab"
data-i18n="[title]sidebar.layers.title"
title="Layers"
>
<a href="#tab_layers_control" role="tab" data-i18n="[title]sidebar.layers.title" title="Layers">
<!--
https://github.com/feathericons/feather/blob/0dc2bf5c9d01759e47485d9498aefc02cac1d845/icons/layers.svg
MIT License: https://github.com/feathericons/feather/blob/master/LICENSE
@ -766,23 +539,14 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<polygon
style="fill: currentColor"
points="12 2 2 7 12 12 22 7 12 2"
></polygon>
<polyline
points="2 11.5 12 16.5 22 11.5"
></polyline>
<polygon style="fill: currentColor" points="12 2 2 7 12 12 22 7 12 2"></polygon>
<polyline points="2 11.5 12 16.5 22 11.5"></polyline>
<polyline points="2 16 12 21 22 16"></polyline>
</svg>
</a>
</li>
<li hidden>
<a
href="#tab_itinerary"
role="tab"
data-i18n="[title]sidebar.itinerary.title"
title="Itinerary"
<a href="#tab_itinerary" role="tab" data-i18n="[title]sidebar.itinerary.title" title="Itinerary"
><i class="fa fa-map-signs"></i
></a>
</li>
@ -796,11 +560,7 @@
></a>
</li>
<li>
<a
href="#tab_data"
role="tab"
data-i18n="[title]sidebar.data.title"
title="Data"
<a href="#tab_data" role="tab" data-i18n="[title]sidebar.data.title" title="Data"
><i class="fa fa-table"></i
></a>
</li>
@ -814,18 +574,11 @@
<div id="sidebar" class="leaflet-sidebar collapsed">
<div class="leaflet-sidebar-content">
<div
class="leaflet-sidebar-pane"
id="tab_layers_control"
>
<div class="leaflet-sidebar-pane" id="tab_layers_control">
<h1 class="leaflet-sidebar-header">
<span class="leaflet-sidebar-close"
><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"
><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.layers.title"
>Layers</span
>
<span class="leaflet-sidebar-close"><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.layers.title">Layers</span>
</h1>
<div id="layers-control-wrapper"></div>
<div class="leaflet-control-layers-separator"></div>
@ -846,9 +599,7 @@
data-i18n="[title]sidebar.layers.expand"
title="Expand all"
>
<span
class="fa fa-plus-square-o"
></span>
<span class="fa fa-plus-square-o"></span>
</button>
<button
type="button"
@ -857,9 +608,7 @@
data-i18n="[title]sidebar.layers.collapse"
title="Collapse all"
>
<span
class="fa fa-minus-square-o"
></span>
<span class="fa fa-minus-square-o"></span>
</button>
</div>
<!-- empty dummy to keep following buttons right-aligned when previous hidden -->
@ -873,10 +622,7 @@
title="Add or remove optional layers"
>
<span class="fa fa-cogs"></span>
<span
data-i18n="sidebar.layers.optional-layers"
>More</span
>
<span data-i18n="sidebar.layers.optional-layers">More</span>
</button>
<button
type="button"
@ -886,10 +632,7 @@
title="Add or remove custom layers"
>
<span class="fa fa-plus-square"></span>
<span
data-i18n="sidebar.layers.custom-layers"
>Custom layers</span
>
<span data-i18n="sidebar.layers.custom-layers">Custom layers</span>
</button>
</div>
</div>
@ -898,13 +641,9 @@
<div class="leaflet-sidebar-pane" id="tab_profile">
<h1 class="leaflet-sidebar-header">
<span class="leaflet-sidebar-close"
><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"
><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.custom-profile.title"
>Custom profile</span
>
<span class="leaflet-sidebar-close"><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.custom-profile.title">Custom profile</span>
</h1>
<form class="flexcolumn flexgrow">
<textarea
@ -924,28 +663,18 @@
data-uploading-text="Uploading…"
>
<span class="fa fa-cloud-upload"></span>
<span data-i18n="sidebar.profile.upload"
>Upload</span
>
<span data-i18n="sidebar.profile.upload">Upload</span>
</button>
<button
id="clear"
type="button"
class="btn btn-secondary btn-sm"
>
<button id="clear" type="button" class="btn btn-secondary btn-sm">
<span class="fa fa-eraser"></span>
<span data-i18n="sidebar.profile.clear"
>Clear</span
>
<span data-i18n="sidebar.profile.clear">Clear</span>
</button>
<a
href="http://brouter.de/brouter/costfunctions.html"
target="_blank"
class="btn btn-info btn-sm pull-right"
><span class="fa fa-question"></span>
<span data-i18n="sidebar.profile.help"
>Help</span
></a
<span data-i18n="sidebar.profile.help">Help</span></a
>
</div>
</form>
@ -953,34 +682,20 @@
<div class="leaflet-sidebar-pane" id="tab_data">
<h1 class="leaflet-sidebar-header">
<span class="leaflet-sidebar-close"
><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"
><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.data.title"
>Data</span
>
<span class="leaflet-sidebar-close"><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"><i class="fa fa-expand"></i></span
><span data-i18n="sidebar.data.title">Data</span>
</h1>
<table
id="datatable"
class="mini cell-border hover stripe"
></table>
<table id="datatable" class="mini cell-border hover stripe"></table>
</div>
<div class="leaflet-sidebar-pane" id="tab_itinerary">
<h1 class="leaflet-sidebar-header">
<span data-i18n="sidebar.itinerary.title"
>Itinerary</span
><span class="leaflet-sidebar-close"
><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"
><i class="fa fa-expand"></i
></span>
<span data-i18n="sidebar.itinerary.title">Itinerary</span
><span class="leaflet-sidebar-close"><i class="fa fa-caret-right"></i></span
><span class="leaflet-sidebar-expand"><i class="fa fa-expand"></i></span>
</h1>
<div
id="itinerary"
class="flexcolumn flexgrow"
></div>
<div id="itinerary" class="flexcolumn flexgrow"></div>
</div>
</div>
</div>
@ -993,46 +708,30 @@
<div class="flexrow">
<ul id="stats">
<li>
<div
class="text-muted small d-none d-sm-block"
data-i18n="footer.distance"
>
<div class="text-muted small d-none d-sm-block" data-i18n="footer.distance">
Distance
</div>
<p class="stats-label">
<span id="distance">-</span>
<abbr
data-i18n="[title]footer.kilometer;footer.kilometer-abbrev"
title="kilometers"
<abbr data-i18n="[title]footer.kilometer;footer.kilometer-abbrev" title="kilometers"
>km</abbr
>
</p>
</li>
<li>
<div
class="text-muted small d-none d-sm-block"
data-i18n="footer.travel-time"
>
<div class="text-muted small d-none d-sm-block" data-i18n="footer.travel-time">
Travel time
</div>
<p class="stats-label">
<span id="totaltime">-</span>
<abbr
data-i18n="[title]footer.hours;footer.hours-abbrev"
title="hours"
>h</abbr
>
<abbr data-i18n="[title]footer.hours;footer.hours-abbrev" title="hours">h</abbr>
</p>
</li>
<li>
<div class="text-muted small d-none d-sm-block">
<span data-i18n="footer.total-energy"
>Total Energy</span
>
<span data-i18n="footer.total-energy">Total Energy</span>
|
<span data-i18n="footer.energy-per-100km"
>Energy per 100 km</span
>
<span data-i18n="footer.energy-per-100km">Energy per 100 km</span>
</div>
<p class="stats-label">
<span id="totalenergy">-</span>
@ -1052,31 +751,19 @@
<li>
<div class="text-muted small d-none d-sm-block">
<span data-i18n="footer.ascend">Ascend</span> |
<span data-i18n="footer.plain-ascend"
>Plain ascend</span
>
<span data-i18n="footer.plain-ascend">Plain ascend</span>
</div>
<p class="stats-label">
<span id="ascend">-</span>
<abbr
data-i18n="[title]footer.meter;footer.meter-abbrev"
title="meters"
>m</abbr
>
<abbr data-i18n="[title]footer.meter;footer.meter-abbrev" title="meters">m</abbr>
| <span id="plainascend">-</span>
<abbr
data-i18n="[title]footer.meter;footer.meter-abbrev"
title="meters"
>m</abbr
>
<abbr data-i18n="[title]footer.meter;footer.meter-abbrev" title="meters">m</abbr>
</p>
</li>
<li>
<div class="text-muted small d-none d-sm-block">
<span data-i18n="footer.cost">Cost</span> |
<span data-i18n="footer.mean-cost-factor"
>Mean cost factor</span
>
<span data-i18n="footer.mean-cost-factor">Mean cost factor</span>
</div>
<p class="stats-label">
<span id="cost">-</span> |

View file

@ -6,9 +6,7 @@
result = navigator.maxTouchPoints > 0;
} else if (
window.matchMedia &&
window.matchMedia(
'(any-pointer:coarse),(any-pointer:fine),(any-pointer:none)'
).matches
window.matchMedia('(any-pointer:coarse),(any-pointer:fine),(any-pointer:none)').matches
) {
result = window.matchMedia('(any-pointer:coarse)').matches;
} else if ('msMaxTouchPoints' in navigator) {

View file

@ -29,10 +29,7 @@ BR.LayersConfig = L.Class.extend({
baseLayers: baseLayers,
overlays: overlays
};
localStorage.setItem(
'map/defaultLayers',
JSON.stringify(defaultLayers)
);
localStorage.setItem('map/defaultLayers', JSON.stringify(defaultLayers));
}
},
@ -75,8 +72,7 @@ BR.LayersConfig = L.Class.extend({
BR.layerIndex['MtbMap'].geometry = BR.confLayers.europeGeofabrik;
BR.layerIndex['1069'].geometry = BR.confLayers.europeGeofabrik;
BR.layerIndex['OpenStreetMap.CH'].geometry =
BR.confLayers.switzerlandPadded;
BR.layerIndex['OpenStreetMap.CH'].geometry = BR.confLayers.switzerlandPadded;
BR.layerIndex['1017'].geometry = BR.confLayers.osmapaPl;
},
@ -138,9 +134,7 @@ BR.LayersConfig = L.Class.extend({
// when key required only add if configured
var keyObj = this.getKeyName(layerData.properties.url);
if (!keyObj || (keyObj && BR.keys[keyObj.name])) {
layers[layerData.properties.name] = this.createLayer(
layerData
);
layers[layerData.properties.name] = this.createLayer(layerData);
}
} else {
console.error('Layer not found: ' + layerId);
@ -208,12 +202,7 @@ BR.LayersConfig = L.Class.extend({
if (attr.html) {
result = attr.html;
} else if (attr.url && attr.text) {
result =
'<a href="' +
attr.url +
'" target="_blank" rel="noopener">' +
attr.text +
'</a>';
result = '<a href="' + attr.url + '" target="_blank" rel="noopener">' + attr.text + '</a>';
} else if (attr.text) {
result = attr.text;
}
@ -227,18 +216,11 @@ BR.LayersConfig = L.Class.extend({
var options = {
maxZoom: this._map.getMaxZoom(),
bounds:
layerData.geometry && !props.worldTiles
? L.geoJson(layerData.geometry).getBounds()
: null
bounds: layerData.geometry && !props.worldTiles ? L.geoJson(layerData.geometry).getBounds() : null
};
if (props.mapUrl) {
options.mapLink =
'<a target="_blank" href="' +
props.mapUrl +
'">' +
(props.nameShort || props.name) +
'</a>';
'<a target="_blank" href="' + props.mapUrl + '">' + (props.nameShort || props.name) + '</a>';
}
if (props.attribution) {
options.attribution = props.attribution;

View file

@ -52,9 +52,7 @@ BR.Map = {
var overlays = layersConfig.getOverlays();
if (BR.keys.bing) {
baseLayers[i18next.t('map.layer.bing')] = new BR.BingLayer(
BR.keys.bing
);
baseLayers[i18next.t('map.layer.bing')] = new BR.BingLayer(BR.keys.bing);
}
if (BR.keys.digitalGlobe) {
@ -86,14 +84,9 @@ BR.Map = {
}
}
layersControl = BR.layersTab(layersConfig, baseLayers, overlays).addTo(
map
);
layersControl = BR.layersTab(layersConfig, baseLayers, overlays).addTo(map);
var secureContext =
'isSecureContext' in window
? isSecureContext
: location.protocol === 'https:';
var secureContext = 'isSecureContext' in window ? isSecureContext : location.protocol === 'https:';
if (secureContext) {
L.control
.locate({

View file

@ -8,19 +8,12 @@ BR.Export = L.Class.extend({
this.tracknameAllowedChars = BR.conf.tracknameAllowedChars;
if (this.tracknameAllowedChars) {
this.tracknameMessage = document.getElementById(
'trackname-message'
);
var patternRegex = new RegExp(
'[' + this.tracknameAllowedChars + ']+'
);
this.tracknameMessage = document.getElementById('trackname-message');
var patternRegex = new RegExp('[' + this.tracknameAllowedChars + ']+');
// warn about special characters getting removed by server quick fix (#194)
trackname.pattern = patternRegex.toString().slice(1, -1);
trackname.addEventListener(
'input',
L.bind(this._validationMessage, this)
);
trackname.addEventListener('input', L.bind(this._validationMessage, this));
}
this.exportButton.on('click', L.bind(this._generateTrackname, this));
@ -41,37 +34,14 @@ BR.Export = L.Class.extend({
_export: function() {
var exportForm = document.forms['export'];
var format =
exportForm['format'].value ||
$('#export-format input:radio:checked').val();
var format = exportForm['format'].value || $('#export-format input:radio:checked').val();
var name = encodeURIComponent(exportForm['trackname'].value);
var includeWaypoints = exportForm['include-waypoints'].checked;
var uri = this.router.getUrl(
this.latLngs,
format,
name,
includeWaypoints
);
var uri = this.router.getUrl(this.latLngs, format, name, includeWaypoints);
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent(
'click',
true,
true,
window,
0,
0,
0,
0,
0,
false,
false,
false,
false,
0,
null
);
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
var link = document.createElement('a');
link.href = uri;
link.dispatchEvent(evt);
@ -79,16 +49,12 @@ BR.Export = L.Class.extend({
_validationMessage: function() {
var trackname = this.trackname;
var replaceRegex = new RegExp(
'[^' + this.tracknameAllowedChars + ']',
'g'
);
var replaceRegex = new RegExp('[^' + this.tracknameAllowedChars + ']', 'g');
if (trackname.validity.patternMismatch) {
var replaced = trackname.value.replace(replaceRegex, '');
var patternStr = this.tracknameAllowedChars.replace(/\\/g, '');
this.tracknameMessage.textContent =
'[' + patternStr + '] --> ' + replaced;
this.tracknameMessage.textContent = '[' + patternStr + '] --> ' + replaced;
} else {
this.tracknameMessage.textContent = '';
}
@ -102,8 +68,7 @@ BR.Export = L.Class.extend({
this._getCityAtPosition(
this.latLngs[this.latLngs.length - 1],
L.bind(function(to) {
var distance = document.getElementById('distance')
.innerHTML;
var distance = document.getElementById('distance').innerHTML;
if (this.tracknameAllowedChars) {
distance = distance.replace(',', '.'); // temp. fix (#202)
}
@ -115,17 +80,16 @@ BR.Export = L.Class.extend({
distance: distance
});
} else {
trackname.value = i18next.t(
'export.route-from-to',
{ from: from, to: to, distance: distance }
);
trackname.value = i18next.t('export.route-from-to', {
from: from,
to: to,
distance: distance
});
}
if (this.tracknameAllowedChars) {
// temp. fix: replace and remove characters that will get removed by server quick fix (#194)
trackname.value = trackname.value
.replace(/[>)]/g, '')
.replace(/ \(/g, ' - ');
trackname.value = trackname.value.replace(/[>)]/g, '').replace(/ \(/g, ' - ');
this._validationMessage();
}
}, this)
@ -144,17 +108,9 @@ BR.Export = L.Class.extend({
L.bind(function(err, response) {
try {
var addr = JSON.parse(response).address;
cb(
addr.village ||
addr.town ||
addr.hamlet ||
addr.city_district ||
addr.city
);
cb(addr.village || addr.town || addr.hamlet || addr.city_district || addr.city);
} catch (err) {
BR.message.showError(
'Error getting position city "' + lonlat + '": ' + err
);
BR.message.showError('Error getting position city "' + lonlat + '": ' + err);
return cb(null);
}
})

View file

@ -46,18 +46,9 @@ BR.Layers = L.Class.extend({
for (var l in overlays) this._layers[l] = [overlays[l], true];
for (var l in baseLayers) this._layers[l] = [baseLayers[l], false];
L.DomUtil.get('custom_layers_add_base').onclick = L.bind(
this._addBaseLayer,
this
);
L.DomUtil.get('custom_layers_add_overlay').onclick = L.bind(
this._addOverlay,
this
);
L.DomUtil.get('custom_layers_remove').onclick = L.bind(
this._remove,
this
);
L.DomUtil.get('custom_layers_add_base').onclick = L.bind(this._addBaseLayer, this);
L.DomUtil.get('custom_layers_add_overlay').onclick = L.bind(this._addOverlay, this);
L.DomUtil.get('custom_layers_remove').onclick = L.bind(this._remove, this);
this._loadLayers();
this._loadTable();
@ -95,8 +86,7 @@ BR.Layers = L.Class.extend({
_addFromInput: function(isOverlay) {
var layer_name = L.DomUtil.get('layer_name').value;
var layer_url = L.DomUtil.get('layer_url').value;
if (layer_name.length > 0 && layer_url.length > 0)
this._addLayer(layer_name, layer_url, isOverlay);
if (layer_name.length > 0 && layer_url.length > 0) this._addLayer(layer_name, layer_url, isOverlay);
},
_addBaseLayer: function(evt) {

View file

@ -4,12 +4,7 @@ BR.LayersTab = BR.ControlLayers.extend({
saveLayers: [],
initialize: function(layersConfig, baseLayers, overlays, options) {
L.Control.Layers.prototype.initialize.call(
this,
baseLayers,
overlays,
options
);
L.Control.Layers.prototype.initialize.call(this, baseLayers, overlays, options);
this.layersConfig = layersConfig;
},
@ -30,21 +25,13 @@ BR.LayersTab = BR.ControlLayers.extend({
onAdd: function(map) {
BR.ControlLayers.prototype.onAdd.call(this, map);
map.on(
'baselayerchange overlayadd overlayremove',
this.storeActiveLayers,
this
);
map.on('baselayerchange overlayadd overlayremove', this.storeActiveLayers, this);
},
onRemove: function(map) {
BR.ControlLayers.prototype.onRemove.call(this, map);
map.off(
'baselayerchange overlayadd overlayremove',
this.storeActiveLayers,
this
);
map.off('baselayerchange overlayadd overlayremove', this.storeActiveLayers, this);
},
initOpacitySlider: function(map) {
@ -57,19 +44,14 @@ BR.LayersTab = BR.ControlLayers.extend({
title: i18next.t('layers.opacity-slider'),
callback: function(opacity) {
for (var i = 0; i < self._layers.length; i++) {
if (
!self._layers[i].overlay ||
!map.hasLayer(self._layers[i].layer)
) {
if (!self._layers[i].overlay || !map.hasLayer(self._layers[i].layer)) {
continue;
}
self._layers[i].layer.setOpacity(opacity);
}
}
});
L.DomUtil.get(
'leaflet-control-layers-overlays-opacity-slider'
).appendChild(overlayOpacitySlider.getElement());
L.DomUtil.get('leaflet-control-layers-overlays-opacity-slider').appendChild(overlayOpacitySlider.getElement());
},
initButtons: function() {
@ -95,15 +77,9 @@ BR.LayersTab = BR.ControlLayers.extend({
};
L.DomUtil.get('expand_tree_button').onclick = L.bind(expandTree, this);
L.DomUtil.get('collapse_tree_button').onclick = L.bind(
collapseTree,
this
);
L.DomUtil.get('collapse_tree_button').onclick = L.bind(collapseTree, this);
L.DomUtil.get('optional_layers_button').onclick = L.bind(
toggleOptionalLayers,
this
);
L.DomUtil.get('optional_layers_button').onclick = L.bind(toggleOptionalLayers, this);
},
initJsTree: function() {
@ -225,10 +201,7 @@ BR.LayersTab = BR.ControlLayers.extend({
id: id,
text: getText(props, parent),
state: {
checked: self.layersConfig.isDefaultLayer(
id,
props.overlay
)
checked: self.layersConfig.isDefaultLayer(id, props.overlay)
}
};
}

View file

@ -12,10 +12,7 @@ BR.Message = L.Class.extend({
_show: function(msg, type) {
var ele = L.DomUtil.get(this.id),
iconClass =
type === 'warning'
? 'fa-exclamation-triangle'
: 'fa-times-circle',
iconClass = type === 'warning' ? 'fa-exclamation-triangle' : 'fa-times-circle',
alertClass = type === 'warning' ? 'alert-warning' : 'alert-danger';
L.DomEvent.disableClickPropagation(ele);

View file

@ -11,12 +11,8 @@ BR.OpacitySlider = L.Class.extend({
initialize: function(options) {
L.setOptions(this, options);
var input = (this.input = $(
'<input id="slider-' + this.options.id + '" type="text"/>'
)),
item = BR.Util.localStorageAvailable()
? localStorage['opacitySliderValue' + this.options.id]
: null,
var input = (this.input = $('<input id="slider-' + this.options.id + '" type="text"/>')),
item = BR.Util.localStorageAvailable() ? localStorage['opacitySliderValue' + this.options.id] : null,
value = item ? parseInt(item) : this.options.defaultValue * 100,
minOpacity = (BR.conf.minOpacity || 0) * 100;
@ -41,9 +37,7 @@ BR.OpacitySlider = L.Class.extend({
})
.on('slideStop', { self: this }, function(evt) {
if (BR.Util.localStorageAvailable()) {
localStorage[
'opacitySliderValue' + evt.data.self.options.id
] = evt.value;
localStorage['opacitySliderValue' + evt.data.self.options.id] = evt.value;
}
});

View file

@ -13,10 +13,7 @@ BR.OpacitySliderControl = L.Control.extend({
if (BR.Util.localStorageAvailable()) {
var value = localStorage.getItem('opacitySliderValue');
if (value !== null) {
localStorage.setItem(
'opacitySliderValue' + this.options.id,
value
);
localStorage.setItem('opacitySliderValue' + this.options.id, value);
localStorage.removeItem('opacitySliderValue');
}
}
@ -31,11 +28,7 @@ BR.OpacitySliderControl = L.Control.extend({
var removeStopClickListeners = function() {
document.removeEventListener('click', stopClickAfterSlide, true);
document.removeEventListener(
'mousedown',
removeStopClickListeners,
true
);
document.removeEventListener('mousedown', removeStopClickListeners, true);
};
slider.input
@ -52,11 +45,7 @@ BR.OpacitySliderControl = L.Control.extend({
document.addEventListener('click', stopClickAfterSlide, true);
// Firefox does not fire click event in this case, so make sure stop listener
// is always removed on next mousedown.
document.addEventListener(
'mousedown',
removeStopClickListeners,
true
);
document.addEventListener('mousedown', removeStopClickListeners, true);
});
return container;

View file

@ -39,22 +39,14 @@ BR.Profile = L.Evented.extend({
profileUrl,
L.bind(function(err, profileText) {
if (err) {
console.warn(
'Error getting profile from "' +
profileUrl +
'": ' +
err
);
console.warn('Error getting profile from "' + profileUrl + '": ' + err);
return;
}
this.cache[profileName] = profileText;
// don't set when option has changed while loading
if (
!this.profileName ||
this.profileName === profileName
) {
if (!this.profileName || this.profileName === profileName) {
this._setValue(profileText);
}
}, this)

View file

@ -1,9 +1,6 @@
BR.RoutingOptions = L.Evented.extend({
initialize: function() {
$('#profile-alternative').on(
'changed.bs.select',
this._getChangeHandler()
);
$('#profile-alternative').on('changed.bs.select', this._getChangeHandler());
// build option list from config
var profiles = BR.conf.profiles;
@ -55,12 +52,8 @@ BR.RoutingOptions = L.Evented.extend({
setOptions: function(options) {
var values = [
options.profile
? options.profile
: $('#profile option:selected').val(),
options.alternative
? options.alternative
: $('#alternative option:selected').val()
options.profile ? options.profile : $('#profile option:selected').val(),
options.alternative ? options.alternative : $('#alternative option:selected').val()
];
$('.selectpicker').selectpicker('val', values);
this.refreshUI();

View file

@ -74,10 +74,7 @@ BR.TrackMessages = L.Class.extend({
// highlight track segment (graph edge) on row hover
this._setEdges(polyline, segments);
$('#datatable tbody tr').hover(
L.bind(this._handleHover, this),
L.bind(this._handleHoverOut, this)
);
$('#datatable tbody tr').hover(L.bind(this._handleHover, this), L.bind(this._handleHoverOut, this));
},
show: function() {
@ -198,10 +195,7 @@ BR.TrackMessages = L.Class.extend({
endIndex = this._edges[row.index()],
edgeLatLngs = trackLatLngs.slice(startIndex, endIndex + 1);
this._selectedEdge = L.polyline(
edgeLatLngs,
this.options.edgeStyle
).addTo(this._map);
this._selectedEdge = L.polyline(edgeLatLngs, this.options.edgeStyle).addTo(this._map);
},
_handleHoverOut: function(evt) {

View file

@ -14,36 +14,19 @@ BR.TrackStats = L.Class.extend({
}
var stats = this.calcStats(polyline, segments),
length1 = L.Util.formatNum(
stats.trackLength / 1000,
1
).toLocaleString(),
length3 = L.Util.formatNum(
stats.trackLength / 1000,
3
).toLocaleString(),
length1 = L.Util.formatNum(stats.trackLength / 1000, 1).toLocaleString(),
length3 = L.Util.formatNum(stats.trackLength / 1000, 3).toLocaleString(),
formattedAscend = stats.filteredAscend.toLocaleString(),
formattedPlainAscend = stats.plainAscend.toLocaleString(),
formattedCost = stats.cost.toLocaleString(),
meanCostFactor = stats.trackLength
? L.Util.formatNum(
stats.cost / stats.trackLength,
2
).toLocaleString()
? L.Util.formatNum(stats.cost / stats.trackLength, 2).toLocaleString()
: '0',
formattedTime =
Math.trunc(stats.totalTime / 3600) +
':' +
('0' + Math.trunc((stats.totalTime % 3600) / 60)).slice(-2),
formattedEnergy = L.Util.formatNum(
stats.totalEnergy / 3600000,
2
).toLocaleString(),
Math.trunc(stats.totalTime / 3600) + ':' + ('0' + Math.trunc((stats.totalTime % 3600) / 60)).slice(-2),
formattedEnergy = L.Util.formatNum(stats.totalEnergy / 3600000, 2).toLocaleString(),
meanEnergy = stats.trackLength
? L.Util.formatNum(
stats.totalEnergy / 36 / stats.trackLength,
2
).toLocaleString()
? L.Util.formatNum(stats.totalEnergy / 36 / stats.trackLength, 2).toLocaleString()
: '0';
$('#distance').html(length1);

View file

@ -10,15 +10,8 @@
function verifyTouchStyle(mapContext) {
// revert touch style (large icons) when touch screen detection is available and negative
// see https://github.com/nrenner/brouter-web/issues/69
if (
L.Browser.touch &&
BR.Browser.touchScreenDetectable &&
!BR.Browser.touchScreen
) {
L.DomUtil.removeClass(
mapContext.map.getContainer(),
'leaflet-touch'
);
if (L.Browser.touch && BR.Browser.touchScreenDetectable && !BR.Browser.touchScreen) {
L.DomUtil.removeClass(mapContext.map.getContainer(), 'leaflet-touch');
}
}
@ -91,10 +84,7 @@
deletePointButton = L.easyButton(
'<span><i class="fa fa-caret-left"></i><i class="fa fa-map-marker" style="margin-left: 1px; color: gray;"></i></span>',
function() {
routing.removeWaypoint(routing.getLast(), function(
err,
data
) {});
routing.removeWaypoint(routing.getLast(), function(err, data) {});
},
i18next.t('map.delete-last-point')
);
@ -171,19 +161,14 @@
profile.on('update', function(evt) {
BR.message.hide();
var profileId = routingOptions.getCustomProfile();
router.uploadProfile(profileId, evt.profileText, function(
err,
profileId
) {
router.uploadProfile(profileId, evt.profileText, function(err, profileId) {
if (!err) {
routingOptions.setCustomProfile(profileId, true);
updateRoute({
options: routingOptions.getOptions()
});
if (!saveWarningShown) {
profile.message.showWarning(
i18next.t('warning.temporary-profile')
);
profile.message.showWarning(i18next.t('warning.temporary-profile'));
saveWarningShown = true;
}
} else {
@ -214,9 +199,7 @@
styles: BR.conf.routingStyles
});
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function(
evt
) {
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function(evt) {
search.clear();
onUpdate(evt && evt.err);
});
@ -339,9 +322,7 @@
// do not initialize immediately
urlHash = new L.Hash(null, null);
urlHash.additionalCb = function() {
var url = router
.getUrl(routing.getWaypoints(), null)
.substr('brouter?'.length + 1);
var url = router.getUrl(routing.getWaypoints(), null).substr('brouter?'.length + 1);
url = url.replace(/\|/g, ';');
return url.length > 0 ? '&' + url : null;
};
@ -401,11 +382,7 @@
.on('hidden.bs.collapse', onHide)
.on('shown.bs.collapse', onShow)
.each(function() {
if (
this.id &&
BR.Util.localStorageAvailable() &&
localStorage[this.id] === 'true'
) {
if (this.id && BR.Util.localStorageAvailable() && localStorage[this.id] === 'true') {
$(this).collapse('show');
}
});

View file

@ -15,33 +15,19 @@ BR.Elevation = L.Control.Elevation.extend({
// revert registering touch events when touch screen detection is available and negative
// see https://github.com/MrMufflon/Leaflet.Elevation/issues/67
if (
L.Browser.touch &&
BR.Browser.touchScreenDetectable &&
!BR.Browser.touchScreen
) {
if (L.Browser.touch && BR.Browser.touchScreenDetectable && !BR.Browser.touchScreen) {
this._background
.on('touchmove.drag', null)
.on('touchstart.drag', null)
.on('touchstart.focus', null);
L.DomEvent.off(
this._container,
'touchend',
this._dragEndHandler,
this
);
L.DomEvent.off(this._container, 'touchend', this._dragEndHandler, this);
this._background
.on('mousemove.focus', this._mousemoveHandler.bind(this))
.on('mouseout.focus', this._mouseoutHandler.bind(this))
.on('mousedown.drag', this._dragStartHandler.bind(this))
.on('mousemove.drag', this._dragHandler.bind(this));
L.DomEvent.on(
this._container,
'mouseup',
this._dragEndHandler,
this
);
L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
}
return container;
@ -61,10 +47,7 @@ BR.Elevation = L.Control.Elevation.extend({
}
this.addTo(map);
// move elevation graph outside of the map
setParent(
this.getContainer(),
document.getElementById('elevation-chart')
);
setParent(this.getContainer(), document.getElementById('elevation-chart'));
},
update: function(track, layer) {

View file

@ -143,9 +143,7 @@ BR.NogoAreas = L.Control.extend({
resolve(reader.result);
};
reader.onerror = function() {
self.displayUploadError(
'Could not load file: ' + reader.error.message
);
self.displayUploadError('Could not load file: ' + reader.error.message);
};
reader.readAsText(nogoFile);
@ -184,32 +182,22 @@ BR.NogoAreas = L.Control.extend({
var maybeBufferedFeature = feature;
// Eventually buffer GeoJSON
if (nogoBuffer !== 0) {
maybeBufferedFeature = turf.buffer(
maybeBufferedFeature,
nogoBuffer,
{ units: 'meters' }
);
maybeBufferedFeature = turf.buffer(maybeBufferedFeature, nogoBuffer, { units: 'meters' });
}
cleanedGeoJSONFeatures.push(maybeBufferedFeature);
}
});
if (cleanedGeoJSONFeatures.length === 0) {
self.displayUploadError(
'No valid area found in provided input.'
);
self.displayUploadError('No valid area found in provided input.');
return false;
}
var geoJSON = L.geoJson(
turf.featureCollection(cleanedGeoJSONFeatures),
{
var geoJSON = L.geoJson(turf.featureCollection(cleanedGeoJSONFeatures), {
onEachFeature: function(feature, layer) {
layer.options.nogoWeight =
feature.properties.nogoWeight || nogoWeight;
layer.options.nogoWeight = feature.properties.nogoWeight || nogoWeight;
}
}
);
});
var nogosPoints = geoJSON.getLayers().filter(function(e) {
return e.feature.geometry.type === 'Point';
});
@ -332,9 +320,7 @@ BR.NogoAreas = L.Control.extend({
BR.NogoAreas.include(L.Evented.prototype);
L.Editable.prototype.createVertexIcon = function(options) {
return BR.Browser.touch
? new L.Editable.TouchVertexIcon(options)
: new L.Editable.VertexIcon(options);
return BR.Browser.touch ? new L.Editable.TouchVertexIcon(options) : new L.Editable.VertexIcon(options);
};
BR.EditingTooltip = L.Handler.extend({
@ -351,12 +337,7 @@ BR.EditingTooltip = L.Handler.extend({
addHooks: function() {
// hack: listen to EasyButton click (instead of editable:drawing:start),
// to get mouse position from event for initial tooltip location
L.DomEvent.addListener(
this.button.button,
'click',
this._addCreate,
this
);
L.DomEvent.addListener(this.button.button, 'click', this._addCreate, this);
this.editTools.featuresLayer.on('layeradd', this._bind, this);
@ -366,12 +347,7 @@ BR.EditingTooltip = L.Handler.extend({
},
removeHooks: function() {
L.DomEvent.removeListener(
this.button.button,
'click',
this._addCreate,
this
);
L.DomEvent.removeListener(this.button.button, 'click', this._addCreate, this);
this.editTools.featuresLayer.off('layeradd', this._bind, this);
@ -396,9 +372,7 @@ BR.EditingTooltip = L.Handler.extend({
if (!latlng && layer instanceof L.Layer) {
latlng = L.latLng(
layer.getBounds().getSouth(),
0.5 *
(layer.getBounds().getWest() +
layer.getBounds().getEast())
0.5 * (layer.getBounds().getWest() + layer.getBounds().getEast())
);
}
L.Layer.prototype.openTooltip.call(this, layer, latlng);
@ -444,11 +418,7 @@ BR.EditingTooltip = L.Handler.extend({
var closeTooltip = function() {
this.map.closeTooltip(tooltip);
};
this.editTools.once(
'editable:editing editable:drawing:cancel',
closeTooltip,
this
);
this.editTools.once('editable:editing editable:drawing:cancel', closeTooltip, this);
if (BR.Browser.touch) {
// can't move with cursor on touch devices, so show at start pos for a few seconds
@ -501,9 +471,7 @@ BR.EditingTooltip = L.Handler.extend({
BR.DeletableCircleEditor = L.Editable.CircleEditor.extend({
_computeDeleteLatLng: function() {
// While circle is not added to the map, _radius is not set.
var delta =
(this.feature._radius || this.feature._mRadius) *
Math.cos(Math.PI / 4),
var delta = (this.feature._radius || this.feature._mRadius) * Math.cos(Math.PI / 4),
point = this.map.project(this.feature._latlng);
return this.map.unproject([point.x - delta, point.y - delta]);
},
@ -530,12 +498,7 @@ BR.DeletableCircleEditor = L.Editable.CircleEditor.extend({
},
initialize: function(map, feature, options) {
L.Editable.CircleEditor.prototype.initialize.call(
this,
map,
feature,
options
);
L.Editable.CircleEditor.prototype.initialize.call(this, map, feature, options);
this._deleteLatLng = this._computeDeleteLatLng();
// FeatureGroup instead of LayerGroup to propagate events to members
@ -584,9 +547,7 @@ BR.DeleteMarker = L.Marker.extend({
options: {
draggable: false,
icon: L.divIcon({
iconSize: BR.Browser.touch
? new L.Point(24, 24)
: new L.Point(16, 16),
iconSize: BR.Browser.touch ? new L.Point(24, 24) : new L.Point(16, 16),
className: 'leaflet-div-icon fa fa-trash-o nogo-delete-marker'
})
},

View file

@ -94,11 +94,7 @@ BR.Routing = L.Routing.extend({
// intercept listener: only re-show draw trailer after marker hover
// when edit is not active (i.e. wasn't also supended)
this._parent.off(
'waypoint:mouseout',
this._catchWaypointEvent,
this
);
this._parent.off('waypoint:mouseout', this._catchWaypointEvent, this);
this.on(
'waypoint:mouseout',
function(e) {
@ -134,12 +130,7 @@ BR.Routing = L.Routing.extend({
this._map.off('mouseout', hide, this);
this._map.off('mouseover', show, this);
L.DomEvent.off(this._map._controlContainer, 'mouseout', show, this);
L.DomEvent.off(
this._map._controlContainer,
'mouseover',
hide,
this
);
L.DomEvent.off(this._map._controlContainer, 'mouseover', hide, this);
});
// Call show after deleting last waypoint, but hide trailer.
@ -159,11 +150,7 @@ BR.Routing = L.Routing.extend({
);
// keys not working when map container does not have focus, use document instead
L.DomEvent.removeListener(
this._container,
'keyup',
this._keyupListener
);
L.DomEvent.removeListener(this._container, 'keyup', this._keyupListener);
L.DomEvent.addListener(document, 'keyup', this._keyupListener, this);
// enable drawing mode
@ -173,10 +160,7 @@ BR.Routing = L.Routing.extend({
},
_addSegmentCasing: function(e) {
var casing = L.polyline(
e.layer.getLatLngs(),
this.options.styles.trackCasing
);
var casing = L.polyline(e.layer.getLatLngs(), this.options.styles.trackCasing);
this._segmentsCasing.addLayer(casing);
e.layer._casing = casing;
this._segments.bringToFront();
@ -335,10 +319,7 @@ BR.Routing = L.Routing.extend({
_keyupListener: function(e) {
// Suppress shortcut handling when a text input field is focussed
if (
document.activeElement.type == 'text' ||
document.activeElement.type == 'textarea'
) {
if (document.activeElement.type == 'text' || document.activeElement.type == 'textarea') {
return;
}
// add 'esc' to disable drawing

View file

@ -36,11 +36,7 @@ BR.Sidebar = L.Control.Sidebar.extend({
this._rememberTabState();
if (
L.Browser.touch &&
BR.Browser.touchScreenDetectable &&
!BR.Browser.touchScreen
) {
if (L.Browser.touch && BR.Browser.touchScreenDetectable && !BR.Browser.touchScreen) {
L.DomUtil.removeClass(this._container, 'leaflet-touch');
L.DomUtil.removeClass(this._tabContainer, 'leaflet-touch');
}

View file

@ -1,9 +1,7 @@
(function(window) {
var HAS_HASHCHANGE = (function() {
var doc_mode = window.documentMode;
return (
'onhashchange' in window && (doc_mode === undefined || doc_mode > 7)
);
return 'onhashchange' in window && (doc_mode === undefined || doc_mode > 7);
})();
L.Hash = function(map, options) {
@ -47,12 +45,7 @@
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)),
layers = this.formatLayers();
var params = [
zoom,
center.lat.toFixed(precision),
center.lng.toFixed(precision),
layers
];
var params = [zoom, center.lat.toFixed(precision), center.lng.toFixed(precision), layers];
url = '#map=' + params.join('/');
if (this.additionalCb != null) {
var additional = this.additionalCb();
@ -92,9 +85,7 @@
var layerString = decodeURIComponent(layerEncoded);
if (layerString) {
obj = this.options.layersControl.getLayerFromString(
layerString
);
obj = this.options.layersControl.getLayerFromString(layerString);
}
return obj;
@ -112,10 +103,7 @@
return count;
};
var layers = this._parseLayers(
layersParam,
this.options.layerSeparator
);
var layers = this._parseLayers(layersParam, this.options.layerSeparator);
var found = layers.reduce(countFoundLayers, 0);
if (found < layers.length) {
@ -158,9 +146,7 @@
var objList = this.options.layersControl.getActiveLayers();
var layerList = objList.map(
L.bind(function(obj) {
return encodeURIComponent(
this.options.layersControl.toLayerString(obj)
);
return encodeURIComponent(this.options.layersControl.toLayerString(obj));
}, this)
);
@ -246,41 +232,22 @@
isListening: false,
hashChangeInterval: null,
startListening: function() {
this.map.on(
'moveend layeradd layerremove',
this.onMapMove,
this
);
this.map.on('moveend layeradd layerremove', this.onMapMove, this);
if (HAS_HASHCHANGE) {
L.DomEvent.addListener(
window,
'hashchange',
this.onHashChange
);
L.DomEvent.addListener(window, 'hashchange', this.onHashChange);
} else {
clearInterval(this.hashChangeInterval);
this.hashChangeInterval = setInterval(
this.onHashChange,
50
);
this.hashChangeInterval = setInterval(this.onHashChange, 50);
}
this.isListening = true;
},
stopListening: function() {
this.map.off(
'moveend layeradd layerremove',
this.onMapMove,
this
);
this.map.off('moveend layeradd layerremove', this.onMapMove, this);
if (HAS_HASHCHANGE) {
L.DomEvent.removeListener(
window,
'hashchange',
this.onHashChange
);
L.DomEvent.removeListener(window, 'hashchange', this.onHashChange);
} else {
clearInterval(this.hashChangeInterval);
}

View file

@ -7,10 +7,7 @@ BR.stravaSegments = function(map, layersControl) {
stravaToken: BR.keys.strava
})
.addTo(map);
layersControl.addOverlay(
stravaControl.stravaLayer,
i18next.t('map.layer.strava-segments')
);
layersControl.addOverlay(stravaControl.stravaLayer, i18next.t('map.layer.strava-segments'));
stravaControl.onError = function(err) {
BR.message.showError(
i18next.t('warning.strava-error', {

View file

@ -40,30 +40,16 @@ L.BRouter = L.Class.extend({
getUrlParams: function(latLngs, format) {
params = {};
if (this._getLonLatsString(latLngs) != null)
params.lonlats = this._getLonLatsString(latLngs);
if (this._getLonLatsString(latLngs) != null) params.lonlats = this._getLonLatsString(latLngs);
if (
this.options.nogos &&
this._getNogosString(this.options.nogos).length > 0
)
if (this.options.nogos && this._getNogosString(this.options.nogos).length > 0)
params.nogos = this._getNogosString(this.options.nogos);
if (
this.options.polylines &&
this._getNogosPolylinesString(this.options.polylines).length > 0
)
params.polylines = this._getNogosPolylinesString(
this.options.polylines
);
if (this.options.polylines && this._getNogosPolylinesString(this.options.polylines).length > 0)
params.polylines = this._getNogosPolylinesString(this.options.polylines);
if (
this.options.polygons &&
this._getNogosPolygonsString(this.options.polygons).length > 0
)
params.polygons = this._getNogosPolygonsString(
this.options.polygons
);
if (this.options.polygons && this._getNogosPolygonsString(this.options.polygons).length > 0)
params.polygons = this._getNogosPolygonsString(this.options.polygons);
if (this.options.profile != null) params.profile = this.options.profile;
@ -77,10 +63,7 @@ L.BRouter = L.Class.extend({
if (params.alternativeidx == 0) delete params.alternativeidx;
// don't add custom profile, as these are only stored temporarily
if (
params.profile &&
params.profile.substring(0, 7) === 'custom_'
) {
if (params.profile && params.profile.substring(0, 7) === 'custom_') {
delete params.profile;
}
}
@ -117,20 +100,12 @@ L.BRouter = L.Class.extend({
var args = [];
if (urlParams.lonlats != null && urlParams.lonlats.length > 0)
args.push(L.Util.template('lonlats={lonlats}', urlParams));
if (urlParams.nogos != null)
args.push(L.Util.template('nogos={nogos}', urlParams));
if (urlParams.polylines != null)
args.push(L.Util.template('polylines={polylines}', urlParams));
if (urlParams.polygons != null)
args.push(L.Util.template('polygons={polygons}', urlParams));
if (urlParams.profile != null)
args.push(L.Util.template('profile={profile}', urlParams));
if (urlParams.alternativeidx != null)
args.push(
L.Util.template('alternativeidx={alternativeidx}', urlParams)
);
if (urlParams.format != null)
args.push(L.Util.template('format={format}', urlParams));
if (urlParams.nogos != null) args.push(L.Util.template('nogos={nogos}', urlParams));
if (urlParams.polylines != null) args.push(L.Util.template('polylines={polylines}', urlParams));
if (urlParams.polygons != null) args.push(L.Util.template('polygons={polygons}', urlParams));
if (urlParams.profile != null) args.push(L.Util.template('profile={profile}', urlParams));
if (urlParams.alternativeidx != null) args.push(L.Util.template('alternativeidx={alternativeidx}', urlParams));
if (urlParams.format != null) args.push(L.Util.template('format={format}', urlParams));
if (trackname)
args.push(
L.Util.template('trackname={trackname}', {
@ -141,9 +116,7 @@ L.BRouter = L.Class.extend({
var prepend_host = format != null;
return (
(prepend_host ? BR.conf.host : '') + '/brouter?' + args.join('&')
);
return (prepend_host ? BR.conf.host : '') + '/brouter?' + args.join('&');
},
getRoute: function(latLngs, cb) {
@ -174,8 +147,7 @@ L.BRouter = L.Class.extend({
xhr.status === 200 &&
xhr.responseText &&
// application error when not GeoJSON format (text/plain for errors)
xhr.getResponseHeader('Content-Type').split(';')[0] ===
'application/vnd.geo+json'
xhr.getResponseHeader('Content-Type').split(';')[0] === 'application/vnd.geo+json'
) {
// leaflet.spin
//gpxLayer.fire('data:loaded');
@ -221,11 +193,7 @@ L.BRouter = L.Class.extend({
_handleProfileResponse: function(xhr, cb) {
var response;
if (
xhr.status === 200 &&
xhr.responseText &&
xhr.responseText.length > 0
) {
if (xhr.status === 200 && xhr.responseText && xhr.responseText.length > 0) {
response = JSON.parse(xhr.responseText);
cb(response.error, response.profileid);
} else {

View file

@ -4,8 +4,7 @@ var brouterCgi = (function() {
// http://brouter.de/cgi-bin/brouter.sh?coords=13.404681_52.520185_13.340278_52.512356_trekking_0
//var URL_TEMPLATE = '/cgi-bin/proxy.cgi?url=' + 'http://brouter.de/cgi-bin/brouter.sh?coords={fromLng}_{fromLat}_{toLng}_{toLat}_{profile}_{alt}';
var URL_TEMPLATE =
'/proxy.php?url=' +
'cgi-bin/brouter.sh?coords={fromLng}_{fromLat}_{toLng}_{toLat}_{profile}_{alt}';
'/proxy.php?url=' + 'cgi-bin/brouter.sh?coords={fromLng}_{fromLat}_{toLng}_{toLat}_{profile}_{alt}';
var PRECISION = 6;
function getUrl(polyline) {

View file

@ -21,14 +21,8 @@ i18next.t('navbar.profile.vm-forum-liegerad-schnell');
i18next.t('navbar.profile.vm-forum-velomobil-schnell');
i18next.t('sidebar.layers.category.base-layers', 'Base layers');
i18next.t(
'sidebar.layers.category.worldwide-international',
'Worldwide international'
);
i18next.t(
'sidebar.layers.category.worldwide-monolingual',
'Worldwide monolingual'
);
i18next.t('sidebar.layers.category.worldwide-international', 'Worldwide international');
i18next.t('sidebar.layers.category.worldwide-monolingual', 'Worldwide monolingual');
i18next.t('sidebar.layers.category.europe', 'Europe');
i18next.t('sidebar.layers.category.europe-monolingual', 'Europe monolingual');
i18next.t('sidebar.layers.category.country', 'Country');