diff -r 0a2b4991d48c -r 0bb70072a56f client/annotviz/app/js/utils.js --- a/client/annotviz/app/js/utils.js Fri Jan 23 01:08:34 2015 +0100 +++ b/client/annotviz/app/js/utils.js Fri Jan 23 02:00:19 2015 +0100 @@ -4,6 +4,8 @@ * basic tools * */ +/*jshint bitwise: false*/ +/*jshint camelcase: false */ 'use strict'; @@ -12,12 +14,12 @@ var moment = require('moment'); function formatTime (ts) { - return moment(ts).format("HH:mm:ss"); + return moment(ts).format('HH:mm:ss'); } function colorToHex(c) { - var m = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c); - return m ? '#' + (1 << 24 | m[1] << 16 | m[2] << 8 | m[3]).toString(16).substr(1) : c; + var m = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c); + return m ? '#' + (1 << 24 | m[1] << 16 | m[2] << 8 | m[3]).toString(16).substr(1) : c; } function getAnnotCategories(urlCategories, annotCategories) { @@ -28,35 +30,35 @@ var data = res.target.json; while(annotCategories.length > 0) { - annotCategories.pop(); + annotCategories.pop(); } data.sessions.forEach(function(session) { var annotCat = { ts: session.start_ts === null ? new Date(0) : Date.parse(session.start_ts), colors: {} - } + }; var categoriesJson = session.categories_json; annotCat.order = categoriesJson.order; if (typeof(annotCat.order['default']) === 'undefined'){ - annotCat.order.push('default'); + annotCat.order.push('default'); } - var catList = _.clone(categoriesJson.categories); - while(catList.length > 0) { - var cat = catList.pop(); - if(cat.code) { - annotCat.colors[cat.code] = colorToHex(cat.color); - } - if(cat.subcategories) { - catList = catList.concat(cat.subcategories); - } - } + var catList = _.clone(categoriesJson.categories); + while(catList.length > 0) { + var cat = catList.pop(); + if(cat.code) { + annotCat.colors[cat.code] = colorToHex(cat.color); + } + if(cat.subcategories) { + catList = catList.concat(cat.subcategories); + } + } categoriesJson.categories.forEach(function(cat) { - if(cat.code) { - annotCat.colors[cat.code] = colorToHex(cat.color); - } + if(cat.code) { + annotCat.colors[cat.code] = colorToHex(cat.color); + } }); - annotCat.defaultColor = categoriesJson.defaultColor || "#536991"; + annotCat.defaultColor = categoriesJson.defaultColor || '#536991'; annotCategories.push(annotCat); }); }); @@ -66,7 +68,7 @@ } module.exports = { - formatTime: formatTime, - getAnnotCategories: getAnnotCategories, - colorToHex: colorToHex + formatTime: formatTime, + getAnnotCategories: getAnnotCategories, + colorToHex: colorToHex };