Browse Source

build: update generated files

master
Chimo 6 years ago
parent
commit
39af6fa8bc
3 changed files with 47 additions and 44 deletions
  1. +1
    -1
      dist/chiq.map.js
  2. +1
    -1
      dist/chiq.min.js
  3. +45
    -42
      dist/chiq.unmin.js

+ 1
- 1
dist/chiq.map.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/chiq.min.js View File

@ -1,2 +1,2 @@
!function(){"use strict";var e,t,n=window.Pullet||{};n.map={create:function(e,n){var o,r=t(n),a=new ol.layer.Tile({source:new ol.source.OSM}),i=[a,r],s=r.getSource().getExtent();return o=new ol.Map({target:e,layers:i,view:new ol.View({center:[0,0],zoom:1})}),o.getView().fit(s,o.getSize(),{maxZoom:18}),o}},t=function(t){var n,o,r,a,i,s=t.length,u=[];for(n=0;s>n;n+=1)a=t[n],i=a.tags.name,o=parseFloat(a.lat),r=parseFloat(a.lon),isNaN(o)||isNaN(r)||u.push(new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([r,o],"EPSG:4326","EPSG:3857"))}));return new ol.layer.Vector({source:new ol.source.Vector({features:u}),style:e("/images/marker-green.png")})},e=function(e){return new ol.style.Style({image:new ol.style.Icon({anchor:[.5,46],anchorXUnits:"fraction",anchorYUnits:"pixels",opacity:.75,src:e})})},$("[data-mapcontainer]").each(function(){var e=$(this),t=$(e.data("mapcontainer")),o=[];e.find(".poi").each(function(){var e=$(this);o.push({tags:{name:e.find(".poi__name").text()},lat:e.find(".poi__lat").text(),lon:e.find(".poi__lon").text()})}),n.map.create(t.get(0),o)}),window.Pullet=n}(),function(){"use strict";var e,t=window.Pullet||{};t.nominatim={lookup:function(t){var n,o,r,a=window.Pullet.endpoint.nominatim+"/lookup",i=t.length,s=[],u=[],l=0,c=[],y=t.slice();return new Promise(function(p){for(Array.isArray(t)&&0!==t.length||p([]);t.length>0;){for(u=[],r=t.splice(0,50),i=r.length,o=0;i>o;o+=1)u.push(r[o].fid);s.push(u)}for(o=0,i=s.length;i>o;o+=1)n="format=json&osm_ids="+s[o].join(),$.get(a,n).done(function(e){c=c.concat(e)}).always(function(){var t,n,o,r,a;if(l+=1,l===i){for(n=c.length,t=0;n>t;t+=1)o=c[t],r=e(o.osm_id,y),r!==!1&&(a=y[r],a.fill(o),y[r]=a);p(y)}})})}},e=function(e,t){var n,o,r=t.length;for(n=0;r>n;n+=1)if(o=t[n],o.osm_id===parseInt(e,10))return n;return!1},window.Pullet=t}(),function(){"use strict";var e,t=window.Pullet||{};e=function(e){this.osm_id=e.id,this.name=e.name,this.tags=e.tags,this.lat=e.lat,this.lon=e.lon,this.osm_type=e.type,this.fid=e.type.slice(0,1).toUpperCase()+e.id},e.prototype.fill=function(e){this.address=e.address,this.class=e.class,this.name||(this.name=e.display_name),this.display_name=e.display_name,this.lat=e.lat,this.lon=e.lon,this.nom_id=e.place_id,this.nom_type=e.type},t.Place=e,window.Pullet=t}(),function(){"use strict";var e,t,n=window.Pullet||{};n.places={nearby:function(){return Pullet.getLocation().then(function(e){var t=e.coords;return Pullet.places.near(t.latitude,t.longitude)}).catch(function(e){return Promise.reject(e)})},near:function(e,t){var n,o=Pullet.endpoint.overpass,r=300,a="<around lon='"+t+"' lat='"+e+"' radius='"+r+"'/>",i="<has-kv k='name'/>";return n="<osm-script output='json' timeout='25'><union><query type='node'><has-kv k='amenity'/>"+a+i+"</query><query type='way'><has-kv k='amenity'/>"+a+i+"</query><query type='node'><has-kv k='shop'/>"+a+i+"</query><query type='way'><has-kv k='shop'/>"+a+i+"</query><query type='node'><has-kv k='office'/>"+a+i+"</query><query type='way'><has-kv k='office'/>"+a+i+"</query><query type='node'><has-kv k='craft'/>"+a+i+"</query><query type='way'><has-kv k='craft'/>"+a+i+"</query><query type='node'><has-kv k='leisure'/>"+a+i+"</query><query type='way'><has-kv k='leisure'/>"+a+i+"</query><query type='node'><has-kv k='public_transport' v='platform'/>"+a+i+"</query><query type='way'><has-kv k='public_transport' v='platform'/>"+a+i+"</query><query type='node'><has-kv k='highway' v='bus_stop'/>"+a+i+"</query><query type='way'><has-kv k='highway' v='bus_stop'/>"+a+i+"</query></union><print mode='body' order='quadtile'/></osm-script>",$.post(o,n).then(function(e){var t,n=e.elements,o=n.length,r=[];for(t=0;o>t;t+=1)r.push(new Pullet.Place(n[t]));return r})},fillDistance:function(e,t){var n,o,r,a=t.length,i=new LatLon(e.lat,e.lon);for(n=0;a>n;n+=1)o=t[n],r=new LatLon(o.lat,o.lon),t[n].distance=i.distanceTo(r);return t},sortByAlpha:function(t){return t.sort(e)},sortByDistance:function(e,o){return o=n.places.fillDistance(e,o),o.sort(t)}},t=function(e,t){var n=e.distance,o=t.distance;return o>n?-1:n>o?1:0},e=function(e,t){var n=e.tags.name||"",o=t.tags.name||"";return n=n.toLowerCase(),o=o.toLowerCase(),o>n?-1:n>o?1:0},window.Pullet=n}(),function(){"use strict";var e=window.Pullet||{};e.getLocation=function(){return new Promise(function(e,t){navigator.geolocation.getCurrentPosition(function(t){e(t)},function(e){t(e)})})},window.Pullet=e}();
!function(){"use strict";var e,t,n=window.Pullet||{};n.map={create:function(e,n){var o,r=t(n),a=new ol.layer.Tile({source:new ol.source.OSM}),i=[a,r],s=r.getSource().getExtent();return o=new ol.Map({target:e,layers:i,view:new ol.View({center:[0,0],zoom:1})}),o.getView().fit(s,o.getSize(),{maxZoom:18}),o}},t=function(t){var n,o,r,a,i,s=t.length,u=[];for(n=0;s>n;n+=1)a=t[n],i=a.tags.name,o=parseFloat(a.lat),r=parseFloat(a.lon),isNaN(o)||isNaN(r)||u.push(new ol.Feature({geometry:new ol.geom.Point(ol.proj.transform([r,o],"EPSG:4326","EPSG:3857"))}));return new ol.layer.Vector({source:new ol.source.Vector({features:u}),style:e("/images/marker-green.png")})},e=function(e){return new ol.style.Style({image:new ol.style.Icon({anchor:[.5,46],anchorXUnits:"fraction",anchorYUnits:"pixels",opacity:.75,src:e})})},$("[data-mapcontainer]").each(function(){var e=$(this),t=$(e.data("mapcontainer")),o=[];e.find(".poi").each(function(){var e=$(this);o.push({tags:{name:e.find(".poi__name").text()},lat:e.find(".poi__lat").text(),lon:e.find(".poi__lon").text()})}),n.map.create(t.get(0),o)}),window.Pullet=n}(),function(){"use strict";var e,t=window.Pullet||{};t.nominatim={lookup:function(t){var n,o,r,a=window.Pullet.endpoint.nominatim+"/lookup",i=t.length,s=[],u=[],l=0,c=[],y=t.slice();return r=function(t){var n,o,r,a,s;if(l+=1,l===i){for(o=c.length,n=0;o>n;n+=1)r=c[n],a=e(r.osm_id,y),a!==!1&&(s=y[a],s.fill(r),y[a]=s);t(y)}},new Promise(function(e){for(Array.isArray(t)&&0!==t.length||e([]);t.length>0;){for(u=[],o=t.splice(0,50),i=o.length,n=0;i>n;n+=1)u.push(o[n].fid);s.push(u)}for(n=0,i=s.length;i>n;n+=1)xr.get(a,{format:"json",osm_ids:s[n].join()}).then(function(t){c=c.concat(t),r(e)}).catch(function(){r(e)})})}},e=function(e,t){var n,o,r=t.length;for(n=0;r>n;n+=1)if(o=t[n],o.osm_id===parseInt(e,10))return n;return!1},window.Pullet=t}(),function(){"use strict";var e,t=window.Pullet||{};e=function(e){this.osm_id=e.id,this.name=e.name,this.tags=e.tags,this.lat=e.lat,this.lon=e.lon,this.osm_type=e.type,this.fid=e.type.slice(0,1).toUpperCase()+e.id},e.prototype.fill=function(e){this.address=e.address,this.class=e.class,this.name||(this.name=e.display_name),this.display_name=e.display_name,this.lat=e.lat,this.lon=e.lon,this.nom_id=e.place_id,this.nom_type=e.type},t.Place=e,window.Pullet=t}(),function(){"use strict";var e,t,n=window.Pullet||{};n.places={nearby:function(){return Pullet.getLocation().then(function(e){var t=e.coords;return Pullet.places.near(t.latitude,t.longitude)}).catch(function(e){return Promise.reject(e)})},near:function(e,t){var n,o=Pullet.endpoint.overpass,r=300,a="<around lon='"+t+"' lat='"+e+"' radius='"+r+"'/>",i="<has-kv k='name'/>";return n="<osm-script output='json' timeout='25'><union><query type='node'><has-kv k='amenity'/>"+a+i+"</query><query type='way'><has-kv k='amenity'/>"+a+i+"</query><query type='node'><has-kv k='shop'/>"+a+i+"</query><query type='way'><has-kv k='shop'/>"+a+i+"</query><query type='node'><has-kv k='office'/>"+a+i+"</query><query type='way'><has-kv k='office'/>"+a+i+"</query><query type='node'><has-kv k='craft'/>"+a+i+"</query><query type='way'><has-kv k='craft'/>"+a+i+"</query><query type='node'><has-kv k='leisure'/>"+a+i+"</query><query type='way'><has-kv k='leisure'/>"+a+i+"</query><query type='node'><has-kv k='public_transport' v='platform'/>"+a+i+"</query><query type='way'><has-kv k='public_transport' v='platform'/>"+a+i+"</query><query type='node'><has-kv k='highway' v='bus_stop'/>"+a+i+"</query><query type='way'><has-kv k='highway' v='bus_stop'/>"+a+i+"</query></union><print mode='body' order='quadtile'/></osm-script>",xr.post(o,n).then(function(e){var t,n=e.elements,o=n.length,r=[];for(t=0;o>t;t+=1)r.push(new Pullet.Place(n[t]));return r})},fillDistance:function(e,t){var n,o,r,a=t.length,i=new LatLon(e.lat,e.lon);for(n=0;a>n;n+=1)o=t[n],r=new LatLon(o.lat,o.lon),t[n].distance=i.distanceTo(r);return t},sortByAlpha:function(t){return t.sort(e)},sortByDistance:function(e,o){return o=n.places.fillDistance(e,o),o.sort(t)}},t=function(e,t){var n=e.distance,o=t.distance;return o>n?-1:n>o?1:0},e=function(e,t){var n=e.tags.name||"",o=t.tags.name||"";return n=n.toLowerCase(),o=o.toLowerCase(),o>n?-1:n>o?1:0},window.Pullet=n}(),function(){"use strict";var e=window.Pullet||{};e.getLocation=function(){return new Promise(function(e,t){navigator.geolocation.getCurrentPosition(function(t){e(t)},function(e){t(e)})})},window.Pullet=e}();
//# sourceMappingURL=dist/chiq.map.js

