aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 18:23:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 18:23:32 +1300
commit99d132dc78b42b6cc5833b3a7faf30d2fe56186f (patch)
tree045052b15478c32c44f36a07c70885a756ea19b3 /web/app/AttributeFormatter.js
parentdcfe1d48998c3fb3baa704fafed43d996f329a07 (diff)
downloadtrackermap-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.js92
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;
+ }
+ }
+});