diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-14 12:14:52 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-14 12:14:52 +1200 |
commit | d409a737a28078db9d43f2ab103836c54cdec4db (patch) | |
tree | 1a6d79ba05bdbbb8a09cfb8de2665c4b573c7745 | |
parent | fa57a657f54a76a3b8163f5e8b00026cfbb79fe5 (diff) | |
download | trackermap-web-d409a737a28078db9d43f2ab103836c54cdec4db.tar.gz trackermap-web-d409a737a28078db9d43f2ab103836c54cdec4db.tar.bz2 trackermap-web-d409a737a28078db9d43f2ab103836c54cdec4db.zip |
Fix JavaScript style issues
-rw-r--r-- | web/.jshintrc | 5 | ||||
-rw-r--r-- | web/app/view/map/BaseMap.js | 18 |
2 files changed, 10 insertions, 13 deletions
diff --git a/web/.jshintrc b/web/.jshintrc index 0d2e29d5..b0c5d10e 100644 --- a/web/.jshintrc +++ b/web/.jshintrc @@ -1,6 +1,6 @@ { // Enforcing - "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) "camelcase" : true, // true: Identifiers must be in camelCase "curly" : true, // true: Require {} for every new block or scope "eqeqeq" : true, // true: Require triple equals (===) for comparison @@ -70,6 +70,7 @@ "ol" : false, "Traccar" : false, "Strings" : false, - "Locale" : false + "Locale" : false, + "proj4" : false } } diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index ace0d82d..0dab7ca1 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -78,21 +78,17 @@ Ext.define('Traccar.view.map.BaseMap', { source: new ol.source.XYZ({ projection: 'BD-MC', tileUrlFunction: function (tileCoord) { - var URLS_LENGTH = 5; + var urlsLength = 5, z = tileCoord[0], x = tileCoord[1], y = tileCoord[2], hash, index; - var x = tileCoord[1]; - var y = tileCoord[2]; - var z = tileCoord[0]; - - var hash = (x << z) + y; - var index = hash % URLS_LENGTH; - index = index < 0 ? index + URLS_LENGTH : index; + hash = (x << z) + y; + index = hash % urlsLength; + index = index < 0 ? index + urlsLength : index; if (x < 0) { - x = 'M' + (-x) + x = 'M' + (-x); } if (y < 0) { - y = 'M' + (-y) + y = 'M' + (-y); } return 'http://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl' .replace('{}', index).replace('{x}', x).replace('{y}', y).replace('{z}', z); @@ -211,7 +207,7 @@ Ext.define('Traccar.view.map.BaseMap', { } }, function () { - proj4.defs('BD-MC','+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs'); + proj4.defs('BD-MC', '+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs'); proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'); ol.proj.get('EPSG:3395').setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]); |