diff --git a/static/css/leaflet-gps.min.css b/static/css/leaflet-gps.min.css new file mode 100644 index 0000000000..b6c65388cb --- /dev/null +++ b/static/css/leaflet-gps.min.css @@ -0,0 +1,18 @@ +/* + * Leaflet Control GPS v1.1.0 - 2016-06-14 + * + * Copyright 2016 Stefano Cudini + * stefano.cudini@gmail.com + * http://labs.easyblog.it/ + * + * Licensed under the MIT license. + * + * Demos: + * http://labs.easyblog.it/maps/leaflet-gps/ + * + * Source: + * git@github.com:stefanocudini/leaflet-gps.git + * + */ + +.leaflet-container .leaflet-control-gps{position:relative;float:left;background:#fff;color:#1978cf;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;background-color:rgba(255,255,255,.8);z-index:1000;box-shadow:0 1px 7px rgba(0,0,0,.65);margin-left:10px;margin-top:10px}.leaflet-control-gps .gps-button{display:block;float:left;width:26px;height:26px;background:url(../img/gps-icon.png) no-repeat 2px 2px;border-radius:4px}.leaflet-control-gps .gps-button.active:hover,.leaflet-control-gps .gps-button:hover{background:url(../img/gps-icon.png) no-repeat 2px -24px #fff}.leaflet-control-gps .gps-button.active{background:url(../img/gps-icon.png) no-repeat 2px -50px #fff}.leaflet-control-gps .gps-alert{position:absolute;left:26px;bottom:-1px;width:100px;padding:2px;line-height:.95em;color:#e00;border:1px solid #888;background-color:rgba(255,255,255,.75);border-radius:4px} \ No newline at end of file diff --git a/static/img/gps-icon.png b/static/img/gps-icon.png new file mode 100644 index 0000000000..ddc1c3a6ce Binary files /dev/null and b/static/img/gps-icon.png differ diff --git a/static/img/yellow-team.svg b/static/img/yellow-team.svg new file mode 100644 index 0000000000..3e7ea67b24 --- /dev/null +++ b/static/img/yellow-team.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/js/compass.js b/static/js/compass.js new file mode 100644 index 0000000000..3368d4c5a1 --- /dev/null +++ b/static/js/compass.js @@ -0,0 +1 @@ +(function(e){"use strict";var t=function(t){return t!=null||t!=e},n=function(e,t){var n=i._callbacks[e];for(var r=0;re.length-6;n--)t+=e[n];return t/5},i=window.Compass={method:e,watch:function(e){var t=++i._lastId;return i.init(function(n){if(n=="phonegap")i._watchers[t]=i._nav.compass.watchHeading(e);else if(n=="webkitOrientation"){var r=function(t){e(t.webkitCompassHeading)};i._win.addEventListener("deviceorientation",r),i._watchers[t]=r}else if(n=="orientationAndGPS"){var s,r=function(t){s=-t.alpha+i._gpsDiff,s<0?s+=360:s>360&&(s-=360),e(s)};i._win.addEventListener("deviceorientation",r),i._watchers[t]=r}}),t},unwatch:function(e){return i.init(function(t){t=="phonegap"?i._nav.compass.clearWatch(i._watchers[e]):(t=="webkitOrientation"||t=="orientationAndGPS")&&i._win.removeEventListener("deviceorientation",i._watchers[e]),delete i._watchers[e]}),i},needGPS:function(e){return i._callbacks.needGPS.push(e),i},needMove:function(e){return i._callbacks.needMove.push(e),i},noSupport:function(e){return i.method===!1?e():t(i.method)||i._callbacks.noSupport.push(e),i},init:function(e){if(t(i.method)){e(i.method);return}i._callbacks.init.push(e);if(i._initing)return;return i._initing=!0,i._nav.compass?i._start("phonegap"):i._win.DeviceOrientationEvent?(i._checking=0,i._win.addEventListener("deviceorientation",i._checkEvent),setTimeout(function(){i._checking!==!1&&i._start(!1)},500)):i._start(!1),i},_lastId:0,_watchers:{},_win:window,_nav:navigator,_callbacks:{init:[],noSupport:[],needGPS:[],needMove:[]},_initing:!1,_gpsDiff:e,_start:function(e){i.method=e,i._initing=!1,n("init",[e]),i._callbacks.init=[],e===!1&&n("noSupport",[]),i._callbacks.noSupport=[]},_checking:!1,_checkEvent:function(e){i._checking+=1;var n=!1;t(e.webkitCompassHeading)?i._start("webkitOrientation"):t(e.alpha)&&i._nav.geolocation?i._gpsHack():i._checking>1?i._start(!1):n=!0,n||(i._checking=!1,i._win.removeEventListener("deviceorientation",i._checkEvent))},_gpsHack:function(){var e=!0,s=[],o=[];n("needGPS");var u=function(e){s.push(e.alpha)};i._win.addEventListener("deviceorientation",u);var a=function(a){var f=a.coords;if(!t(f.heading))return;e&&(e=!1,n("needMove")),f.speed>1?(o.push(f.heading),o.length>=5&&s.length>=5&&(i._win.removeEventListener("deviceorientation",u),i._nav.geolocation.clearWatch(l),i._gpsDiff=r(o)+r(s),i._start("orientationAndGPS"))):o=[]},f=function(){i._win.removeEventListener("deviceorientation",u),i._start(!1)},l=i._nav.geolocation.watchPosition(a,f,{enableHighAccuracy:!0})}}})(); \ No newline at end of file diff --git a/static/js/leaflet-gps.min.js b/static/js/leaflet-gps.min.js new file mode 100644 index 0000000000..a65fc6e8b6 --- /dev/null +++ b/static/js/leaflet-gps.min.js @@ -0,0 +1,17 @@ +/* + * Leaflet Control GPS v1.1.0 - 2016-06-14 + * + * Copyright 2016 Stefano Cudini + * stefano.cudini@gmail.com + * http://labs.easyblog.it/ + * + * Licensed under the MIT license. + * + * Demos: + * http://labs.easyblog.it/maps/leaflet-gps/ + * + * Source: + * git@github.com:stefanocudini/leaflet-gps.git + * + */ +(function(){L.Control.Gps=L.Control.extend({includes:L.Mixin.Events,options:{autoActive:!1,autoCenter:!1,maxZoom:null,textErr:null,callErr:null,style:{radius:5,weight:2,color:"#c20",opacity:1,fillColor:"#f23",fillOpacity:1},marker:null,accuracy:!0,title:"Center map on your location",position:"topleft",transform:function(a){return a},setView:!1},initialize:function(a){a&&a.style&&(a.style=L.Util.extend({},this.options.style,a.style)),L.Util.setOptions(this,a),this._errorFunc=this.options.callErr||this.showAlert,this._isActive=!1,this._firstMoved=!1,this._currentLocation=null},onAdd:function(a){this._map=a;var b=L.DomUtil.create("div","leaflet-control-gps");return this._button=L.DomUtil.create("a","gps-button",b),this._button.href="#",this._button.title=this.options.title,L.DomEvent.on(this._button,"click",L.DomEvent.stop,this).on(this._button,"click",this._switchGps,this),this._alert=L.DomUtil.create("div","gps-alert",b),this._alert.style.display="none",this._gpsMarker=this.options.marker?this.options.marker:new L.CircleMarker([0,0],this.options.style),this._map.on("locationfound",this._drawGps,this).on("locationerror",this._errorGps,this),this.options.autoActive&&this.activate(),b},onRemove:function(a){this.deactivate()},_switchGps:function(){this._isActive?this.deactivate():this.activate()},getLocation:function(){return this._currentLocation},activate:function(){this._isActive=!0,this._map.addLayer(this._gpsMarker),this._map.locate({enableHighAccuracy:!0,watch:!0,setView:this.options.setView,maxZoom:this.options.maxZoom})},deactivate:function(){this._isActive=!1,this._firstMoved=!1,this._map.stopLocate(),L.DomUtil.removeClass(this._button,"active"),this._map.removeLayer(this._gpsMarker),this.fire("gpsdisabled")},_drawGps:function(a){this._currentLocation=this.options.transform(a.latlng),this._gpsMarker.setLatLng(this._currentLocation),!this._isActive||this._firstMoved&&!this.options.autoCenter||this._moveTo(this._currentLocation),this.fire("gpslocated",{latlng:this._currentLocation,marker:this._gpsMarker}),L.DomUtil.addClass(this._button,"active")},_moveTo:function(a){this._firstMoved=!0,this.options.maxZoom?this._map.setView(a,Math.min(this._map.getZoom(),this.options.maxZoom)):this._map.panTo(a)},_errorGps:function(a){this.deactivate(),this._errorFunc.call(this,this.options.textErr||a.message)},showAlert:function(a){this._alert.style.display="block",this._alert.innerHTML=a;var b=this;clearTimeout(this.timerAlert),this.timerAlert=setTimeout(function(){b._alert.style.display="none"},2e3)}}),L.Map.addInitHook(function(){this.options.gpsControl&&(this.gpsControl=L.control.gps(this.options.gpsControlOptions),this.addControl(this.gpsControl))}),L.control.gps=function(a){return new L.Control.Gps(a)}}).call(this); \ No newline at end of file diff --git a/static/js/leaflet.rotatedMarker.js b/static/js/leaflet.rotatedMarker.js new file mode 100644 index 0000000000..35ab55aaca --- /dev/null +++ b/static/js/leaflet.rotatedMarker.js @@ -0,0 +1,50 @@ +(function() { + // save these original methods before they are overwritten + var proto_initIcon = L.Marker.prototype._initIcon; + var proto_setPos = L.Marker.prototype._setPos; + + var oldIE = (L.DomUtil.TRANSFORM === 'msTransform'); + + L.Marker.addInitHook(function () { + var iconAnchor = this.options.icon.options.iconAnchor; + if (iconAnchor) { + iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px'); + } + this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ; + this.options.rotationAngle = this.options.rotationAngle || 0; + }); + + L.Marker.include({ + _initIcon: function() { + proto_initIcon.call(this); + }, + + _setPos: function (pos) { + proto_setPos.call(this, pos); + + if(this.options.rotationAngle) { + this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin; + + if(oldIE) { + // for IE 9, use the 2D rotation + this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)'; + } else { + // for modern browsers, prefer the 3D accelerated version + this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)'; + } + } + }, + + setRotationAngle: function(angle) { + this.options.rotationAngle = angle; + this.update(); + return this; + }, + + setRotationOrigin: function(origin) { + this.options.rotationOrigin = origin; + this.update(); + return this; + } + }); +})(); diff --git a/templates/newmap.html b/templates/newmap.html index 57c124f361..f3b4c8baf3 100644 --- a/templates/newmap.html +++ b/templates/newmap.html @@ -4,6 +4,7 @@ Pokeminer - {{ area_name }} +