-
Notifications
You must be signed in to change notification settings - Fork 3
/
utilities.js
39 lines (32 loc) · 1.19 KB
/
utilities.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var data_url = 'https://raw.githubusercontent.com/dhimmel/het.io-rep-data/1a960f0e353586f8fe9f61b569919f24603d4344/browser-tables/';
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
function render_percent(data, type) {
if (type != 'display') {return data};
return data ? data.toLocaleString('en-us', {style: 'percent', minimumSignificantDigits:3, maximumSignificantDigits: 3}) : null;
}
function render_integer(data, type) {
if (type != 'display') {return data};
return data.toLocaleString('en-us');
}
var categories = {DM: 0, SYM: 1, NOT: 3};
function render_category(data, type) {
if (type != 'sort') {return data};
return data == null ? 4 : categories[data];
}
function render_name(data, type, row) {
if (type != 'display') {return data};
var description = row[row.length - 1];
if (!description) {return data};
return `<span data-toggle="tooltip" data-placement="auto bottom" title="${description}">${data}</span>`;
}
function activate_tooltip() {
$(document).ready(function(){
$("body").tooltip({ selector: '[data-toggle=tooltip]' });
});
}