+ 45
- 42
dist/chiq.unmin.js View File

@ -122,7 +122,7 @@
}() );
( function() {
/*global Promise: false*/
/*global Promise: false, xr: false*/
"use strict";
var _Pullet = window.Pullet || {},
@ -131,16 +131,52 @@
_Pullet.nominatim = {
lookup: function( points ) {
var endpoint = window.Pullet.endpoint.nominatim + "/lookup",
query,
i,
len = points.length,
batch,
batches = [],
ids = [],
callback,
batchesCompleted = 0,
results = [],
origs = points.slice(); /* Make a copy of the original array since splice modifies it. TODO: Revise this. */
callback = function( resolve ) {
var j,
len2,
result,
index,
place;
batchesCompleted += 1;
// FIXME: technically, we could start filling Places before all
// data is received from Nominatim
if ( batchesCompleted === len ) {
len2 = results.length;
for ( j = 0; j < len2; j += 1 ) {
result = results[ j ];
// Find `Place` matching osm_id from `origs` collection
index = findPlace( result.osm_id, origs );
if ( index === false ) {
continue;
}
// Fill data
place = origs[ index ];
place.fill( result );
// Overwrite original
origs[ index ] = place;
}
resolve( origs );
}
};
return new Promise( function( resolve/*, reject*/ ) {
/* Don't contact endpoint if we have no data or bad param */
if ( !Array.isArray( points ) || points.length === 0 ) {
@ -161,48 +197,15 @@
}
for ( i = 0, len = batches.length; i < len; i += 1 ) {
query = "format=json&osm_ids=" + batches[ i ].join();
$.get( endpoint, query )
.done( function( data ) {
xr.get( endpoint, { format: "json", osm_ids: batches[ i ].join() } )
.then( function( data ) {
results = results.concat( data );
} )
.always( function() {
var j,
len2,
result,
index,
place;
batchesCompleted += 1;
// FIXME: technically, we could start filling Places before all
// data is received from Nominatim
if ( batchesCompleted === len ) {
len2 = results.length;
for ( j = 0; j < len2; j += 1 ) {
result = results[ j ];
// Find `Place` matching osm_id from `origs` collection
index = findPlace( result.osm_id, origs );
if ( index === false ) {
continue;
}
// Fill data
place = origs[ index ];
place.fill( result );
// Overwrite original
origs[ index ] = place;
}
resolve( origs );
}
callback( resolve );
} )
.catch( function() {
callback( resolve );
} );
}
} );
}
@ -407,7 +410,7 @@
"</osm-script>";
// Fetch POIs
return $.post( endpoint, xml )
return xr.post( endpoint, xml )
.then( function( data ) {
var elms = data.elements,
len = elms.length,


Loading…
Cancel
Save