forked from nus-cs2103/old-website
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtooltip.js
35 lines (32 loc) · 1.01 KB
/
tooltip.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
(function() {
// Maps a string to a tooltip (in the form of a HTML string)
var tooltips = {
'GTD' : 'Getting Things Done',
'IDE' : 'Integrated Development Environment',
'Regression' : 'A <em>regression</em> is an unintended side effect of a modification to the code. <br>'
+ 'e.g. when fixing one bug causes another bug'
};
// Maps a string to a list of aliases
var aliases = {
'Regression' : ['regression', 'regressions']
}
for (let term in aliases) {
let tooltip = tooltips[term];
let values = aliases[term];
for (let i in values) {
let alias = values[i];
tooltips[alias] = tooltip;
}
}
var count = 0;
$('tooltip').each(function() {
var term = $(this).text();
var title = tooltips[term];
var id = String(count++);
$(this).attr('id', id);
$(this).tooltip({
items: '#' + id,
content: title
});
});
})();