client/annotviz/app/js/utils.js
changeset 122 3b11017a76a4
parent 121 df6b39f962bc
parent 119 e6605fecb175
child 124 b5697bcdbaff
equal deleted inserted replaced
121:df6b39f962bc 122:3b11017a76a4
    10 function formatTime (ts) {
    10 function formatTime (ts) {
    11 	var hours = Math.floor( (ts/1000) / 3600 ) % 24;
    11 	var hours = Math.floor( (ts/1000) / 3600 ) % 24;
    12 	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
    12 	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
    13 	var seconds = Math.floor( (ts/1000) % 60);
    13 	var seconds = Math.floor( (ts/1000) % 60);
    14 	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
    14 	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
       
    15 }
       
    16 
       
    17 function colorToHex(c) {
       
    18 	var m = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c);
       
    19 	return m ? '#' + (1 << 24 | m[1] << 16 | m[2] << 8 | m[3]).toString(16).substr(1) : c;
    15 }
    20 }
    16 
    21 
    17 function getAnnotCategories(urlCategories, annotCategories) {
    22 function getAnnotCategories(urlCategories, annotCategories) {
    18 
    23 
    19     var jsonLoader = new PIXI.JsonLoader(urlCategories, true);
    24     var jsonLoader = new PIXI.JsonLoader(urlCategories, true);
    46     
    51     
    47 }
    52 }
    48 
    53 
    49 module.exports = {
    54 module.exports = {
    50 	formatTime: formatTime,
    55 	formatTime: formatTime,
    51 	getAnnotCategories: getAnnotCategories
    56 	getAnnotCategories: getAnnotCategories,
       
    57 	colorToHex: colorToHex
    52 };
    58 };