diff --git a/.gitignore b/.gitignore index 840d0ea..be1ac84 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,9 @@ /bin/ /demo/ /assets/js/*.js +/node_modules/* /.tx/ coverage.xml - composer.lock +npm-debug.log diff --git a/assets/maps/contao-leaflet.js b/assets/maps/contao-leaflet.js new file mode 100644 index 0000000..7dea8b5 --- /dev/null +++ b/assets/maps/contao-leaflet.js @@ -0,0 +1 @@ +L.Contao=L.Class.extend({includes:L.Mixin.Events,attribution:' | netzmacht creative',maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return e.map.attributionControl.setPrefix(e.map.attributionControl.options.prefix+this.attribution),this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;ei&&(n[n.length]=[e,t].join("=")),document.location.pathname+n.join("&")}}),L.contao=new L.Contao,L.Map.include({_dynamicBounds:null,calculateFeatureBounds:function(t,e){if(t){if(!this.options.adjustBounds&&!e)return;this._scanForBounds(t)}else this.eachLayer(this._scanForBounds,this);this._dynamicBounds&&this.fitBounds(this._dynamicBounds)},_scanForBounds:function(t){var e;t.feature&&t.feature.properties&&t.feature.properties.affectBounds?t.getBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):t.getLatLng&&(e=t.getLatLng(),this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e,e)):t.eachLayer&&t.eachLayer(this._scanForBounds,this)}}); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..9218a65 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,23 @@ +var gulp = require('gulp'); +var del = require('del'); +var sourcemaps = require('gulp-sourcemaps'); +var rename = require('gulp-rename'); +var uglify = require('gulp-uglify'); +var concat = require('gulp-concat'); + +var paths = { + minified: 'contao-leaflet.js', + scripts: ['assets/maps/src/*.js'], + dest: 'assets/maps' +}; + +gulp.task('clear', function(cb) { + del([paths.dest + '/' + paths.minified], cb); +}); + +gulp.task('scripts', ['clear'], function() { + return gulp.src(paths.scripts) + .pipe(concat(paths.minified)) + .pipe(uglify()) + .pipe(gulp.dest(paths.dest)); +});