Fix data tab showing only two rows (regression from v0.6.2), fixes #72
This commit is contained in:
parent
613e15fd63
commit
612119f347
6 changed files with 9 additions and 6 deletions
|
|
@ -1,9 +1,13 @@
|
|||
BRouter-Web Changelog
|
||||
=====================
|
||||
|
||||
## 0.6.3 (2017-03-16)
|
||||
|
||||
* Fix data tab showing only two rows (regression from v0.6.2) ([#72](https://github.com/nrenner/brouter-web/issues/72))
|
||||
|
||||
## 0.6.2 (2017-03-14)
|
||||
|
||||
* Fix "API Key Required" in OpenCycleMap & Outdoors by registering for Thunderforest "Hobby Project" plan
|
||||
* Fix "API Key Required" in OpenCycleMap & Outdoors by registering for Thunderforest "Hobby Project" plan ([#70](https://github.com/nrenner/brouter-web/issues/70))
|
||||
|
||||
## 0.6.1 (2016-12-12)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"d3": "~3.5.5",
|
||||
"leaflet.draw": "~0.2.3",
|
||||
"bootstrap": "~3.3.4",
|
||||
"DataTables": "~1.10.5",
|
||||
"DataTables": "~1.10.13",
|
||||
"leaflet.elevation": "MrMufflon/Leaflet.Elevation#master",
|
||||
"leaflet-control-geocoder": "~1.1.0",
|
||||
"Leaflet.EasyButton": "*",
|
||||
|
|
|
|||
2
dist/brouter-web.js
vendored
2
dist/brouter-web.js
vendored
|
|
@ -51,7 +51,7 @@ BR.OpacitySlider=L.Control.extend({options:{position:"topleft",callback:function
|
|||
BR.Profile=L.Class.extend({options:{heading:"Profile"},cache:{},initialize:function(){L.DomUtil.get("upload").onclick=L.bind(this._upload,this),L.DomUtil.get("clear").onclick=L.bind(this.clear,this),this.ele=document.profile_upload.profile,this.message=new BR.Message("profile_message",{alert:!0})},clear:function(e){var l=e.target||e.srcElement;e.preventDefault(),this.ele.value=null,this.ele.defaultValue=this.ele.value,this.fire("clear"),l.blur()},update:function(e){var l,i=e.profile,t=this.ele,a=t.defaultValue!==t.value;this.profileName=i,!i||!BR.conf.profilesUrl||t.value&&a||(i in this.cache?(t.value=this.cache[i],t.defaultValue=t.value):(l=BR.conf.profilesUrl+i+".brf",BR.Util.get(l,L.bind(function(e,a){return e?void console.warn('Error getting profile from "'+l+'": '+e):(this.cache[i]=a,void(this.profileName&&this.profileName!==i||(t.value=a,t.defaultValue=t.value)))},this))))},_upload:function(e){var l=e.target||e.srcElement,i=this.ele.value;this.message.hide(),$(l).button("uploading"),e.preventDefault(),this.fire("update",{profileText:i,callback:function(){$(l).button("reset"),$(l).blur()}})}}),BR.Profile.include(L.Mixin.Events);
|
||||
BR.RoutingOptions=BR.Control.extend({options:{heading:"Options",divId:"route_options"},onAdd:function(t){var e,i,o=L.DomUtil.get("profile");o.onchange=this._getChangeHandler(),L.DomUtil.get("alternative").onchange=this._getChangeHandler();var n=BR.conf.profiles;for(e=0;e<n.length;e++)i=document.createElement("option"),i.value=n[e],i.text=n[e],o.add(i,null);return o.options[1].selected=!0,BR.Control.prototype.onAdd.call(this,t)},getOptions:function(){return{profile:L.DomUtil.get("profile").value,alternative:L.DomUtil.get("alternative").value}},setOptions:function(t){var e,i=t.profile;i&&(e=L.DomUtil.get("profile"),e.value=i,e.value!=i&&this.setCustomProfile(i,!0)),t.alternative&&(L.DomUtil.get("alternative").value=t.alternative)},setCustomProfile:function(t,e){var i,o;i=L.DomUtil.get("profile"),o=i.options[0],o.value=t,o.disabled=!t,o.selected=!!t,e||this.fire("update",{options:this.getOptions()})},getCustomProfile:function(){var t=L.DomUtil.get("profile"),e=t.options[0],i=null;return e.disabled||(i=e.value),i},_getChangeHandler:function(){return L.bind(function(t){this.fire("update",{options:this.getOptions()})},this)}}),BR.RoutingOptions.include(L.Mixin.Events);
|
||||
BR.Tabs=BR.Control.extend({options:{divId:"tabs_div",tabs:{}},initialize:function(t){L.setOptions(this,t)},onAdd:function(t){var o=this.options.tabs;for(var a in o)$('<li><a href="'+a+'" role="tab">'+o[a].options.heading+"</a></li>").appendTo("#tab"),o[a].onAdd&&o[a].onAdd(t);return $("#tab a").click(function(t){t.preventDefault(),$(this).tab("show")}),$("#tab a").on("shown.bs.tab",L.bind(function(t){var o=this.options.tabs[t.target.hash],a=t.relatedTarget?this.options.tabs[t.relatedTarget.hash]:null;o&&o.show&&o.show(),a&&a.hide&&a.hide()},this)),$("#tab li:not(.hidden) a:first").tab("show"),BR.Control.prototype.onAdd.call(this,t)}});
|
||||
BR.TrackMessages=L.Class.extend({options:{heading:"Data",edgeStyle:{color:"yellow",opacity:.8,weight:8}},active:!1,columnOptions:{Longitude:{visible:!1},Latitude:{visible:!1},Elevation:{title:"elev.",className:"dt-body-right"},Distance:{title:"dist.",className:"dt-body-right"},CostPerKm:{title:"$/km",className:"dt-body-right"},ElevCost:{title:"elev$",className:"dt-body-right"},TurnCost:{title:"turn$",className:"dt-body-right"},NodeCost:{title:"node$",className:"dt-body-right"},InitialCost:{title:"initial$",className:"dt-body-right"}},initialize:function(t){L.setOptions(this,t);var e=document.getElementById("datatable");this.tableClassName=e.className,this.tableParent=e.parentElement},onAdd:function(t){this._map=t},update:function(t,e){var a,s,i,n,l=[];if(this.active){for(a=0;e&&a<e.length;a++)s=e[a].feature.properties.messages,s&&(l=l.concat(s.slice(1)));this._destroyTable(),0!==l.length&&(n=s[0],i=this._getColumns(n,l),console.time("datatable"),this._table=$("#datatable").DataTable({destroy:!0,data:l,columns:i,paging:!1,searching:!1,info:!1,scrollY:50,scrollX:!0,scrollCollapse:!0,order:[]}),this._setEdges(t,e),$("#datatable tbody tr").hover(L.bind(this._handleHover,this),L.bind(this._handleHoverOut,this)),console.timeEnd("datatable"))}},show:function(){this.active=!0,this.options.requestUpdate(this)},hide:function(){this.active=!1},_destroyTable:function(){var t;return $.fn.DataTable.isDataTable("#datatable")&&($("#datatable").DataTable().destroy(!0),t=document.createElement("table"),t.id="datatable",t.className=this.tableClassName,this.tableParent.appendChild(t)),t||document.getElementById("datatable")},_getColumns:function(t,e){var a,s,i=[],n=this._getEmptyColumns(e);for(k=0;k<t.length;k++)a={title:t[k],visible:!n[k]},s=L.extend(a,this.columnOptions[t[k]]),i.push(s);return i},_getEmptyColumns:function(t){var e,a=new Array(t[0].length);for(e=0;e<a.length;e++)a[e]=!0;return t.forEach(function(t){t.forEach(function(t,e){a[e]=a[e]&&!t})}),a},_getMessageLatLng:function(t){var e=t[0]/1e6,a=t[1]/1e6;return L.latLng(a,e)},_setEdges:function(t,e){var a,s,i,n,l,o,d,r,h=0;for(this._edges=[],this._track=t,n=0;n<e.length;n++){for(a=e[n].feature.properties.messages,s=e[n].getLatLngs(),i=s.length,r=0,l=1;l<a.length;l++){for(o=this._getMessageLatLng(a[l]),d=r;d<i&&!o.equals(s[d]);d++);d===i&&(d=i-1,l!==a.length-1),r=d+1,this._edges.push(h+d)}h+=i}},_handleHover:function(t){var e=$(t.currentTarget),a=this._table.row(e),s=this._track.getLatLngs(),i=a.index()>0?this._edges[a.index()-1]:0,n=this._edges[a.index()],l=s.slice(i,n+1);this._selectedEdge=L.polyline(l,this.options.edgeStyle).addTo(this._map)},_handleHoverOut:function(t){this._map.removeLayer(this._selectedEdge),this._selectedEdge=null}}),BR.TrackMessages.include(L.Mixin.Events);
|
||||
BR.TrackMessages=L.Class.extend({options:{heading:"Data",edgeStyle:{color:"yellow",opacity:.8,weight:8}},active:!1,columnOptions:{Longitude:{visible:!1},Latitude:{visible:!1},Elevation:{title:"elev.",className:"dt-body-right"},Distance:{title:"dist.",className:"dt-body-right"},CostPerKm:{title:"$/km",className:"dt-body-right"},ElevCost:{title:"elev$",className:"dt-body-right"},TurnCost:{title:"turn$",className:"dt-body-right"},NodeCost:{title:"node$",className:"dt-body-right"},InitialCost:{title:"initial$",className:"dt-body-right"}},initialize:function(t){L.setOptions(this,t);var e=document.getElementById("datatable");this.tableClassName=e.className,this.tableParent=e.parentElement},onAdd:function(t){this._map=t},update:function(t,e){var a,s,i,n,l=[];if(this.active){for(a=0;e&&a<e.length;a++)s=e[a].feature.properties.messages,s&&(l=l.concat(s.slice(1)));this._destroyTable(),0!==l.length&&(n=s[0],i=this._getColumns(n,l),console.time("datatable"),this._table=$("#datatable").DataTable({destroy:!0,data:l,columns:i,paging:!1,searching:!1,info:!1,scrollY:50,scrollX:!0,order:[]}),this._setEdges(t,e),$("#datatable tbody tr").hover(L.bind(this._handleHover,this),L.bind(this._handleHoverOut,this)),console.timeEnd("datatable"))}},show:function(){this.active=!0,this.options.requestUpdate(this)},hide:function(){this.active=!1},_destroyTable:function(){var t;return $.fn.DataTable.isDataTable("#datatable")&&($("#datatable").DataTable().destroy(!0),t=document.createElement("table"),t.id="datatable",t.className=this.tableClassName,this.tableParent.appendChild(t)),t||document.getElementById("datatable")},_getColumns:function(t,e){var a,s,i=[],n=this._getEmptyColumns(e);for(k=0;k<t.length;k++)a={title:t[k],visible:!n[k]},s=L.extend(a,this.columnOptions[t[k]]),i.push(s);return i},_getEmptyColumns:function(t){var e,a=new Array(t[0].length);for(e=0;e<a.length;e++)a[e]=!0;return t.forEach(function(t){t.forEach(function(t,e){a[e]=a[e]&&!t})}),a},_getMessageLatLng:function(t){var e=t[0]/1e6,a=t[1]/1e6;return L.latLng(a,e)},_setEdges:function(t,e){var a,s,i,n,l,o,d,r,h=0;for(this._edges=[],this._track=t,n=0;n<e.length;n++){for(a=e[n].feature.properties.messages,s=e[n].getLatLngs(),i=s.length,r=0,l=1;l<a.length;l++){for(o=this._getMessageLatLng(a[l]),d=r;d<i&&!o.equals(s[d]);d++);d===i&&(d=i-1,l!==a.length-1),r=d+1,this._edges.push(h+d)}h+=i}},_handleHover:function(t){var e=$(t.currentTarget),a=this._table.row(e),s=this._track.getLatLngs(),i=a.index()>0?this._edges[a.index()-1]:0,n=this._edges[a.index()],l=s.slice(i,n+1);this._selectedEdge=L.polyline(l,this.options.edgeStyle).addTo(this._map)},_handleHoverOut:function(t){this._map.removeLayer(this._selectedEdge),this._selectedEdge=null}}),BR.TrackMessages.include(L.Mixin.Events);
|
||||
BR.TrackStats=BR.Control.extend({options:{heading:"Route"},onAdd:function(t){var d=BR.Control.prototype.onAdd.call(this,t);return this.update(),d},update:function(t,d){var e=this.calcStats(t,d),n=L.Util.formatNum(e.trackLength/1e3,1),r=L.Util.formatNum(e.trackLength/1e3,3),a=e.trackLength?L.Util.formatNum(e.cost/e.trackLength,2):"",c="";c+='<table id="stats">',c+='<tr><td>Length: </td><td title="'+r+' km">'+n+"</td><td>km</td></tr>",c+="<tr><td>Ascent filtered:</td><td>"+e.filteredAscend+"</td><td>m</td></tr>",c+="<tr><td>Ascent plain:</td><td>"+e.plainAscend+"</td><td>m</td></tr>",c+="<tr><td>Cost: </td><td>"+e.cost+"</td><td></td></tr>",c+="<tr><td>Mean cost:</td><td>"+a+"</td><td></td></tr>",c+="</table>",this._content.innerHTML=c},calcStats:function(t,d){var e,n,r={trackLength:0,filteredAscend:0,plainAscend:0,cost:0};for(e=0;d&&e<d.length;e++)n=d[e].feature.properties,r.trackLength+=+n["track-length"],r.filteredAscend+=+n["filtered ascend"],r.plainAscend+=+n["plain-ascend"],r.cost+=+n.cost;return r}});
|
||||
!function(){function t(t){function e(t){r.setOptions(t.options),r.queue.idle()||r.queue.kill(),i.rerouteAllSegments(n)}function o(t){var e=i.toPolyline(),o=i.getSegments();t.update(e,o)}function n(t){if(t)return void(t!==L.BRouter.ABORTED_ERROR&&BR.message.showError(t));BR.message.hide();var e=i.toPolyline(),o=i.getSegments(),n=i.getWaypoints(),a=i._segments,s={};c.update(e,a),BR.conf.transit?u.update(e,o):d.update(e,o),m.update(e,o),n.length>1&&(s.gpx=r.getUrl(n,"gpx"),s.kml=r.getUrl(n,"kml"),s.geojson=r.getUrl(n,"geojson"),s.csv=r.getUrl(n,"csv")),g.update(s)}var a,r,i,s,l,d,u,c,g,p,f,m,R,w,B,b,y=t.map,v=t.layersControl,C="leftpane",k=!1;y._controlCorners[C]=L.DomUtil.create("div","leaflet-"+C,y._controlContainer),document.getElementById("about_link").onclick=function(){bootbox.alert({title:"About",message:document.getElementById("about").innerHTML})},a=new BR.Search,y.addControl(a),r=L.bRouter(),R=L.easyButton({states:[{stateName:"deactivate-draw",icon:"fa-pencil active",onClick:function(t){i.draw(!1),t.state("activate-draw")},title:"Stop drawing route"},{stateName:"activate-draw",icon:"fa-pencil",onClick:function(t){i.draw(!0),t.state("deactivate-draw")},title:"Draw route"}]}),w=L.easyButton("fa-trash-o",function(){bootbox.confirm({size:"small",message:"Delete route?",callback:function(t){t&&(i.clear(),n(),b._update_routing())}})},"Clear route"),B=L.easyBar([R,w]).addTo(y),s=new BR.RoutingOptions,s.on("update",e),s.on("update",function(t){f.update(t.options)}),l=new BR.NogoAreas,l.on("update",e),BR.conf.transit?u=new BR.Itinerary:d=new BR.TrackStats,g=new BR.Download,c=new BR.Elevation,f=new BR.Profile,f.on("update",function(t){BR.message.hide();var o=s.getCustomProfile();r.uploadProfile(o,t.profileText,function(o,n){o?(f.message.showError(o),n&&(s.setCustomProfile(n,!0),r.setOptions(s.getOptions()))):(s.setCustomProfile(n,!0),e({options:s.getOptions()}),k||(f.message.showWarning("<strong>Note:</strong> Uploaded custom profiles are only cached temporarily on the server.<br/>Please save your edits to your local PC."),k=!0)),t.callback&&t.callback()})}),f.on("clear",function(t){f.message.hide(),s.setCustomProfile(null)}),m=new BR.TrackMessages({requestUpdate:o}),i=new BR.Routing({routing:{router:L.bind(r.getRouteSegment,r)},styles:BR.conf.routingStyles}),i.on("routing:routeWaypointEnd routing:setWaypointsEnd",function(t){a.clear(),n(t&&t.err)}),y.on("routing:draw-start",function(){R.state("deactivate-draw")}),y.on("routing:draw-end",function(){R.state("activate-draw")}),BR.conf.transit||y.addControl(new BR.Control({heading:"",divId:"header"})),s.addTo(y),BR.conf.transit||d.addTo(y),g.addTo(y),c.addTo(y),p=new BR.Tabs({tabs:{"#tab_itinerary":u,"#tab_profile":f,"#tab_data":m}}),BR.conf.transit||delete p.options.tabs["#tab_itinerary"],y.addControl(p),l.addTo(y),i.addTo(y),y.addControl(new BR.OpacitySlider({callback:L.bind(i.setOpacity,i)})),r.setOptions(l.getOptions()),r.setOptions(s.getOptions()),f.update(s.getOptions()),b=new L.Control.Permalink({text:"Permalink",position:"bottomright",layers:v,routingOptions:s,nogos:l,router:r,routing:i,profile:f}).addTo(y)}var e;e=BR.Map.initMap(),t(e)}();
|
||||
//# sourceMappingURL=brouter-web.js.map
|
||||
|
|
|
|||
2
dist/brouter-web.js.map
vendored
2
dist/brouter-web.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div id="message"></div>
|
||||
<div id="header" class="hidden">
|
||||
<div class="title"><span class="title-name">BRouter-Web</span> <sup class="version">0.6.2</sup></div>
|
||||
<div class="title"><span class="title-name">BRouter-Web</span> <sup class="version">0.6.3</sup></div>
|
||||
<div class="header-text">
|
||||
'esc' or 'q' to disable drawing, 'd' to enable drawing<br>
|
||||
Web client for <a href="http://brouter.de/" target="_blank">BRouter</a> · <i>work in progress</i> ·
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ BR.TrackMessages = L.Class.extend({
|
|||
// (^= minimum height with flexbox?)
|
||||
scrollY: 50,
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
order: []
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue