diff --git a/.gitignore b/.gitignore index 692294e..8a8b2f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,18 @@ npm-debug.log node_modules -bootstrap-slider/* -crumble/* -FileSaver.js/* -Font-Awesome/* -jquery-cookie/* -Leaflet.FileLayer/* -leaflet-sidebar/* -simplify-geometry/* -togeojson/* -togpx/* -tokml/* -geojson-to-path/* -pretty-data/* +vendor/bootstrap-slider/* +vendor/crumble/* +vendor/FileSaver.js/* +vendor/Font-Awesome/* +vendor/jquery-cookie/* +vendor/Leaflet.FileLayer/* +vendor/leaflet-sidebar/* +vendor/simplify-geometry/* +vendor/togeojson/* +vendor/togpx/* +vendor/tokml/* +vendor/geojson-to-path/* +vendor/pretty-data/* +vendor/jquery-autocomplete/* +css/.sass-cache +*.swp diff --git a/.gitmodules b/.gitmodules index e3f13c1..8cf0155 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,6 @@ [submodule "pretty-data"] path = vendor/pretty-data url = https://github.com/Wilkins/pretty-data.git +[submodule "vendor/jquery-autocomplete"] + path = vendor/jquery-autocomplete + url = https://github.com/devbridge/jQuery-Autocomplete diff --git a/Gruntfile.js b/Gruntfile.js index 4c9866d..2a7d4e6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,120 +3,151 @@ module.exports = function(grunt) { grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - clean: { - dist: { - src: ['dist/*'] - } - }, - jshint: { - options: { - globals: { - console: true, - module: true - }, - "-W099": true, //ignora tabs e space warning - "-W033": true, - "-W044": true //ignore regexp - }, - files: ['main.js', 'formats.js', 'formats/*.js'] - }, - uglify: { - dist: { - files: { - 'dist/jquery.cookie.min.js': ['vendor/jquery-cookie/jquery.cookie.js'], - 'dist/L.Control.Sidebar.min.js': ['vendor/leaflet-sidebar/src/L.Control.Sidebar.js'], - 'dist/togeojson.min.js': ['vendor/togeojson/togeojson.js'], - 'dist/togpx.min.js': ['vendor/togpx/togpx.js'], - 'dist/pretty-data.min.js': ['vendor/pretty-data/index.js'], - 'dist/tokml.min.js': ['vendor/tokml/tokml.js'], - 'dist/geojson-to-path.min.js': ['vendor/geojson-to-path/geojson-to-path.js'], - 'dist/leaflet.filelayer.min.js': ['vendor/Leaflet.FileLayer/leaflet.filelayer.js'], - 'dist/FileSaver.min.js': ['vendor/FileSaver.js/FileSaver.js'], - 'dist/formats.min.js': ['formats.js', 'formats/*'], - 'dist/main.min.js': ['main.js'] - } - } - }, - concat: { - //TODO cut out SearchMarker - options: { - separator: ';\n', - stripBanners: { - block: true - } - }, - dist: { - src: [ - 'dist/jquery.cookie.min.js', - 'dist/L.Control.Sidebar.min.js', - 'dist/togeojson.min.js', - 'dist/togpx.min.js', - 'dist/pretty-data.min.js', - 'dist/tokml.min.js', - 'dist/geojson-to-path.min.js', - 'dist/leaflet.filelayer.min.js', - 'dist/FileSaver.min.js', - 'vendor/simplify-geometry/simplifygeometry-0.0.1.min.js', - 'vendor/bootstrap-slider/dist/bootstrap-slider.min.js', - //'crumble/js/jquery.grumble.min.js', - //'crumble/js/jquery.crumble.min.js', - 'social.js', - 'dist/formats.min.js', - 'dist/main.min.js' - ], - dest: 'dist/app.min.js' - } - }, - cssmin: { - combine: { - src: [ - 'vendor/bootstrap-slider/dist/css/bootstrap-slider.min.css', - 'vendor/leaflet-sidebar/src/L.Control.Sidebar.css', - //'crumble/css/grumble.min.css', - //'crumble/css/crumble.css', - 'style.css' - ], - dest: 'dist/style.min.css' - }, - minify: { - expand: true, - cwd: 'dist/', - src: '<%= cssmin.combine.dest %>' - //,dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.min.css' - } - }, - // copy: { - // crumble: { - // expand: true, - // nonull: true, - // flatten: true, - // src: 'crumble/images/*', - // dest: 'images/' - // } - // }, - watch: { - dist: { - options: { livereload: true }, - files: ['main.js','index.html','style.css'], - tasks: ['clean','jshint','uglify','concat','cssmin'] - } - } + pkg: grunt.file.readJSON('package.json'), + clean: { + css: { + src: ['dist/*.css'] + }, + js: { + src: ['dist/*.js'] + } + }, + jshint: { + options: { + globals: { + console: true, + module: true + }, + "-W099": true, //ignora tabs e space warning + "-W033": true, + "-W044": true //ignore regexp + }, + files: ['js/main.js', 'js/formats.js', 'js/formats/*.js', 'js/layers.js',] + }, + uglify: { + dist: { + files: { + 'dist/jquery.cookie.min.js': ['vendor/jquery-cookie/jquery.cookie.js'], + 'dist/L.Control.Sidebar.min.js': ['vendor/leaflet-sidebar/src/L.Control.Sidebar.js'], + 'dist/togeojson.min.js': ['vendor/togeojson/togeojson.js'], + 'dist/togpx.min.js': ['vendor/togpx/togpx.js'], + 'dist/pretty-data.min.js': ['vendor/pretty-data/index.js'], + 'dist/tokml.min.js': ['vendor/tokml/tokml.js'], + 'dist/geojson-to-path.min.js': ['vendor/geojson-to-path/geojson-to-path.js'], + 'dist/leaflet.filelayer.min.js': ['vendor/Leaflet.FileLayer/leaflet.filelayer.js'], + 'dist/FileSaver.min.js': ['vendor/FileSaver.js/FileSaver.js'], + // Repository files + 'dist/formats.min.js': ['js/formats.js', 'js/formats/*'], + 'dist/layers.min.js': ['js/layers.js'], + 'dist/planes.min.js': ['js/planes.js'], + 'dist/main.min.js': ['js/main.js'] + } + } + }, + concat: { + //TODO cut out SearchMarker + options: { + separator: ';\n', + stripBanners: { + block: true + } + }, + dist: { + src: [ + 'dist/jquery.cookie.min.js', + 'dist/L.Control.Sidebar.min.js', + 'dist/togeojson.min.js', + 'dist/togpx.min.js', + 'dist/pretty-data.min.js', + 'dist/tokml.min.js', + 'dist/geojson-to-path.min.js', + 'dist/leaflet.filelayer.min.js', + 'dist/FileSaver.min.js', + 'vendor/simplify-geometry/simplifygeometry-0.0.1.min.js', + 'vendor/bootstrap-slider/dist/bootstrap-slider.min.js', + 'vendor/jquery-autocomplete/dist/jquery.autocomplete.min.js', + //'crumble/js/jquery.grumble.min.js', + //'crumble/js/jquery.crumble.min.js', + + // Repository files + 'js/social.js', + 'dist/formats.min.js', + //'dist/planes.min.js', + 'dist/layers.min.js', + 'dist/main.min.js' + ], + dest: 'dist/app.min.js' + } + }, + sass: { + dist: { + options: { + style: 'nested', + sourcemap: 'none', + cacheLocation: 'css/.sass-cache' + }, + files: { + 'dist/style.css': 'css/style.scss' + } + } + }, + + cssmin: { + combine: { + src: [ + 'vendor/bootstrap-slider/dist/css/bootstrap-slider.min.css', + 'vendor/leaflet-sidebar/src/L.Control.Sidebar.css', + //'crumble/css/grumble.min.css', + //'crumble/css/crumble.css', + 'dist/style.css' + ], + dest: 'dist/style.min.css' + }, + minify: { + expand: true, + cwd: 'dist/', + src: '<%= cssmin.combine.dest %>' + //,dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.min.css' + } + }, + // copy: { + // crumble: { + // expand: true, + // nonull: true, + // flatten: true, + // src: 'crumble/images/*', + // dest: 'images/' + // } + // }, + watch: { + css: { + options: { livereload: true }, + files: ['css/style.scss'], + tasks: ['clean:css', 'sass', 'cssmin'] + }, + js: { + options: { livereload: true }, + files: ['js/*'], + tasks: ['clean:js', 'jshint', 'uglify', 'concat'] + } + } }); grunt.registerTask('default', [ - 'clean', - 'jshint', - 'uglify', - 'concat', - 'cssmin', - //'copy' + 'clean', + 'jshint', + 'uglify', + 'concat', + 'sass', + 'cssmin', + //'copy' ]); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-clean'); +grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); diff --git a/css/style.scss b/css/style.scss new file mode 100644 index 0000000..d5edce3 --- /dev/null +++ b/css/style.scss @@ -0,0 +1,295 @@ + +$main-color : rgb(77, 91, 105); +$text-color: #eee; +$side-color: rgba(220, 230, 240, 1); +$map-margin: 40px; + +body { + background: $main-color; + color: $text-color; +} + +h4 { + float: left; + letter-spacing: .065em; + margin: 5px 20px 5px 10px; + padding: 5px; + text-shadow: 1px 1px 3px #333; + + a { + color: $text-color; + + &:hover { + color: #fff; + } + } +} + +#map { + background: $side-color; + bottom: $map-margin; + left: 0; + position: absolute; + right: 0; + top: $map-margin; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.leaflet-bar { + a { + color: $main-color; + + &:first-child { + background: #fff; + font-size: 18px; + } + + &:last-of-type { + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + } + } +} + +.leaflet-control-switcher-box { + background-color: $text-color; + color: $main-color; + display: none; + padding: 5px; + text-align: center; + + select { + border: 1px solid $main-color; + display: block; + width: 200px; + } +} + +.leaflet-control-stats { + color: $main-color; + font-size: 20px; + text-shadow: 1px 1px 2px #fff; +} + + +.leaflet-sidebar a.close { + background: $side-color; + // border: 1px solid #ccc; + box-shadow: 0 1px 3px rgba(0, 0, 0, .65); + color: $main-color; + font-size: 20pt; + height: 23px; + left: -10px; + opacity: 1; + right: auto; + top: 1px; + width: 23px; +} + +#sidebar { + background: $side-color; + box-shadow: 0 1px 4px rgba(0, 0, 0, .6); + color: $main-color; + overflow-y: auto; + padding: 8px; +} + +#slider_wrap { + bottom: 0; + height: $map-margin; + left: 0; + padding: 10px 20px; + position: absolute; + right: 0; + + #slider { + visibility: hidden; + } + + .slider-handle { + background: #7d8b99; + opacity: 1; + } +} + +#modal { + z-index: 2000; + + .modal-content { + border: 2px solid $text-color; + border-radius: 0; + } + + .modal-header { + background: $main-color; + color: #fff; + font-weight: bold; + + .close { + color: #fff; + font-size: 2.5em; + line-height: 1.2em; + opacity: 1; + text-shadow: none; + } + } + + .modal-body { + padding: 12px; + text-align: center; + } +} + +#credits .list-group-item.active { + background: $main-color; + color: #fff; +} + +#social { + padding: 8px; + position: fixed; + right: 220px; + top: 0; + z-index: 800; + + .fb-like { + line-height: 12px; + } +} + +#copy { + background: #424b54; + border-radius: .7em; + box-shadow: 0 0 8px $text-color; + color: $text-color; + opacity: .8; + padding: 8px 8px 2px 8px; + position: fixed; + right: 30px; + top: -8px; + z-index: 1000; + + a { + color: #ccc; + text-decoration: none; + + &:hover { + color: #fff; + } + } +} + +#ribbon { + border: 0; + opacity: .8; + position: absolute; + right: 0; + top: 0; +} + +@mixin popup { + background-color: $text-color; + border: 2px solid transparentize($main-color, .5); + border-radius: 4px; + display: none; + margin-left: 45px; + position: absolute; +} + +.formats { + @include popup; + width: 200px; + + a { + color: $main-color; + cursor: pointer; + display: block; + font-weight: bold; + height: 30px; + padding: 3px; + + &:hover { + background-color: $main-color; + color: $text-color; + text-decoration: none; + } + } +} + +#export-format { + background-color: $main-color; + border-radius: 2px; + height: 500px; + margin: auto; + overflow: hidden; + padding: 5px; + position: absolute; + width: 750px; + + .actions { + padding: 10px; + text-align: center; + } + + pre { + margin: auto; + padding: 0; + } + + code { + display: block; + height: 400px; + margin: 2px; + overflow: auto; + width: 730px; + } + + h5 { + color: $text-color; + font-size: 20px; + text-align: center; + } + + a { + background-color: $text-color; + border: 1px solid $text-color; + color: $main-color; + font-weight: bold; + padding: 2px 4px; + } +} + +.planes { + @include popup; + color: $main-color; + font-weight: bold; + padding: 5px; + width: 320px; + + label { + clear: both; + float: left; + width: 50px; + } + + input { + border: 1px solid $main-color; + padding: 2px; + width: 240px; + } +} + +.autocomplete-suggestion { + background-color: $text-color; + border-bottom: 1px solid $main-color; + color: $main-color; + cursor: pointer; +} + + + diff --git a/dist/app.min.js b/dist/app.min.js index 37ab04a..575efc4 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -9,6 +9,7 @@ var FileLoader=L.Class.extend({includes:L.Mixin.Events,options:{layerOptions:{}, var saveAs=saveAs||"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator)||function(a){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var b=a.document,c=function(){return a.URL||a.webkitURL||a},d=b.createElementNS("http://www.w3.org/1999/xhtml","a"),e=!a.externalHost&&"download"in d,f=function(c){var d=b.createEvent("MouseEvents");d.initMouseEvent("click",!0,!1,a,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(d)},g=a.webkitRequestFileSystem,h=a.requestFileSystem||g||a.mozRequestFileSystem,i=function(b){(a.setImmediate||a.setTimeout)(function(){throw b},0)},j="application/octet-stream",k=0,l=[],m=function(){for(var a=l.length;a--;){var b=l[a];"string"==typeof b?c().revokeObjectURL(b):b.remove()}l.length=0},n=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"==typeof e)try{e.call(a,c||a)}catch(f){i(f)}}},o=function(b,i){var m,o,p,q=this,r=b.type,s=!1,t=function(){var a=c().createObjectURL(b);return l.push(a),a},u=function(){n(q,"writestart progress write writeend".split(" "))},v=function(){(s||!m)&&(m=t(b)),o?o.location.href=m:window.open(m,"_blank"),q.readyState=q.DONE,u()},w=function(a){return function(){return q.readyState!==q.DONE?a.apply(this,arguments):void 0}},x={create:!0,exclusive:!1};return q.readyState=q.INIT,i||(i="download"),e?(m=t(b),d.href=m,d.download=i,f(d),q.readyState=q.DONE,void u()):(a.chrome&&r&&r!==j&&(p=b.slice||b.webkitSlice,b=p.call(b,0,b.size,j),s=!0),g&&"download"!==i&&(i+=".download"),(r===j||g)&&(o=a),h?(k+=b.size,void h(a.TEMPORARY,k,w(function(a){a.root.getDirectory("saved",x,w(function(a){var c=function(){a.getFile(i,x,w(function(a){a.createWriter(w(function(c){c.onwriteend=function(b){o.location.href=a.toURL(),l.push(a),q.readyState=q.DONE,n(q,"writeend",b)},c.onerror=function(){var a=c.error;a.code!==a.ABORT_ERR&&v()},"writestart progress write abort".split(" ").forEach(function(a){c["on"+a]=q["on"+a]}),c.write(b),q.abort=function(){c.abort(),q.readyState=q.DONE},q.readyState=q.WRITING}),v)}),v)};a.getFile(i,{create:!1},w(function(a){a.remove(),c()}),w(function(a){a.code===a.NOT_FOUND_ERR?c():v()}))}),v)}),v)):void v())},p=o.prototype,q=function(a,b){return new o(a,b)};return p.abort=function(){var a=this;a.readyState=a.DONE,n(a,"abort")},p.readyState=p.INIT=0,p.WRITING=1,p.DONE=2,p.error=p.onwritestart=p.onprogress=p.onwrite=p.onabort=p.onerror=p.onwriteend=null,a.addEventListener("unload",m,!1),q.unload=function(){m(),a.removeEventListener("unload",m,!1)},q}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);"undefined"!=typeof module&&null!==module?module.exports=saveAs:"undefined"!=typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});; !function(e){if("function"==typeof bootstrap)bootstrap("simplifygeometry",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeSimplifyGeometry=e}else"undefined"!=typeof window?window.simplifyGeometry=e():global.simplifyGeometry=e()}(function(){return function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o="function"==typeof require&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}for(var r="function"==typeof require&&require,s=0;sdmax&&(index=i,dmax=d);if(dmax>tolerance)var results_one=simplifyGeometry(points.slice(0,index),tolerance),results_two=simplifyGeometry(points.slice(index,points.length),tolerance),results=results_one.concat(results_two);else results=points.length>1?[points[0],points[points.length-1]]:[points[0]];return results};module.exports=simplifyGeometry},{"./line":2}],2:[function(require,module){var Line=function(p1,p2){this.p1=p1,this.p2=p2};Line.prototype.rise=function(){return this.p2[1]-this.p1[1]},Line.prototype.run=function(){return this.p2[0]-this.p1[0]},Line.prototype.slope=function(){return this.rise()/this.run()},Line.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Line.prototype.isVertical=function(){return!isFinite(this.slope())},Line.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Line.prototype._perpendicularDistanceHorizontal=function(point){return Math.abs(this.p1[1]-point[1])},Line.prototype._perpendicularDistanceVertical=function(point){return Math.abs(this.p1[0]-point[0])},Line.prototype._perpendicularDistanceHasSlope=function(point){var slope=this.slope(),y_intercept=this.yIntercept();return Math.abs(slope*point[0]-point[1]+y_intercept)/Math.sqrt(Math.pow(slope,2)+1)},Line.prototype.perpendicularDistance=function(point){return this.isVertical()?this._perpendicularDistanceVertical(point):this.isHorizontal()?this._perpendicularDistanceHorizontal(point):this._perpendicularDistanceHasSlope(point)},module.exports=Line},{}]},{},[1])(1)});; !function(a){function b(b,d){if(g[b]){var e=c(this),f=g[b].apply(e,d);return"undefined"==typeof f?a(this):f}throw new Error("method '"+b+"()' does not exist for slider.")}function c(b){var c=a(b).data("slider");if(c&&c instanceof f)return c;throw new Error(e.callingContextNotSliderInstance)}function d(b){var c=a(this);return c.each(function(){var c=a(this),d=c.data("slider"),e="object"==typeof b&&b;d&&!e&&(e={},a.each(a.fn.slider.defaults,function(a){e[a]=d[a]})),c.data("slider",new f(this,a.extend({},a.fn.slider.defaults,e)))}),c}var e={formatInvalidInputErrorMsg:function(a){return"Invalid input value '"+a+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"},f=function(b,c){var d=this.element=a(b).hide(),e=a(b)[0].style.width,f=!1,g=this.element.parent();g.hasClass("slider")===!0?(f=!0,this.picker=g):this.picker=a('
').insertBefore(this.element).append(this.element),this.id=this.element.data("slider-id")||c.id,this.id&&(this.picker[0].id=this.id),("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch)&&(this.touchCapable=!0);var h=this.element.data("slider-tooltip")||c.tooltip;switch(this.tooltip=this.picker.find("#tooltip"),this.tooltipInner=this.tooltip.find("div.tooltip-inner"),this.tooltip_min=this.picker.find("#tooltip_min"),this.tooltipInner_min=this.tooltip_min.find("div.tooltip-inner"),this.tooltip_max=this.picker.find("#tooltip_max"),this.tooltipInner_max=this.tooltip_max.find("div.tooltip-inner"),f===!0&&(this.picker.removeClass("slider-horizontal"),this.picker.removeClass("slider-vertical"),this.tooltip.removeClass("hide"),this.tooltip_min.removeClass("hide"),this.tooltip_max.removeClass("hide")),this.orientation=this.element.data("slider-orientation")||c.orientation,this.orientation){case"vertical":this.picker.addClass("slider-vertical"),this.stylePos="top",this.mousePos="pageY",this.sizePos="offsetHeight",this.tooltip.addClass("right")[0].style.left="100%",this.tooltip_min.addClass("right")[0].style.left="100%",this.tooltip_max.addClass("right")[0].style.left="100%";break;default:this.picker.addClass("slider-horizontal").css("width",e),this.orientation="horizontal",this.stylePos="left",this.mousePos="pageX",this.sizePos="offsetWidth",this.tooltip.addClass("top")[0].style.top=-this.tooltip.outerHeight()-14+"px",this.tooltip_min.addClass("top")[0].style.top=-this.tooltip_min.outerHeight()-14+"px",this.tooltip_max.addClass("top")[0].style.top=-this.tooltip_max.outerHeight()-14+"px"}var i=this;switch(a.each(["min","max","step","precision","value","reversed","handle"],function(a,b){i[b]="undefined"!=typeof d.data("slider-"+b)?d.data("slider-"+b):"undefined"!=typeof c[b]?c[b]:"undefined"!=typeof d.prop(b)?d.prop(b):0}),this.value instanceof Array?f&&!this.range?this.value=this.value[0]:this.range=!0:this.range&&(this.value=[this.value,this.max]),this.selection=this.element.data("slider-selection")||c.selection,this.selectionEl=this.picker.find(".slider-selection"),"none"===this.selection&&this.selectionEl.addClass("hide"),this.selectionElStyle=this.selectionEl[0].style,this.handle1=this.picker.find(".slider-handle:first"),this.handle1Stype=this.handle1[0].style,this.handle2=this.picker.find(".slider-handle:last"),this.handle2Stype=this.handle2[0].style,f===!0&&(this.handle1.removeClass("round triangle"),this.handle2.removeClass("round triangle hide")),this.handle){case"round":this.handle1.addClass("round"),this.handle2.addClass("round");break;case"triangle":this.handle1.addClass("triangle"),this.handle2.addClass("triangle")}this.offset=this.picker.offset(),this.size=this.picker[0][this.sizePos],this.formater=c.formater,this.tooltip_separator=c.tooltip_separator,this.tooltip_split=c.tooltip_split,this.setValue(this.value),this.handle1.on({keydown:a.proxy(this.keydown,this,0)}),this.handle2.on({keydown:a.proxy(this.keydown,this,1)}),this.touchCapable&&this.picker.on({touchstart:a.proxy(this.mousedown,this)}),this.picker.on({mousedown:a.proxy(this.mousedown,this)}),"hide"===h?(this.tooltip.addClass("hide"),this.tooltip_min.addClass("hide"),this.tooltip_max.addClass("hide")):"always"===h?(this.showTooltip(),this.alwaysShowTooltip=!0):(this.picker.on({mouseenter:a.proxy(this.showTooltip,this),mouseleave:a.proxy(this.hideTooltip,this)}),this.handle1.on({focus:a.proxy(this.showTooltip,this),blur:a.proxy(this.hideTooltip,this)}),this.handle2.on({focus:a.proxy(this.showTooltip,this),blur:a.proxy(this.hideTooltip,this)})),this.enabled=c.enabled&&(void 0===this.element.data("slider-enabled")||this.element.data("slider-enabled")===!0),this.enabled?this.enable():this.disable(),this.natural_arrow_keys=this.element.data("slider-natural_arrow_keys")||c.natural_arrow_keys};f.prototype={constructor:f,over:!1,inDrag:!1,showTooltip:function(){this.tooltip_split===!1?this.tooltip.addClass("in"):(this.tooltip_min.addClass("in"),this.tooltip_max.addClass("in")),this.over=!0},hideTooltip:function(){this.inDrag===!1&&this.alwaysShowTooltip!==!0&&(this.tooltip.removeClass("in"),this.tooltip_min.removeClass("in"),this.tooltip_max.removeClass("in")),this.over=!1},layout:function(){var a;if(a=this.reversed?[100-this.percentage[0],this.percentage[1]]:[this.percentage[0],this.percentage[1]],this.handle1Stype[this.stylePos]=a[0]+"%",this.handle2Stype[this.stylePos]=a[1]+"%","vertical"===this.orientation)this.selectionElStyle.top=Math.min(a[0],a[1])+"%",this.selectionElStyle.height=Math.abs(a[0]-a[1])+"%";else{this.selectionElStyle.left=Math.min(a[0],a[1])+"%",this.selectionElStyle.width=Math.abs(a[0]-a[1])+"%";var b=this.tooltip_min[0].getBoundingClientRect(),c=this.tooltip_max[0].getBoundingClientRect();b.right>c.left?(this.tooltip_max.removeClass("top"),this.tooltip_max.addClass("bottom")[0].style.top="18px"):(this.tooltip_max.removeClass("bottom"),this.tooltip_max.addClass("top")[0].style.top="-30px")}this.range?(this.tooltipInner.text(this.formater(this.value[0])+this.tooltip_separator+this.formater(this.value[1])),this.tooltip[0].style[this.stylePos]=this.size*(a[0]+(a[1]-a[0])/2)/100-("vertical"===this.orientation?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px",this.tooltipInner_min.text(this.formater(this.value[0])),this.tooltipInner_max.text(this.formater(this.value[1])),this.tooltip_min[0].style[this.stylePos]=this.size*(a[0]/100)-("vertical"===this.orientation?this.tooltip_min.outerHeight()/2:this.tooltip_min.outerWidth()/2)+"px",this.tooltip_max[0].style[this.stylePos]=this.size*(a[1]/100)-("vertical"===this.orientation?this.tooltip_max.outerHeight()/2:this.tooltip_max.outerWidth()/2)+"px"):(this.tooltipInner.text(this.formater(this.value[0])),this.tooltip[0].style[this.stylePos]=this.size*a[0]/100-("vertical"===this.orientation?this.tooltip.outerHeight()/2:this.tooltip.outerWidth()/2)+"px")},mousedown:function(b){if(!this.isEnabled())return!1;this.touchCapable&&"touchstart"===b.type&&(b=b.originalEvent),this.triggerFocusOnHandle(),this.offset=this.picker.offset(),this.size=this.picker[0][this.sizePos];var c=this.getPercentage(b);if(this.range){var d=Math.abs(this.percentage[0]-c),e=Math.abs(this.percentage[1]-c);this.dragged=e>d?0:1}else this.dragged=0;this.percentage[this.dragged]=this.reversed?100-c:c,this.layout(),this.touchCapable&&a(document).on({touchmove:a.proxy(this.mousemove,this),touchend:a.proxy(this.mouseup,this)}),a(document).on({mousemove:a.proxy(this.mousemove,this),mouseup:a.proxy(this.mouseup,this)}),this.inDrag=!0;var f=this.calculateValue();return this.element.trigger({type:"slideStart",value:f}).data("value",f).prop("value",f),this.setValue(f),!0},triggerFocusOnHandle:function(a){0===a&&this.handle1.focus(),1===a&&this.handle2.focus()},keydown:function(a,b){if(!this.isEnabled())return!1;var c;switch(b.which){case 37:case 40:c=-1;break;case 39:case 38:c=1}if(c){this.natural_arrow_keys&&("vertical"===this.orientation&&!this.reversed||"horizontal"===this.orientation&&this.reversed)&&(c=-1*c);var d=c*this.percentage[2],e=this.percentage[a]+d;e>100?e=100:0>e&&(e=0),this.dragged=a,this.adjustPercentageForRangeSliders(e),this.percentage[this.dragged]=e,this.layout();var f=this.calculateValue();return this.element.trigger({type:"slideStart",value:f}).data("value",f).prop("value",f),this.setValue(f,!0),this.element.trigger({type:"slideStop",value:f}).data("value",f).prop("value",f),!1}},mousemove:function(a){if(!this.isEnabled())return!1;this.touchCapable&&"touchmove"===a.type&&(a=a.originalEvent);var b=this.getPercentage(a);this.adjustPercentageForRangeSliders(b),this.percentage[this.dragged]=this.reversed?100-b:b,this.layout();var c=this.calculateValue();return this.setValue(c,!0),!1},adjustPercentageForRangeSliders:function(a){this.range&&(0===this.dragged&&this.percentage[1]a&&(this.percentage[1]=this.percentage[0],this.dragged=0))},mouseup:function(){if(!this.isEnabled())return!1;this.touchCapable&&a(document).off({touchmove:this.mousemove,touchend:this.mouseup}),a(document).off({mousemove:this.mousemove,mouseup:this.mouseup}),this.inDrag=!1,this.over===!1&&this.hideTooltip();var b=this.calculateValue();return this.layout(),this.element.data("value",b).prop("value",b).trigger({type:"slideStop",value:b}),!1},calculateValue:function(){var a;return this.range?(a=[this.min,this.max],0!==this.percentage[0]&&(a[0]=Math.max(this.min,this.min+Math.round(this.diff*this.percentage[0]/100/this.step)*this.step),a[0]=this.applyPrecision(a[0])),100!==this.percentage[1]&&(a[1]=Math.min(this.max,this.min+Math.round(this.diff*this.percentage[1]/100/this.step)*this.step),a[1]=this.applyPrecision(a[1])),this.value=a):(a=this.min+Math.round(this.diff*this.percentage[0]/100/this.step)*this.step,athis.max&&(a=this.max),a=parseFloat(a),a=this.applyPrecision(a),this.value=[a,this.value[1]]),a},applyPrecision:function(a){var b=this.precision||this.getNumDigitsAfterDecimalPlace(this.step);return this.applyToFixedAndParseFloat(a,b)},getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=100*(a[this.mousePos]-this.offset[this.stylePos])/this.size;return b=Math.round(b/this.percentage[2])*this.percentage[2],Math.max(0,Math.min(100,b))},getValue:function(){return this.range?this.value:this.value[0]},setValue:function(a,b){if(a||(a=0),this.value=this.validateInputValue(a),this.range?(this.value[0]=this.applyPrecision(this.value[0]),this.value[1]=this.applyPrecision(this.value[1]),this.value[0]=Math.max(this.min,Math.min(this.max,this.value[0])),this.value[1]=Math.max(this.min,Math.min(this.max,this.value[1]))):(this.value=this.applyPrecision(this.value),this.value=[Math.max(this.min,Math.min(this.max,this.value))],this.handle2.addClass("hide"),this.value[1]="after"===this.selection?this.max:this.min),this.diff=this.max-this.min,this.percentage=this.diff>0?[100*(this.value[0]-this.min)/this.diff,100*(this.value[1]-this.min)/this.diff,100*this.step/this.diff]:[0,0,100],this.layout(),b===!0){var c=this.range?this.value:this.value[0];this.element.trigger({type:"slide",value:c}).data("value",c).prop("value",c)}},validateInputValue:function(b){if("number"==typeof b)return b;if(b instanceof Array)return a.each(b,function(a,b){if("number"!=typeof b)throw new Error(e.formatInvalidInputErrorMsg(b))}),b;throw new Error(e.formatInvalidInputErrorMsg(b))},destroy:function(){this.handle1.off(),this.handle2.off(),this.element.off().show().insertBefore(this.picker),this.picker.off().remove(),a(this.element).removeData("slider")},disable:function(){this.enabled=!1,this.handle1.removeAttr("tabindex"),this.handle2.removeAttr("tabindex"),this.picker.addClass("slider-disabled"),this.element.trigger("slideDisabled")},enable:function(){this.enabled=!0,this.handle1.attr("tabindex",0),this.handle2.attr("tabindex",0),this.picker.removeClass("slider-disabled"),this.element.trigger("slideEnabled")},toggle:function(){this.enabled?this.disable():this.enable()},isEnabled:function(){return this.enabled},setAttribute:function(a,b){this[a]=b},getAttribute:function(a){return this[a]}};var g={getValue:f.prototype.getValue,setValue:f.prototype.setValue,setAttribute:f.prototype.setAttribute,getAttribute:f.prototype.getAttribute,destroy:f.prototype.destroy,disable:f.prototype.disable,enable:f.prototype.enable,toggle:f.prototype.toggle,isEnabled:f.prototype.isEnabled};a.fn.slider=function(a){if("string"==typeof a&&"refresh"!==a){var c=Array.prototype.slice.call(arguments,1);return b.call(this,a,c)}return d.call(this,a)},a.fn.slider.defaults={min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:!1,selection:"before",tooltip:"show",tooltip_separator:":",tooltip_split:!1,natural_arrow_keys:!1,handle:"round",reversed:!1,enabled:!0,formater:function(a){return a}},a.fn.slider.Constructor=f}(window.jQuery);; +!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(a){"use strict";function b(c,d){var e=function(){},f=this,g={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:b.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(b){return"string"==typeof b?a.parseJSON(b):b},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};f.element=c,f.el=a(c),f.suggestions=[],f.badQueries=[],f.selectedIndex=-1,f.currentValue=f.element.value,f.intervalId=0,f.cachedResponse={},f.onChangeInterval=null,f.onChange=null,f.isLocal=!1,f.suggestionsContainer=null,f.noSuggestionsContainer=null,f.options=a.extend({},g,d),f.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},f.hint=null,f.hintValue="",f.selection=null,f.initialize(),f.setOptions(d)}var c=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");return b.className=a,b.style.position="absolute",b.style.display="none",b}}}(),d={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};b.utils=c,a.Autocomplete=b,b.formatResult=function(a,b){var d=a.value.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),e="("+c.escapeRegExChars(b)+")";return d.replace(new RegExp(e,"gi"),"$1")},b.prototype={killerFn:null,initialize:function(){var c,d=this,e="."+d.classes.suggestion,f=d.classes.selected,g=d.options;d.element.setAttribute("autocomplete","off"),d.killerFn=function(b){0===a(b.target).closest("."+d.options.containerClass).length&&(d.killSuggestions(),d.disableKillerFn())},d.noSuggestionsContainer=a('
').html(this.options.noSuggestionNotice).get(0),d.suggestionsContainer=b.utils.createNode(g.containerClass),c=a(d.suggestionsContainer),c.appendTo(g.appendTo),"auto"!==g.width&&c.width(g.width),c.on("mouseover.autocomplete",e,function(){d.activate(a(this).data("index"))}),c.on("mouseout.autocomplete",function(){d.selectedIndex=-1,c.children("."+f).removeClass(f)}),c.on("click.autocomplete",e,function(){d.select(a(this).data("index"))}),d.fixPositionCapture=function(){d.visible&&d.fixPosition()},a(window).on("resize.autocomplete",d.fixPositionCapture),d.el.on("keydown.autocomplete",function(a){d.onKeyPress(a)}),d.el.on("keyup.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("blur.autocomplete",function(){d.onBlur()}),d.el.on("focus.autocomplete",function(){d.onFocus()}),d.el.on("change.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("input.autocomplete",function(a){d.onKeyUp(a)})},onFocus:function(){var a=this;a.fixPosition(),a.options.minChars<=a.el.val().length&&a.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(b){var c=this,d=c.options;a.extend(d,b),c.isLocal=a.isArray(d.lookup),c.isLocal&&(d.lookup=c.verifySuggestionsFormat(d.lookup)),d.orientation=c.validateOrientation(d.orientation,"bottom"),a(c.suggestionsContainer).css({"max-height":d.maxHeight+"px",width:d.width+"px","z-index":d.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var a=this;a.disabled=!0,clearInterval(a.onChangeInterval),a.currentRequest&&a.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var b=this,c=a(b.suggestionsContainer),d=c.parent().get(0);if(d===document.body||b.options.forceFixPosition){var e=b.options.orientation,f=c.outerHeight(),g=b.el.outerHeight(),h=b.el.offset(),i={top:h.top,left:h.left};if("auto"===e){var j=a(window).height(),k=a(window).scrollTop(),l=-k+h.top-f,m=k+j-(h.top+g+f);e=Math.max(l,m)===l?"top":"bottom"}if(i.top+="top"===e?-f:g,d!==document.body){var n,o=c.css("opacity");b.visible||c.css("opacity",0).show(),n=c.offsetParent().offset(),i.top-=n.top,i.left-=n.left,b.visible||c.css("opacity",o).hide()}"auto"===b.options.width&&(i.width=b.el.outerWidth()-2+"px"),c.css(i)}},enableKillerFn:function(){var b=this;a(document).on("click.autocomplete",b.killerFn)},disableKillerFn:function(){var b=this;a(document).off("click.autocomplete",b.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions(),a.intervalId=window.setInterval(function(){a.hide(),a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a,b=this,c=b.el.val().length,d=b.element.selectionStart;return"number"==typeof d?d===c:document.selection?(a=document.selection.createRange(),a.moveStart("character",-c),c===a.text.length):!0},onKeyPress:function(a){var b=this;if(!b.disabled&&!b.visible&&a.which===d.DOWN&&b.currentValue)return void b.suggest();if(!b.disabled&&b.visible){switch(a.which){case d.ESC:b.el.val(b.currentValue),b.hide();break;case d.RIGHT:if(b.hint&&b.options.onHint&&b.isCursorAtEnd()){b.selectHint();break}return;case d.TAB:if(b.hint&&b.options.onHint)return void b.selectHint();if(-1===b.selectedIndex)return void b.hide();if(b.select(b.selectedIndex),b.options.tabDisabled===!1)return;break;case d.RETURN:if(-1===b.selectedIndex)return void b.hide();b.select(b.selectedIndex);break;case d.UP:b.moveUp();break;case d.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case d.UP:case d.DOWN:return}clearInterval(b.onChangeInterval),b.currentValue!==b.el.val()&&(b.findBestHint(),b.options.deferRequestBy>0?b.onChangeInterval=setInterval(function(){b.onValueChange()},b.options.deferRequestBy):b.onValueChange())}},onValueChange:function(){var b,c=this,d=c.options,e=c.el.val(),f=c.getQuery(e);return c.selection&&c.currentValue!==f&&(c.selection=null,(d.onInvalidateSelection||a.noop).call(c.element)),clearInterval(c.onChangeInterval),c.currentValue=e,c.selectedIndex=-1,d.triggerSelectOnValidInput&&(b=c.findSuggestionIndex(f),-1!==b)?void c.select(b):void(f.lengthh&&(c.suggestions=c.suggestions.slice(0,h)),c},getSuggestions:function(b){var c,d,e,f,g=this,h=g.options,i=h.serviceUrl;if(h.params[h.paramName]=b,d=h.ignoreParams?null:h.params,h.onSearchStart.call(g.element,h.params)!==!1){if(a.isFunction(h.lookup))return void h.lookup(b,function(a){g.suggestions=a.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,a.suggestions)});g.isLocal?c=g.getSuggestionsLocal(b):(a.isFunction(i)&&(i=i.call(g.element,b)),e=i+"?"+a.param(d||{}),c=g.cachedResponse[e]),c&&a.isArray(c.suggestions)?(g.suggestions=c.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,c.suggestions)):g.isBadQuery(b)?h.onSearchComplete.call(g.element,b,[]):(g.currentRequest&&g.currentRequest.abort(),f={url:i,data:d,type:h.type,dataType:h.dataType},a.extend(f,h.ajaxSettings),g.currentRequest=a.ajax(f).done(function(a){var c;g.currentRequest=null,c=h.transformResult(a),g.processResponse(c,b,e),h.onSearchComplete.call(g.element,b,c.suggestions)}).fail(function(a,c,d){h.onSearchError.call(g.element,b,a,c,d)}))}},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){var b=this,c=a(b.suggestionsContainer);a.isFunction(b.options.onHide)&&b.visible&&b.options.onHide.call(b.element,c),b.visible=!1,b.selectedIndex=-1,clearInterval(b.onChangeInterval),a(b.suggestionsContainer).hide(),b.signalHint(null)},suggest:function(){if(0===this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var b,c,d=this,e=d.options,f=e.groupBy,g=e.formatResult,h=d.getQuery(d.currentValue),i=d.classes.suggestion,j=d.classes.selected,k=a(d.suggestionsContainer),l=a(d.noSuggestionsContainer),m=e.beforeRender,n="",o=function(a){var c=a.data[f];return b===c?"":(b=c,'
'+b+"
")};return e.triggerSelectOnValidInput&&(c=d.findSuggestionIndex(h),-1!==c)?void d.select(c):(a.each(d.suggestions,function(a,b){f&&(n+=o(b,h,a)),n+='
'+g(b,h)+"
"}),this.adjustContainerWidth(),l.detach(),k.html(n),a.isFunction(m)&&m.call(d.element,k),d.fixPosition(),k.show(),e.autoSelectFirst&&(d.selectedIndex=0,k.scrollTop(0),k.children("."+i).first().addClass(j)),d.visible=!0,void d.findBestHint())},noSuggestions:function(){var b=this,c=a(b.suggestionsContainer),d=a(b.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),b.fixPosition(),c.show(),b.visible=!0},adjustContainerWidth:function(){var b,c=this,d=c.options,e=a(c.suggestionsContainer);"auto"===d.width&&(b=c.el.outerWidth()-2,e.width(b>0?b:300))},findBestHint:function(){var b=this,c=b.el.val().toLowerCase(),d=null;c&&(a.each(b.suggestions,function(a,b){var e=0===b.value.toLowerCase().indexOf(c);return e&&(d=b),!e}),b.signalHint(d))},signalHint:function(b){var c="",d=this;b&&(c=d.currentValue+b.value.substr(d.currentValue.length)),d.hintValue!==c&&(d.hintValue=c,d.hint=b,(this.options.onHint||a.noop)(c))},verifySuggestionsFormat:function(b){return b.length&&"string"==typeof b[0]?a.map(b,function(a){return{value:a,data:null}}):b},validateOrientation:function(b,c){return b=a.trim(b||"").toLowerCase(),-1===a.inArray(b,["auto","bottom","top"])&&(b=c),b},processResponse:function(a,b,c){var d=this,e=d.options;a.suggestions=d.verifySuggestionsFormat(a.suggestions),e.noCache||(d.cachedResponse[c]=a,e.preventBadQueries&&0===a.suggestions.length&&d.badQueries.push(b)),b===d.getQuery(d.currentValue)&&(d.suggestions=a.suggestions,d.suggest())},activate:function(b){var c,d=this,e=d.classes.selected,f=a(d.suggestionsContainer),g=f.find("."+d.classes.suggestion);return f.find("."+e).removeClass(e),d.selectedIndex=b,-1!==d.selectedIndex&&g.length>d.selectedIndex?(c=g.get(d.selectedIndex),a(c).addClass(e),c):null},selectHint:function(){var b=this,c=a.inArray(b.hint,b.suggestions);b.select(c)},select:function(a){var b=this;b.hide(),b.onSelect(a)},moveUp:function(){var b=this;if(-1!==b.selectedIndex)return 0===b.selectedIndex?(a(b.suggestionsContainer).children().first().removeClass(b.classes.selected),b.selectedIndex=-1,b.el.val(b.currentValue),void b.findBestHint()):void b.adjustScroll(b.selectedIndex-1)},moveDown:function(){var a=this;a.selectedIndex!==a.suggestions.length-1&&a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(b){var c=this,d=c.activate(b);if(d){var e,f,g,h=a(d).outerHeight();e=d.offsetTop,f=a(c.suggestionsContainer).scrollTop(),g=f+c.options.maxHeight-h,f>e?a(c.suggestionsContainer).scrollTop(e):e>g&&a(c.suggestionsContainer).scrollTop(e-c.options.maxHeight+h),c.options.preserveInput||c.el.val(c.getValue(c.suggestions[b].value)),c.signalHint(null)}},onSelect:function(b){var c=this,d=c.options.onSelect,e=c.suggestions[b];c.currentValue=c.getValue(e.value),c.currentValue===c.el.val()||c.options.preserveInput||c.el.val(c.currentValue),c.signalHint(null),c.suggestions=[],c.selection=e,a.isFunction(d)&&d.call(c.element,e)},getValue:function(a){var b,c,d=this,e=d.options.delimiter;return e?(b=d.currentValue,c=b.split(e),1===c.length?a:b.substr(0,b.length-c[c.length-1].length)+a):a},dispose:function(){var b=this;b.el.off(".autocomplete").removeData("autocomplete"),b.disableKillerFn(),a(window).off("resize.autocomplete",b.fixPositionCapture),a(b.suggestionsContainer).remove()}},a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){var e="autocomplete";return 0===arguments.length?this.first().data(e):this.each(function(){var f=a(this),g=f.data(e);"string"==typeof c?g&&"function"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),f.data(e,g))})}});; //facebook (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; @@ -27,5 +28,6 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po !function(d,s,id){ var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);} }(document, 'script', 'twitter-wjs');; -function filesizeHuman(a,b){if(0===a)return a;b=b||1;var c=["Bytes","KB","MB","GB","TB"],d=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,d)).toFixed(b)+" "+c[d]}function nodes2Bytes(a){return filesizeHuman(400+56*a)}function getPosition(a){for(var b=0,c=0;a;)b+=a.offsetLeft-a.scrollLeft+a.clientLeft,c+=a.offsetTop-a.scrollTop+a.clientTop,a=a.offsetParent;return{x:b,y:c}}function hideFormats(){$("#download-formats").hide(),$("#view-formats").hide()}function chooseDownloadFormat(a){var b=getPosition(a.currentTarget);$("#download-formats").css("top",b.y-4),$("#download-formats").show(),$("#view-formats").hide()}function chooseViewFormat(a){var b=getPosition(a.currentTarget);$("#view-formats").css("top",b.y-4),$("#view-formats").show(),$("#download-formats").hide()}function GeoJSONFormat(){this.param={key:"geojson",syntax:"json",name:"GeoJSON",extension:"geojson",contenttype:"appplication/json"},this.exportData=function(a){return JSON.stringify(a)},this.display=function(a){return prettyData.json(a)}}function GPXFormat(){this.param={key:"gpx",syntax:"xml",name:"GPX",extension:"gpx",contenttype:"application/gpx+xml"},this.exportData=function(a){return togpx(a)},this.display=function(a){return prettyData.xml(a)}}function KMLFormat(){this.param={key:"kml",syntax:"xml",name:"KML",extension:"kml",contenttype:"application/vnd.google-earth.kml+xml"},this.exportData=function(a){return tokml(a)},this.display=function(a){return prettyData.xml(a)}}function MediawikiFormat(){this.param={key:"mediawiki",syntax:"nohighlight",name:"Mediawiki",extension:"txt",contenttype:"text/plain"},this.exportData=function(a){return geojsonToPath(a)}}$("#export-close").on("click",function(){$("#export-format").hide()});var Format=function(){this.param={key:"format",name:"RootFormat"}};Format.prototype={loadAll:function(a){a.forEach(function(a){f=new window[a],f.load()})},load:function(){var a=document.createElement("a"),b=document.createTextNode("View in "+this.param.name);a.appendChild(b),a.title="View the simplified data in "+this.param.name,a.className="view",$(a).on("click",this.viewClick.bind(this)),$("#view-formats").append(a),a=document.createElement("a"),b=document.createTextNode("Download in "+this.param.name),a.appendChild(b),a.title="Download the simplified data in "+this.param.name,a.className="download",$(a).on("click",this.saveClick.bind(this)),$("#download-formats").append(a)},display:function(a){return a},save:function(a,b,c){b=b.replace(/\..*/,""),b=b+"_"+c+"nodes."+this.param.extension;try{if(new Blob){var d=this.exportData(a),e=new Blob([d],{type:this.param.contenttype+";charset=utf-8"});saveAs(e,b)}}catch(f){return alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+f.message),console.log(f.message),!1}hideFormats()},saveClick:function(){this.save(window.simplifyLayerData,window.simplifyLayerName,window.simplifyNodes)},view:function(a){try{if(new Blob){var b=this.exportData(a);b=this.display(b),$("code").attr("class",this.param.syntax),$("#export-content").text(b),window.simplifyNodes<1e3&&$("code").each(function(a,b){hljs.highlightBlock(b)}),$("#export-format h5").html("Simplified geometry in "+this.param.name+" format"),$("#export-format").show()}}catch(c){return alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+c.message),console.log(c.message),!1}hideFormats()},viewClick:function(){this.view(window.simplifyLayerData)}},GeoJSONFormat.prototype=new Format,GPXFormat.prototype=new Format,KMLFormat.prototype=new Format,MediawikiFormat.prototype=new Format;; -$(function(){function a(a){if(g){window.simplifyLayer.clearLayers(),window.simplifyNodes=0,layer=g.getLayers()[0];var b=layer.toGeoJSON();b.geometry.coordinates=simplifyGeometry(b.geometry.coordinates,a),window.simplifyLayer.addData(b),window.simplifyLayerData=b,window.simplifyNodes+=b.geometry.coordinates.length,f.text(window.simplifyNodes+" nodes ~"+nodes2Bytes(window.simplifyNodes))}}var b=new L.Map("map",{attributionControl:!1}).setView(L.latLng(36,-30),3),c={color:"red",opacity:.7,fillOpacity:.7,weight:5,clickable:!1},d={color:"blue",opacity:1,fillOpacity:1,weight:2,clickable:!1};L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(b);var e,f,g=null;window.simplifyNodes=0,window.simplifyLayerName="simplified.gpx",window.simplifyLayerData=null,window.simplifyLayer=L.geoJson(window.simplifyLayerData,{style:d}).addTo(b),L.Control.FileLayerLoad.LABEL='';var h=L.Control.fileLayerLoad({addToMap:!0,fitBounds:!1,fileSizeLimit:8096,layerOptions:{style:c,pointToLayer:function(a,b){return L.circle(b,10,{style:c})}}}).addTo(b);h.loader.on("data:loaded",function(c){g=c.layer,b.fitBounds(g.getBounds()),window.simplifyLayerName=c.filename,a(0),e.html(window.simplifyLayerName),$(".grumble, .grumble-text, .grumble-button").remove(),$(document).unbind("keyup.crumble")}).on("data:error",function(a){console.log("ERROR",a)}),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-download leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Download simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseDownloadFormat),a},a}().addTo(b),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-view leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="View simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseViewFormat),a},a}().addTo(b),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(a){var b=L.DomUtil.create("div","leaflet-control-erase leaflet-bar"),c=L.DomUtil.create("a","",b);return c.href="#",c.target="_blank",c.title="Clear the map",c.innerHTML='',L.DomEvent.on(c,"click",L.DomEvent.stop).on(c,"click",function(){g.eachLayer(function(b){a.removeLayer(b)}),simplifyLayer.clearLayers()}),b},a}().addTo(b),function(){var a=new L.Control({position:"bottomleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-stats");return a.id="stats",a.innerHTML='
',e=$("#filename",a),f=$("#nodes",a),a},a}().addTo(b),L.control.sidebar("sidebar",{position:"right",autoPan:!1}).addTo(b).show(),L.control.attribution({position:"topright",prefix:'LeafletOpenStreetMap contributors'}).addTo(b),$("#slider").slider({value:0,min:0,max:.1,step:5e-5,precision:8,tooltip:"hide"}).on("slide",function(b){a(b.value)}).parent().width("100%"),$("#helpbtn").on("click",function(){$("#modal").modal("show")});var i=$.cookie("tour");(!i||parseInt(i)<3)&&($("#modal").modal("show"),i=(parseInt(i)||0)+1,$.cookie("tour",i,{expires:120}));var j=new Format;j.loadAll(["GeoJSONFormat","GPXFormat","KMLFormat","MediawikiFormat"]),hljs.initHighlightingOnLoad()}); \ No newline at end of file +function filesizeHuman(a,b){if(0===a)return a;b=b||1;var c=["Bytes","KB","MB","GB","TB"],d=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,d)).toFixed(b)+" "+c[d]}function nodes2Bytes(a){return filesizeHuman(400+56*a)}function getPosition(a){for(var b=0,c=0;a;)b+=a.offsetLeft-a.scrollLeft+a.clientLeft,c+=a.offsetTop-a.scrollTop+a.clientTop,a=a.offsetParent;return{x:b,y:c}}function hideAll(){$(".popup").each(function(){$(this).hide()})}function chooseDownloadFormat(a){hideAll();var b=getPosition(a.currentTarget);$("#download-formats").css("top",b.y-4),$("#download-formats").show()}function chooseViewFormat(a){hideAll();var b=getPosition(a.currentTarget);$("#view-formats").css("top",b.y-4),$("#view-formats").show(),$("#download-formats").hide()}function GeoJSONFormat(){this.param={key:"geojson",syntax:"json",name:"GeoJSON",extension:"geojson",contenttype:"appplication/json"},this.exportData=function(a){return JSON.stringify(a)},this.display=function(a){return prettyData.json(a)}}function GPXFormat(){this.param={key:"gpx",syntax:"xml",name:"GPX",extension:"gpx",contenttype:"application/gpx+xml"},this.exportData=function(a){return togpx(a)},this.display=function(a){return prettyData.xml(a)}}function KMLFormat(){this.param={key:"kml",syntax:"xml",name:"KML",extension:"kml",contenttype:"application/vnd.google-earth.kml+xml"},this.exportData=function(a){return tokml(a)},this.display=function(a){return prettyData.xml(a)}}function MediawikiFormat(){this.param={key:"mediawiki",syntax:"nohighlight",name:"Mediawiki",extension:"txt",contenttype:"text/plain"},this.exportData=function(a){return geojsonToPath(a)}}$("#export-close").on("click",function(){$("#export-format").hide()});var Format=function(){this.param={key:"format",name:"RootFormat"}};Format.prototype={loadAll:function(a){a.forEach(function(a){f=new window[a],f.load()})},load:function(){var a=document.createElement("a"),b=document.createTextNode("View in "+this.param.name);a.appendChild(b),a.title="View the simplified data in "+this.param.name,a.className="view",$(a).on("click",this.viewClick.bind(this)),$("#view-formats").append(a),a=document.createElement("a"),b=document.createTextNode("Download in "+this.param.name),a.appendChild(b),a.title="Download the simplified data in "+this.param.name,a.className="download",$(a).on("click",this.saveClick.bind(this)),$("#download-formats").append(a)},display:function(a){return a},save:function(a){name=a.name.replace(/\..*/,""),name=name+"_"+a.simplifiedLayerNodes+"nodes."+this.param.extension;try{if(new Blob){var b=this.exportData(a.simplifiedLayerData),c=new Blob([b],{type:this.param.contenttype+";charset=utf-8"});saveAs(c,name)}}catch(d){alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+d.message),console.log(d.message)}hideAll()},saveClick:function(){this.save(window.currentLayer)},view:function(a){try{if(new Blob){var b=this.exportData(a.simplifiedLayerData);b=this.display(b),$("code").attr("class",this.param.syntax),$("#export-content").text(b),a.simplifiedLayerNodes<1e3&&$("code").each(function(a,b){hljs.highlightBlock(b)}),$("#export-format h5").html("Simplified geometry in "+this.param.name+" format"),$("#export-format").show()}}catch(c){alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+c.message),console.log(c.message)}hideAll()},viewClick:function(){this.view(window.currentLayer)}},GeoJSONFormat.prototype=new Format,GPXFormat.prototype=new Format,KMLFormat.prototype=new Format,MediawikiFormat.prototype=new Format;; +function updateLayers(){$(".leaflet-control-switcher").html("");for(var a in window.Layers){var b=window.Layers[a];$(".leaflet-control-switcher").append('")}Object.keys(window.Layers).length>0?$(".leaflet-control-switcher-box").show():$(".leaflet-control-switcher-box").hide()}function clearMap(){for(var a in window.Layers)window.Layers[a].remove();window.Layers={},updateLayers()}window.style1={color:"red",opacity:.7,fillOpacity:.7,weight:5,clickable:!1},window.style2={color:"blue",opacity:1,fillOpacity:1,weight:2,clickable:!1};var LayerOptimizer=function(a){this.id=this.createId(),this.name=a.filename,this.sourceLayer=a.layer,this.sourceLayerStyle=window.style1,this.sourceLayerData=this.getSourceData(),this.sourceLayerNodes=this.sourceLayerData.geometry.coordinates.length,this.simplifiedLayerStyle=window.style2,this.simplifiedLayer=L.geoJson(null,{style:this.simplifiedLayerStyle}).addTo(window.map),this.simplifiedLayerNodes=0,this.controller=null};LayerOptimizer.prototype={getSourceData:function(){return this.sourceLayer.getLayers()[0].toGeoJSON()},choose:function(){this.zoom(),this.createLayerGroup(),this.displayInfos()},optimize:function(a){this.simplifiedLayer.clearLayers(),this.simplifiedLayerData=this.getSourceData(),this.simplifiedLayerData.geometry.coordinates=simplifyGeometry(this.simplifiedLayerData.geometry.coordinates,a),this.simplifiedLayer.addData(this.simplifiedLayerData),this.simplifiedLayerNodes=this.simplifiedLayerData.geometry.coordinates.length},getBounds:function(){return this.sourceLayer.getBounds()},zoom:function(){window.map.fitBounds(this.getBounds())},createLayerGroup:function(){var a={};a[this.name+" (simplified)"]=this.simplifiedLayer,a[this.name+" (source)"]=this.sourceLayer,this.controller=L.control.layers(null,a),this.controller.addTo(window.map)},displayInfos:function(){var a="Optimize : "+this.name,b="From "+this.sourceLayerNodes+" nodes to "+this.simplifiedLayerNodes+" nodes";$("#filename").html(a),$("#nodes").html(b)},remove:function(){this.removeLayers(),this.removeController()},removeLayers:function(){try{window.map.removeLayer(this.simplifiedLayer),window.map.removeLayer(this.sourceLayer)}catch(a){console.log("Layers not found, probably already removed")}},removeController:function(){try{void 0!==this.controller._map&&this.controller.removeFrom(window.map)}catch(a){console.log("Controller not found, probably already removed")}},createId:function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+a()+a()}};; +$(function(){var a=new L.Map("map",{attributionControl:!1}).setView(L.latLng(36,-30),3);window.map=a,L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(a),window.Layers={},window.currentLayer=null,L.Control.FileLayerLoad.LABEL='';var b=L.Control.fileLayerLoad({addToMap:!0,fitBounds:!1,fileSizeLimit:8096,layerOptions:{style:style1,pointToLayer:function(a,b){return L.circle(b,10,{style:style1})}}}).addTo(a);b.loader.on("data:loaded",function(a){window.currentLayer&&window.currentLayer.removeController();var b=new LayerOptimizer(a);b.optimize(0),b.choose(),window.Layers[b.id]=b,window.currentLayer=b,updateLayers()}).on("data:error",function(a){console.log("ERROR",a)}),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-download leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Download simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseDownloadFormat),a},a}().addTo(a),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-view leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="View simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseViewFormat),a},a}().addTo(a),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-erase leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Clear the map",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",clearMap),a},a}().addTo(a),function(){var a=new L.Control({position:"bottomleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-stats");return a.id="stats",a.innerHTML='
',filename$=$("#filename",a),nodes$=$("#nodes",a),a},a}().addTo(a),L.control.sidebar("sidebar",{position:"right",autoPan:!1}).addTo(a).show(),L.control.attribution({position:"topright",prefix:'LeafletOpenStreetMap contributors'}).addTo(a),function(){var a=new L.Control({position:"topright"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-switcher-box leaflet-bar"),b=L.DomUtil.create("label","",a);b.href="#",b.title="Choose the active layer",b.innerHTML="Layer switcher";var c=L.DomUtil.create("select","leaflet-control-switcher leaflet-bar",a);return L.DomEvent.on(c,"change",function(){window.currentLayer.removeController(),window.currentLayer=window.Layers[$(this).val()],window.currentLayer.choose()}),a},a}().addTo(a),$("#slider").slider({value:0,min:0,max:.1,step:5e-5,precision:8,tooltip:"hide"}).on("slide",function(a){window.currentLayer.optimize(a.value),window.currentLayer.displayInfos()}).parent().width("100%"),$("#helpbtn").on("click",function(){$("#modal").modal("show")});var c=$.cookie("tour");(!c||parseInt(c)<3)&&($("#modal").modal("show"),c=(parseInt(c)||0)+1,$.cookie("tour",c,{expires:120}));var d=new Format;d.loadAll(["GeoJSONFormat","GPXFormat","KMLFormat","MediawikiFormat"]),hljs.initHighlightingOnLoad()}); \ No newline at end of file diff --git a/dist/formats.min.js b/dist/formats.min.js index a7319a4..b15f81d 100644 --- a/dist/formats.min.js +++ b/dist/formats.min.js @@ -1 +1 @@ -function filesizeHuman(a,b){if(0===a)return a;b=b||1;var c=["Bytes","KB","MB","GB","TB"],d=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,d)).toFixed(b)+" "+c[d]}function nodes2Bytes(a){return filesizeHuman(400+56*a)}function getPosition(a){for(var b=0,c=0;a;)b+=a.offsetLeft-a.scrollLeft+a.clientLeft,c+=a.offsetTop-a.scrollTop+a.clientTop,a=a.offsetParent;return{x:b,y:c}}function hideFormats(){$("#download-formats").hide(),$("#view-formats").hide()}function chooseDownloadFormat(a){var b=getPosition(a.currentTarget);$("#download-formats").css("top",b.y-4),$("#download-formats").show(),$("#view-formats").hide()}function chooseViewFormat(a){var b=getPosition(a.currentTarget);$("#view-formats").css("top",b.y-4),$("#view-formats").show(),$("#download-formats").hide()}function GeoJSONFormat(){this.param={key:"geojson",syntax:"json",name:"GeoJSON",extension:"geojson",contenttype:"appplication/json"},this.exportData=function(a){return JSON.stringify(a)},this.display=function(a){return prettyData.json(a)}}function GPXFormat(){this.param={key:"gpx",syntax:"xml",name:"GPX",extension:"gpx",contenttype:"application/gpx+xml"},this.exportData=function(a){return togpx(a)},this.display=function(a){return prettyData.xml(a)}}function KMLFormat(){this.param={key:"kml",syntax:"xml",name:"KML",extension:"kml",contenttype:"application/vnd.google-earth.kml+xml"},this.exportData=function(a){return tokml(a)},this.display=function(a){return prettyData.xml(a)}}function MediawikiFormat(){this.param={key:"mediawiki",syntax:"nohighlight",name:"Mediawiki",extension:"txt",contenttype:"text/plain"},this.exportData=function(a){return geojsonToPath(a)}}$("#export-close").on("click",function(){$("#export-format").hide()});var Format=function(){this.param={key:"format",name:"RootFormat"}};Format.prototype={loadAll:function(a){a.forEach(function(a){f=new window[a],f.load()})},load:function(){var a=document.createElement("a"),b=document.createTextNode("View in "+this.param.name);a.appendChild(b),a.title="View the simplified data in "+this.param.name,a.className="view",$(a).on("click",this.viewClick.bind(this)),$("#view-formats").append(a),a=document.createElement("a"),b=document.createTextNode("Download in "+this.param.name),a.appendChild(b),a.title="Download the simplified data in "+this.param.name,a.className="download",$(a).on("click",this.saveClick.bind(this)),$("#download-formats").append(a)},display:function(a){return a},save:function(a,b,c){b=b.replace(/\..*/,""),b=b+"_"+c+"nodes."+this.param.extension;try{if(new Blob){var d=this.exportData(a),e=new Blob([d],{type:this.param.contenttype+";charset=utf-8"});saveAs(e,b)}}catch(f){return alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+f.message),console.log(f.message),!1}hideFormats()},saveClick:function(){this.save(window.simplifyLayerData,window.simplifyLayerName,window.simplifyNodes)},view:function(a){try{if(new Blob){var b=this.exportData(a);b=this.display(b),$("code").attr("class",this.param.syntax),$("#export-content").text(b),window.simplifyNodes<1e3&&$("code").each(function(a,b){hljs.highlightBlock(b)}),$("#export-format h5").html("Simplified geometry in "+this.param.name+" format"),$("#export-format").show()}}catch(c){return alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+c.message),console.log(c.message),!1}hideFormats()},viewClick:function(){this.view(window.simplifyLayerData)}},GeoJSONFormat.prototype=new Format,GPXFormat.prototype=new Format,KMLFormat.prototype=new Format,MediawikiFormat.prototype=new Format; \ No newline at end of file +function filesizeHuman(a,b){if(0===a)return a;b=b||1;var c=["Bytes","KB","MB","GB","TB"],d=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,d)).toFixed(b)+" "+c[d]}function nodes2Bytes(a){return filesizeHuman(400+56*a)}function getPosition(a){for(var b=0,c=0;a;)b+=a.offsetLeft-a.scrollLeft+a.clientLeft,c+=a.offsetTop-a.scrollTop+a.clientTop,a=a.offsetParent;return{x:b,y:c}}function hideAll(){$(".popup").each(function(){$(this).hide()})}function chooseDownloadFormat(a){hideAll();var b=getPosition(a.currentTarget);$("#download-formats").css("top",b.y-4),$("#download-formats").show()}function chooseViewFormat(a){hideAll();var b=getPosition(a.currentTarget);$("#view-formats").css("top",b.y-4),$("#view-formats").show(),$("#download-formats").hide()}function GeoJSONFormat(){this.param={key:"geojson",syntax:"json",name:"GeoJSON",extension:"geojson",contenttype:"appplication/json"},this.exportData=function(a){return JSON.stringify(a)},this.display=function(a){return prettyData.json(a)}}function GPXFormat(){this.param={key:"gpx",syntax:"xml",name:"GPX",extension:"gpx",contenttype:"application/gpx+xml"},this.exportData=function(a){return togpx(a)},this.display=function(a){return prettyData.xml(a)}}function KMLFormat(){this.param={key:"kml",syntax:"xml",name:"KML",extension:"kml",contenttype:"application/vnd.google-earth.kml+xml"},this.exportData=function(a){return tokml(a)},this.display=function(a){return prettyData.xml(a)}}function MediawikiFormat(){this.param={key:"mediawiki",syntax:"nohighlight",name:"Mediawiki",extension:"txt",contenttype:"text/plain"},this.exportData=function(a){return geojsonToPath(a)}}$("#export-close").on("click",function(){$("#export-format").hide()});var Format=function(){this.param={key:"format",name:"RootFormat"}};Format.prototype={loadAll:function(a){a.forEach(function(a){f=new window[a],f.load()})},load:function(){var a=document.createElement("a"),b=document.createTextNode("View in "+this.param.name);a.appendChild(b),a.title="View the simplified data in "+this.param.name,a.className="view",$(a).on("click",this.viewClick.bind(this)),$("#view-formats").append(a),a=document.createElement("a"),b=document.createTextNode("Download in "+this.param.name),a.appendChild(b),a.title="Download the simplified data in "+this.param.name,a.className="download",$(a).on("click",this.saveClick.bind(this)),$("#download-formats").append(a)},display:function(a){return a},save:function(a){name=a.name.replace(/\..*/,""),name=name+"_"+a.simplifiedLayerNodes+"nodes."+this.param.extension;try{if(new Blob){var b=this.exportData(a.simplifiedLayerData),c=new Blob([b],{type:this.param.contenttype+";charset=utf-8"});saveAs(c,name)}}catch(d){alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+d.message),console.log(d.message)}hideAll()},saveClick:function(){this.save(window.currentLayer)},view:function(a){try{if(new Blob){var b=this.exportData(a.simplifiedLayerData);b=this.display(b),$("code").attr("class",this.param.syntax),$("#export-content").text(b),a.simplifiedLayerNodes<1e3&&$("code").each(function(a,b){hljs.highlightBlock(b)}),$("#export-format h5").html("Simplified geometry in "+this.param.name+" format"),$("#export-format").show()}}catch(c){alert("Please upload GPX/GeoJSON/KML file first, using Chrome or Firefox: "+c.message),console.log(c.message)}hideAll()},viewClick:function(){this.view(window.currentLayer)}},GeoJSONFormat.prototype=new Format,GPXFormat.prototype=new Format,KMLFormat.prototype=new Format,MediawikiFormat.prototype=new Format; \ No newline at end of file diff --git a/dist/layers.min.js b/dist/layers.min.js new file mode 100644 index 0000000..a9ef97d --- /dev/null +++ b/dist/layers.min.js @@ -0,0 +1 @@ +function updateLayers(){$(".leaflet-control-switcher").html("");for(var a in window.Layers){var b=window.Layers[a];$(".leaflet-control-switcher").append('")}Object.keys(window.Layers).length>0?$(".leaflet-control-switcher-box").show():$(".leaflet-control-switcher-box").hide()}function clearMap(){for(var a in window.Layers)window.Layers[a].remove();window.Layers={},updateLayers()}window.style1={color:"red",opacity:.7,fillOpacity:.7,weight:5,clickable:!1},window.style2={color:"blue",opacity:1,fillOpacity:1,weight:2,clickable:!1};var LayerOptimizer=function(a){this.id=this.createId(),this.name=a.filename,this.sourceLayer=a.layer,this.sourceLayerStyle=window.style1,this.sourceLayerData=this.getSourceData(),this.sourceLayerNodes=this.sourceLayerData.geometry.coordinates.length,this.simplifiedLayerStyle=window.style2,this.simplifiedLayer=L.geoJson(null,{style:this.simplifiedLayerStyle}).addTo(window.map),this.simplifiedLayerNodes=0,this.controller=null};LayerOptimizer.prototype={getSourceData:function(){return this.sourceLayer.getLayers()[0].toGeoJSON()},choose:function(){this.zoom(),this.createLayerGroup(),this.displayInfos()},optimize:function(a){this.simplifiedLayer.clearLayers(),this.simplifiedLayerData=this.getSourceData(),this.simplifiedLayerData.geometry.coordinates=simplifyGeometry(this.simplifiedLayerData.geometry.coordinates,a),this.simplifiedLayer.addData(this.simplifiedLayerData),this.simplifiedLayerNodes=this.simplifiedLayerData.geometry.coordinates.length},getBounds:function(){return this.sourceLayer.getBounds()},zoom:function(){window.map.fitBounds(this.getBounds())},createLayerGroup:function(){var a={};a[this.name+" (simplified)"]=this.simplifiedLayer,a[this.name+" (source)"]=this.sourceLayer,this.controller=L.control.layers(null,a),this.controller.addTo(window.map)},displayInfos:function(){var a="Optimize : "+this.name,b="From "+this.sourceLayerNodes+" nodes to "+this.simplifiedLayerNodes+" nodes";$("#filename").html(a),$("#nodes").html(b)},remove:function(){this.removeLayers(),this.removeController()},removeLayers:function(){try{window.map.removeLayer(this.simplifiedLayer),window.map.removeLayer(this.sourceLayer)}catch(a){console.log("Layers not found, probably already removed")}},removeController:function(){try{void 0!==this.controller._map&&this.controller.removeFrom(window.map)}catch(a){console.log("Controller not found, probably already removed")}},createId:function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+a()+a()}}; \ No newline at end of file diff --git a/dist/main.min.js b/dist/main.min.js index dd36387..beac3e4 100644 --- a/dist/main.min.js +++ b/dist/main.min.js @@ -1 +1 @@ -$(function(){function a(a){if(g){window.simplifyLayer.clearLayers(),window.simplifyNodes=0,layer=g.getLayers()[0];var b=layer.toGeoJSON();b.geometry.coordinates=simplifyGeometry(b.geometry.coordinates,a),window.simplifyLayer.addData(b),window.simplifyLayerData=b,window.simplifyNodes+=b.geometry.coordinates.length,f.text(window.simplifyNodes+" nodes ~"+nodes2Bytes(window.simplifyNodes))}}var b=new L.Map("map",{attributionControl:!1}).setView(L.latLng(36,-30),3),c={color:"red",opacity:.7,fillOpacity:.7,weight:5,clickable:!1},d={color:"blue",opacity:1,fillOpacity:1,weight:2,clickable:!1};L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(b);var e,f,g=null;window.simplifyNodes=0,window.simplifyLayerName="simplified.gpx",window.simplifyLayerData=null,window.simplifyLayer=L.geoJson(window.simplifyLayerData,{style:d}).addTo(b),L.Control.FileLayerLoad.LABEL='';var h=L.Control.fileLayerLoad({addToMap:!0,fitBounds:!1,fileSizeLimit:8096,layerOptions:{style:c,pointToLayer:function(a,b){return L.circle(b,10,{style:c})}}}).addTo(b);h.loader.on("data:loaded",function(c){g=c.layer,b.fitBounds(g.getBounds()),window.simplifyLayerName=c.filename,a(0),e.html(window.simplifyLayerName),$(".grumble, .grumble-text, .grumble-button").remove(),$(document).unbind("keyup.crumble")}).on("data:error",function(a){console.log("ERROR",a)}),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-download leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Download simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseDownloadFormat),a},a}().addTo(b),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-view leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="View simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseViewFormat),a},a}().addTo(b),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(a){var b=L.DomUtil.create("div","leaflet-control-erase leaflet-bar"),c=L.DomUtil.create("a","",b);return c.href="#",c.target="_blank",c.title="Clear the map",c.innerHTML='',L.DomEvent.on(c,"click",L.DomEvent.stop).on(c,"click",function(){g.eachLayer(function(b){a.removeLayer(b)}),simplifyLayer.clearLayers()}),b},a}().addTo(b),function(){var a=new L.Control({position:"bottomleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-stats");return a.id="stats",a.innerHTML='
',e=$("#filename",a),f=$("#nodes",a),a},a}().addTo(b),L.control.sidebar("sidebar",{position:"right",autoPan:!1}).addTo(b).show(),L.control.attribution({position:"topright",prefix:'LeafletOpenStreetMap contributors'}).addTo(b),$("#slider").slider({value:0,min:0,max:.1,step:5e-5,precision:8,tooltip:"hide"}).on("slide",function(b){a(b.value)}).parent().width("100%"),$("#helpbtn").on("click",function(){$("#modal").modal("show")});var i=$.cookie("tour");(!i||parseInt(i)<3)&&($("#modal").modal("show"),i=(parseInt(i)||0)+1,$.cookie("tour",i,{expires:120}));var j=new Format;j.loadAll(["GeoJSONFormat","GPXFormat","KMLFormat","MediawikiFormat"]),hljs.initHighlightingOnLoad()}); \ No newline at end of file +$(function(){var a=new L.Map("map",{attributionControl:!1}).setView(L.latLng(36,-30),3);window.map=a,L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(a),window.Layers={},window.currentLayer=null,L.Control.FileLayerLoad.LABEL='';var b=L.Control.fileLayerLoad({addToMap:!0,fitBounds:!1,fileSizeLimit:8096,layerOptions:{style:style1,pointToLayer:function(a,b){return L.circle(b,10,{style:style1})}}}).addTo(a);b.loader.on("data:loaded",function(a){window.currentLayer&&window.currentLayer.removeController();var b=new LayerOptimizer(a);b.optimize(0),b.choose(),window.Layers[b.id]=b,window.currentLayer=b,updateLayers()}).on("data:error",function(a){console.log("ERROR",a)}),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-download leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Download simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseDownloadFormat),a},a}().addTo(a),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-view leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="View simplified file",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",chooseViewFormat),a},a}().addTo(a),function(){var a=new L.Control({position:"topleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-erase leaflet-bar"),b=L.DomUtil.create("a","",a);return b.href="#",b.target="_blank",b.title="Clear the map",b.innerHTML='',L.DomEvent.on(b,"click",L.DomEvent.stop).on(b,"click",clearMap),a},a}().addTo(a),function(){var a=new L.Control({position:"bottomleft"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-stats");return a.id="stats",a.innerHTML='
',filename$=$("#filename",a),nodes$=$("#nodes",a),a},a}().addTo(a),L.control.sidebar("sidebar",{position:"right",autoPan:!1}).addTo(a).show(),L.control.attribution({position:"topright",prefix:'LeafletOpenStreetMap contributors'}).addTo(a),function(){var a=new L.Control({position:"topright"});return a.onAdd=function(){var a=L.DomUtil.create("div","leaflet-control-switcher-box leaflet-bar"),b=L.DomUtil.create("label","",a);b.href="#",b.title="Choose the active layer",b.innerHTML="Layer switcher";var c=L.DomUtil.create("select","leaflet-control-switcher leaflet-bar",a);return L.DomEvent.on(c,"change",function(){window.currentLayer.removeController(),window.currentLayer=window.Layers[$(this).val()],window.currentLayer.choose()}),a},a}().addTo(a),$("#slider").slider({value:0,min:0,max:.1,step:5e-5,precision:8,tooltip:"hide"}).on("slide",function(a){window.currentLayer.optimize(a.value),window.currentLayer.displayInfos()}).parent().width("100%"),$("#helpbtn").on("click",function(){$("#modal").modal("show")});var c=$.cookie("tour");(!c||parseInt(c)<3)&&($("#modal").modal("show"),c=(parseInt(c)||0)+1,$.cookie("tour",c,{expires:120}));var d=new Format;d.loadAll(["GeoJSONFormat","GPXFormat","KMLFormat","MediawikiFormat"]),hljs.initHighlightingOnLoad()}); \ No newline at end of file diff --git a/dist/planes.min.js b/dist/planes.min.js new file mode 100644 index 0000000..10e2f12 --- /dev/null +++ b/dist/planes.min.js @@ -0,0 +1 @@ +function chooseAirports(a){hideAll();var b=getPosition(a.currentTarget);$(".planes").css("top",b.y-4),$(".planes").show()}function distance(a,b,c,d){return 2*Math.asin(Math.sqrt(Math.pow(Math.sin((a-c)/2),2)+Math.cos(a)*Math.cos(c)*Math.pow(Math.sin((b-d)/2),2)))}function pathFraction(a,b,c){var d=Math.radians(a.split(",")[0]),e=Math.radians(a.split(",")[1]),f=Math.radians(b.split(",")[0]),g=Math.radians(b.split(",")[1]),h=distance(d,e,f,g),i=Math.sin((1-c)*h)/Math.sin(h),j=Math.sin(c*h)/Math.sin(h),k=i*Math.cos(d)*Math.cos(e)+j*Math.cos(f)*Math.cos(g),l=i*Math.cos(d)*Math.sin(e)+j*Math.cos(f)*Math.sin(g),m=i*Math.sin(d)+j*Math.sin(f),n=Math.atan2(m,Math.sqrt(Math.pow(k,2)+Math.pow(l,2))),o=Math.atan2(l,k);return[Math.degrees(o),Math.degrees(n)]}function traceFlightPrecision(a,b,c){var d=[];d.push(a.split(",").reverse());for(var e=1/c,f=0;1>f;f+=e)d.push(pathFraction(a,b,f));return d.push(b.split(",").reverse()),{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:d}}}function traceFlight(){$("#fromval").val()&&$("#toval").val()&&(window.simplifyLayerData=traceFlightPrecision($("#fromval").val(),$("#toval").val(),100),window.simplifyLayer=L.geoJson(window.simplifyLayerData,{style:window.style2}).addTo(window.map),window.layers[$("#from").val()+" -> "+$("#to").val()]=window.simplifyLayerData)}Math.radians=function(a){return a*Math.PI/180},Math.degrees=function(a){return 180*a/Math.PI},$(document).ready(function(){$(".autocomplete").autocomplete({serviceUrl:"http://wilkins.fr/airports/iata.php",onSelect:function(a){$("#"+this.id+"val").val(a.data),traceFlight()}})}); \ No newline at end of file diff --git a/dist/style.css b/dist/style.css new file mode 100644 index 0000000..aa172d7 --- /dev/null +++ b/dist/style.css @@ -0,0 +1,219 @@ +body { + background: #4d5b69; + color: #eee; } + +h4 { + float: left; + letter-spacing: .065em; + margin: 5px 20px 5px 10px; + padding: 5px; + text-shadow: 1px 1px 3px #333; } + h4 a { + color: #eee; } + h4 a:hover { + color: #fff; } + +#map { + background: #dce6f0; + bottom: 40px; + left: 0; + position: absolute; + right: 0; + top: 40px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } + +.leaflet-bar a { + color: #4d5b69; } + .leaflet-bar a:first-child { + background: #fff; + font-size: 18px; } + .leaflet-bar a:last-of-type { + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; } + +.leaflet-control-switcher-box { + background-color: #eee; + color: #4d5b69; + display: none; + padding: 5px; + text-align: center; } + .leaflet-control-switcher-box select { + border: 1px solid #4d5b69; + display: block; + width: 200px; } + +.leaflet-control-stats { + color: #4d5b69; + font-size: 20px; + text-shadow: 1px 1px 2px #fff; } + +.leaflet-sidebar a.close { + background: #dce6f0; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.65); + color: #4d5b69; + font-size: 20pt; + height: 23px; + left: -10px; + opacity: 1; + right: auto; + top: 1px; + width: 23px; } + +#sidebar { + background: #dce6f0; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); + color: #4d5b69; + overflow-y: auto; + padding: 8px; } + +#slider_wrap { + bottom: 0; + height: 40px; + left: 0; + padding: 10px 20px; + position: absolute; + right: 0; } + #slider_wrap #slider { + visibility: hidden; } + #slider_wrap .slider-handle { + background: #7d8b99; + opacity: 1; } + +#modal { + z-index: 2000; } + #modal .modal-content { + border: 2px solid #eee; + border-radius: 0; } + #modal .modal-header { + background: #4d5b69; + color: #fff; + font-weight: bold; } + #modal .modal-header .close { + color: #fff; + font-size: 2.5em; + line-height: 1.2em; + opacity: 1; + text-shadow: none; } + #modal .modal-body { + padding: 12px; + text-align: center; } + +#credits .list-group-item.active { + background: #4d5b69; + color: #fff; } + +#social { + padding: 8px; + position: fixed; + right: 220px; + top: 0; + z-index: 800; } + #social .fb-like { + line-height: 12px; } + +#copy { + background: #424b54; + border-radius: .7em; + box-shadow: 0 0 8px #eee; + color: #eee; + opacity: .8; + padding: 8px 8px 2px 8px; + position: fixed; + right: 30px; + top: -8px; + z-index: 1000; } + #copy a { + color: #ccc; + text-decoration: none; } + #copy a:hover { + color: #fff; } + +#ribbon { + border: 0; + opacity: .8; + position: absolute; + right: 0; + top: 0; } + +.formats { + background-color: #eee; + border: 2px solid rgba(77, 91, 105, 0.5); + border-radius: 4px; + display: none; + margin-left: 45px; + position: absolute; + width: 200px; } + .formats a { + color: #4d5b69; + cursor: pointer; + display: block; + font-weight: bold; + height: 30px; + padding: 3px; } + .formats a:hover { + background-color: #4d5b69; + color: #eee; + text-decoration: none; } + +#export-format { + background-color: #4d5b69; + border-radius: 2px; + height: 500px; + margin: auto; + overflow: hidden; + padding: 5px; + position: absolute; + width: 750px; } + #export-format .actions { + padding: 10px; + text-align: center; } + #export-format pre { + margin: auto; + padding: 0; } + #export-format code { + display: block; + height: 400px; + margin: 2px; + overflow: auto; + width: 730px; } + #export-format h5 { + color: #eee; + font-size: 20px; + text-align: center; } + #export-format a { + background-color: #eee; + border: 1px solid #eee; + color: #4d5b69; + font-weight: bold; + padding: 2px 4px; } + +.planes { + background-color: #eee; + border: 2px solid rgba(77, 91, 105, 0.5); + border-radius: 4px; + display: none; + margin-left: 45px; + position: absolute; + color: #4d5b69; + font-weight: bold; + padding: 5px; + width: 320px; } + .planes label { + clear: both; + float: left; + width: 50px; } + .planes input { + border: 1px solid #4d5b69; + padding: 2px; + width: 240px; } + +.autocomplete-suggestion { + background-color: #eee; + border-bottom: 1px solid #4d5b69; + color: #4d5b69; + cursor: pointer; } diff --git a/dist/style.min.css b/dist/style.min.css index 022b431..19cd1f5 100644 --- a/dist/style.min.css +++ b/dist/style.min.css @@ -3,4 +3,4 @@ * * Licensed under the Apache License v2.0 * - */.leaflet-sidebar>.leaflet-control,.slider-selection{-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.formats a,.modal-header{font-weight:700}.slider{display:inline-block;vertical-align:middle;position:relative}#map,#slider_wrap,.leaflet-sidebar,.slider-handle,.slider-selection,.slider-track{position:absolute}.formats,.slider input{display:none}.slider.slider-horizontal{width:210px;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-handle{margin-left:-10px;margin-top:-5px}.slider.slider-horizontal .slider-handle.triangle{border-width:0 10px 10px;width:0;height:0;border-bottom-color:#0480be;margin-top:0}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;margin-left:-5px;left:50%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-handle{margin-left:-5px;margin-top:-10px}.slider.slider-vertical .slider-handle.triangle{border-width:10px 0 10px 10px;width:1px;height:1px;border-left-color:#0480be;margin-left:0}.slider.slider-disabled .slider-handle{background-image:-webkit-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:linear-gradient(to bottom,#dfdfdf 0,#bebebe 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf', endColorstr='#ffbebebe', GradientType=0)}.slider.slider-disabled .slider-track{background-image:-webkit-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:linear-gradient(to bottom,#e5e5e5 0,#e9e9e9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5', endColorstr='#ffe9e9e9', GradientType=0);cursor:not-allowed}.slider .tooltip-inner{white-space:nowrap}.slider-track{cursor:pointer;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#f9f9f9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);border-radius:4px}.slider-selection{background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-sizing:border-box;border-radius:4px}.slider-handle{width:20px;height:20px;background-color:#3a94a5;background-image:-webkit-linear-gradient(top,#149bdf 0,#0480be 100%);background-image:linear-gradient(to bottom,#149bdf 0,#0480be 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);border:0 solid transparent}.slider-handle.round{border-radius:50%}.slider-handle.triangle{background:0 0}.leaflet-sidebar{height:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:10px;z-index:2000}.leaflet-sidebar.left{left:-500px;transition:left .5s,width .5s;padding-right:0}.leaflet-sidebar.left.visible{left:0}.leaflet-sidebar.right{right:-500px;transition:right .5s,width .5s;padding-left:0}.leaflet-sidebar.right.visible{right:0}.leaflet-sidebar>.leaflet-control{height:100%;width:100%;overflow:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box;padding:8px 24px;font-size:1.1em;background:#fff;box-shadow:0 1px 7px rgba(0,0,0,.65);-webkit-border-radius:4px;border-radius:4px}.leaflet-touch .leaflet-sidebar>.leaflet-control{box-shadow:none;border:2px solid rgba(0,0,0,.2);background-clip:padding-box}@media (max-width:767px){.leaflet-sidebar{width:100%;padding:0}.leaflet-sidebar.left.visible~.leaflet-left{left:100%}.leaflet-sidebar.right.visible~.leaflet-right{right:100%}.leaflet-sidebar.left{left:-100%}.leaflet-sidebar.left.visible{left:0}.leaflet-sidebar.right{right:-100%}.leaflet-sidebar.right.visible{right:0}.leaflet-sidebar>.leaflet-control{box-shadow:none;-webkit-border-radius:0;border-radius:0}.leaflet-touch .leaflet-sidebar>.leaflet-control{border:0}}@media (min-width:768px)and (max-width:991px){.leaflet-sidebar{width:305px}.leaflet-sidebar.left.visible~.leaflet-left{left:305px}.leaflet-sidebar.right.visible~.leaflet-right{right:305px}}@media (min-width:992px)and (max-width:1199px){.leaflet-sidebar{width:390px}.leaflet-sidebar.left.visible~.leaflet-left{left:390px}.leaflet-sidebar.right.visible~.leaflet-right{right:390px}}@media (min-width:1200px){.leaflet-sidebar{width:460px}.leaflet-sidebar.left.visible~.leaflet-left{left:460px}.leaflet-sidebar.right.visible~.leaflet-right{right:460px}}.leaflet-sidebar .close{position:absolute;right:20px;top:20px;width:31px;height:31px;color:#333;font-size:25pt;line-height:1em;text-align:center;background:#fff;-webkit-border-radius:16px;border-radius:16px;cursor:pointer;z-index:8}body,h4 a{color:#eee}.leaflet-left{transition:left .5s}.leaflet-right{transition:right .5s}body{background:#4D5B69}h4{float:left;padding:5px;margin:5px 20px 5px 10px;text-shadow:1px 1px 3px #333;letter-spacing:.065em}h4 a:hover{color:#fff}#map{top:40px;bottom:40px;left:0;right:0;background:rgba(220,230,240,1);-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control-zoom.leaflet-bar a{color:#4D5B69}.leaflet-control-download.leaflet-bar a:first-child,.leaflet-control-erase.leaflet-bar a:first-child,.leaflet-control-filelayer.leaflet-bar a:first-child,.leaflet-control-view.leaflet-bar a:first-child{background:#fff;border-radius:4px;font-size:18px;color:#4D5B69}#sidebar,.leaflet-sidebar a.close{color:#4D5B69;background:rgba(220,230,240,1)}.leaflet-control-stats{color:#323C45;font-size:20px;text-shadow:1px 1px 2px #fff}.leaflet-sidebar a.close{opacity:1;top:1px;right:auto;left:-10px;font-size:20pt;height:23px;width:23px;box-shadow:0 1px 3px rgba(0,0,0,.65)}#sidebar{padding:8px;overflow-y:auto;box-shadow:0 1px 4px rgba(0,0,0,.6)}#credits .list-group-item.active,.modal-header{background:#4D5B69;color:#fff}#slider_wrap{bottom:0;left:0;right:0;height:40px;padding:10px 20px}#copy,#social{position:fixed}#slider{visibility:hidden}.slider-handle{opacity:1;background:#7D8B99}#modal{z-index:2000}.modal-content{border:2px solid #eee;border-radius:0}.modal-header .close{font-size:2.5em;line-height:1.2em;text-shadow:none;color:#fff;opacity:1}.modal-body{padding:12px;text-align:center}#social{z-index:800;right:220px;top:0;padding:8px}#social .fb-like{line-height:12px}#copy{z-index:1000;right:30px;top:-8px;padding:8px 8px 2px;background:#424b54;border-radius:.7em;opacity:.8;box-shadow:0 0 8px #eee;color:#eee}#export-format,#ribbon,.formats{position:absolute}#copy a{color:#ccc;text-decoration:none}#copy a:hover{color:#fff}#ribbon{top:0;right:0;border:0;opacity:.8}.formats{background-color:#fff;border:2px solid rgba(77,91,105,.5);border-radius:4px;margin:0 0 0 45px;width:200px}.formats a{color:#4d5b69;cursor:pointer;display:block;height:30px;padding:3px}.formats a:hover{background-color:#4d5b69;color:#fff;text-decoration:none}#download-formats{top:168px}#view-formats{top:212px}#export-format{background-color:#4d5b69;height:500px;margin:auto;overflow:hidden;padding:5px;width:750px;border-radius:2px}#export-format .actions{padding:10px;text-align:center}#export-format pre{padding:0;margin:auto}#export-format code{overflow:auto;display:block;height:400px;width:730px;margin:2px}#export-format h5{color:#fff;font-size:20px;text-align:center}#export-format a{color:#4d5b69;border:1px solid #fff;background-color:#fff;font-weight:700;padding:2px 4px} \ No newline at end of file + */.leaflet-sidebar>.leaflet-control,.slider-selection{-webkit-box-sizing:border-box;-moz-box-sizing:border-box}#modal .modal-header,.formats a,.planes{font-weight:700}.slider{display:inline-block;vertical-align:middle;position:relative}#map,#slider_wrap,.leaflet-sidebar,.slider-handle,.slider-selection,.slider-track{position:absolute}.slider.slider-horizontal{width:210px;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-handle{margin-left:-10px;margin-top:-5px}.slider.slider-horizontal .slider-handle.triangle{border-width:0 10px 10px;width:0;height:0;border-bottom-color:#0480be;margin-top:0}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;margin-left:-5px;left:50%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-handle{margin-left:-5px;margin-top:-10px}.slider.slider-vertical .slider-handle.triangle{border-width:10px 0 10px 10px;width:1px;height:1px;border-left-color:#0480be;margin-left:0}.slider.slider-disabled .slider-handle{background-image:-webkit-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:linear-gradient(to bottom,#dfdfdf 0,#bebebe 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf', endColorstr='#ffbebebe', GradientType=0)}.slider.slider-disabled .slider-track{background-image:-webkit-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:linear-gradient(to bottom,#e5e5e5 0,#e9e9e9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5', endColorstr='#ffe9e9e9', GradientType=0);cursor:not-allowed}.slider input{display:none}.slider .tooltip-inner{white-space:nowrap}.slider-track{cursor:pointer;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#f9f9f9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);border-radius:4px}.slider-selection{background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-sizing:border-box;border-radius:4px}.slider-handle{width:20px;height:20px;background-color:#3a94a5;background-image:-webkit-linear-gradient(top,#149bdf 0,#0480be 100%);background-image:linear-gradient(to bottom,#149bdf 0,#0480be 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);opacity:.8;border:0 solid transparent}.slider-handle.round{border-radius:50%}.slider-handle.triangle{background:0 0}.leaflet-sidebar{height:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:10px;z-index:2000}.leaflet-sidebar.left{left:-500px;transition:left .5s,width .5s;padding-right:0}.leaflet-sidebar.left.visible{left:0}.leaflet-sidebar.right{right:-500px;transition:right .5s,width .5s;padding-left:0}.leaflet-sidebar.right.visible{right:0}.leaflet-sidebar>.leaflet-control{height:100%;width:100%;overflow:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box;padding:8px 24px;font-size:1.1em;background:#fff;box-shadow:0 1px 7px rgba(0,0,0,.65);-webkit-border-radius:4px;border-radius:4px}.leaflet-touch .leaflet-sidebar>.leaflet-control{box-shadow:none;border:2px solid rgba(0,0,0,.2);background-clip:padding-box}@media (max-width:767px){.leaflet-sidebar{width:100%;padding:0}.leaflet-sidebar.left.visible~.leaflet-left{left:100%}.leaflet-sidebar.right.visible~.leaflet-right{right:100%}.leaflet-sidebar.left{left:-100%}.leaflet-sidebar.left.visible{left:0}.leaflet-sidebar.right{right:-100%}.leaflet-sidebar.right.visible{right:0}.leaflet-sidebar>.leaflet-control{box-shadow:none;-webkit-border-radius:0;border-radius:0}.leaflet-touch .leaflet-sidebar>.leaflet-control{border:0}}@media (min-width:768px)and (max-width:991px){.leaflet-sidebar{width:305px}.leaflet-sidebar.left.visible~.leaflet-left{left:305px}.leaflet-sidebar.right.visible~.leaflet-right{right:305px}}@media (min-width:992px)and (max-width:1199px){.leaflet-sidebar{width:390px}.leaflet-sidebar.left.visible~.leaflet-left{left:390px}.leaflet-sidebar.right.visible~.leaflet-right{right:390px}}@media (min-width:1200px){.leaflet-sidebar{width:460px}.leaflet-sidebar.left.visible~.leaflet-left{left:460px}.leaflet-sidebar.right.visible~.leaflet-right{right:460px}}.leaflet-sidebar .close{position:absolute;right:20px;top:20px;width:31px;height:31px;color:#333;font-size:25pt;line-height:1em;text-align:center;background:#fff;-webkit-border-radius:16px;border-radius:16px;cursor:pointer;z-index:8}body,h4 a{color:#eee}.leaflet-left{transition:left .5s}.leaflet-right{transition:right .5s}body{background:#4d5b69}h4{float:left;letter-spacing:.065em;margin:5px 20px 5px 10px;padding:5px;text-shadow:1px 1px 3px #333}h4 a:hover{color:#fff}#map{background:#dce6f0;bottom:40px;left:0;right:0;top:40px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-bar a{color:#4d5b69}.leaflet-bar a:first-child{background:#fff;font-size:18px}.leaflet-bar a:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.leaflet-control-switcher-box{background-color:#eee;color:#4d5b69;display:none;padding:5px;text-align:center}.leaflet-control-switcher-box select{border:1px solid #4d5b69;display:block;width:200px}.leaflet-control-stats{color:#4d5b69;font-size:20px;text-shadow:1px 1px 2px #fff}.leaflet-sidebar a.close{background:#dce6f0;box-shadow:0 1px 3px rgba(0,0,0,.65);color:#4d5b69;font-size:20pt;height:23px;left:-10px;opacity:1;right:auto;top:1px;width:23px}#sidebar{background:#dce6f0;box-shadow:0 1px 4px rgba(0,0,0,.6);color:#4d5b69;overflow-y:auto;padding:8px}#credits .list-group-item.active,#modal .modal-header{background:#4d5b69;color:#fff}#slider_wrap{bottom:0;height:40px;left:0;padding:10px 20px;right:0}#copy,#social{position:fixed}#slider_wrap #slider{visibility:hidden}#slider_wrap .slider-handle{background:#7d8b99;opacity:1}#modal{z-index:2000}#modal .modal-content{border:2px solid #eee;border-radius:0}#modal .modal-header .close{color:#fff;font-size:2.5em;line-height:1.2em;opacity:1;text-shadow:none}#modal .modal-body{padding:12px;text-align:center}#social{padding:8px;right:220px;top:0;z-index:800}#social .fb-like{line-height:12px}#copy{background:#424b54;border-radius:.7em;box-shadow:0 0 8px #eee;color:#eee;opacity:.8;padding:8px 8px 2px;right:30px;top:-8px;z-index:1000}#export-format,#ribbon,.formats,.planes{position:absolute}#copy a{color:#ccc;text-decoration:none}#copy a:hover{color:#fff}#ribbon{border:0;opacity:.8;right:0;top:0}.formats{background-color:#eee;border:2px solid rgba(77,91,105,.5);border-radius:4px;display:none;margin-left:45px;width:200px}.formats a{color:#4d5b69;cursor:pointer;display:block;height:30px;padding:3px}.formats a:hover{background-color:#4d5b69;color:#eee;text-decoration:none}#export-format{background-color:#4d5b69;border-radius:2px;height:500px;margin:auto;overflow:hidden;padding:5px;width:750px}.autocomplete-suggestion,.planes{color:#4d5b69;background-color:#eee}#export-format .actions{padding:10px;text-align:center}#export-format pre{margin:auto;padding:0}#export-format code{display:block;height:400px;margin:2px;overflow:auto;width:730px}#export-format h5{color:#eee;font-size:20px;text-align:center}#export-format a{background-color:#eee;border:1px solid #eee;color:#4d5b69;font-weight:700;padding:2px 4px}.planes{border:2px solid rgba(77,91,105,.5);border-radius:4px;display:none;margin-left:45px;padding:5px;width:320px}.planes label{clear:both;float:left;width:50px}.planes input{border:1px solid #4d5b69;padding:2px;width:240px}.autocomplete-suggestion{border-bottom:1px solid #4d5b69;cursor:pointer} \ No newline at end of file diff --git a/index.html b/index.html index e47990f..385be30 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ + @@ -40,7 +41,6 @@

Tracks Optimizer online  
-
-
+ + -
+