diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 18:23:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 18:23:32 +1300 |
commit | 99d132dc78b42b6cc5833b3a7faf30d2fe56186f (patch) | |
tree | 045052b15478c32c44f36a07c70885a756ea19b3 /web/app/AttributeFormatter.js | |
parent | dcfe1d48998c3fb3baa704fafed43d996f329a07 (diff) | |
download | trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.tar.gz trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.tar.bz2 trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.zip |
Disable JavaScript strict mode
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r-- | web/app/AttributeFormatter.js | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 3f8f346c0..b7b2d01a6 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -13,53 +13,49 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function () { - 'use strict'; - Ext.define('Traccar.AttributeFormatter', { - singleton: true, - - coordinateFormatter: function (value) { - return value.toFixed(6); - }, - - speedFormatter: function (value) { - return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit')); - }, - - courseFormatter: function (value) { - var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']; - return courseValues[Math.floor(value / 45)]; - }, - - distanceFormatter: function (value) { - return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); - }, - - defaultFormatter: function (value) { - if (typeof value === 'number') { - return value.toFixed(2); - } else if (typeof value === 'boolean') { - return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no; - } else if (value instanceof Date) { - return Ext.Date.format(value, Traccar.Style.dateTimeFormat); - } - return value; - }, - - getFormatter: function (key) { - if (key === 'latitude' || key === 'longitude') { - return this.coordinateFormatter; - } else if (key === 'speed') { - return this.speedFormatter; - } else if (key === 'course') { - return this.courseFormatter; - } else if (key === 'distance' || key === 'odometer') { - return this.distanceFormatter; - } else { - return this.defaultFormatter; - } +Ext.define('Traccar.AttributeFormatter', { + singleton: true, + + coordinateFormatter: function (value) { + return value.toFixed(6); + }, + + speedFormatter: function (value) { + return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit')); + }, + + courseFormatter: function (value) { + var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']; + return courseValues[Math.floor(value / 45)]; + }, + + distanceFormatter: function (value) { + return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); + }, + + defaultFormatter: function (value) { + if (typeof value === 'number') { + return value.toFixed(2); + } else if (typeof value === 'boolean') { + return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no; + } else if (value instanceof Date) { + return Ext.Date.format(value, Traccar.Style.dateTimeFormat); } - }); - -})(); + return value; + }, + + getFormatter: function (key) { + if (key === 'latitude' || key === 'longitude') { + return this.coordinateFormatter; + } else if (key === 'speed') { + return this.speedFormatter; + } else if (key === 'course') { + return this.courseFormatter; + } else if (key === 'distance' || key === 'odometer') { + return this.distanceFormatter; + } else { + return this.defaultFormatter; + } + } +}); |