-
Notifications
You must be signed in to change notification settings - Fork 2
/
static.js
65 lines (64 loc) · 2.09 KB
/
static.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Generated by CoffeeScript 1.9.2
(function() {
$(window).load(function() {
var areas, names, pointer_radius;
names = $('#names li');
areas = $('#facemap area');
$('#footer').click(function() {
return $(this).hide();
});
pointer_radius = 60;
$('#pointer').css({
width: pointer_radius + "px",
height: pointer_radius + "px",
"border-radius": pointer_radius + "px"
});
names.each(function(index, name) {
var first, last;
last = $('span.last', name).text();
first = $('span.first', name).text();
if (!last && !first) {
$(name).html('(Unbekannt)');
}
return $(name).hover((function() {
var area, f, id, image_offset, oleft, otop, x, y;
$(this).addClass('highlight');
id = parseInt($(this).attr('data-id'));
image_offset = $('#faces').offset();
f = $('#faces');
area = $('#facemap area[data-id="' + id + '"]');
oleft = image_offset.left - f.scrollLeft();
otop = image_offset.top - f.scrollTop();
x = (parseInt(area.attr('data-x'))) - Math.floor(pointer_radius / 2) + oleft;
y = (parseInt(area.attr('data-y'))) - Math.floor(pointer_radius / 2) + otop;
return $('#pointer').css({
visibility: "visible",
left: x,
top: y
});
}), (function() {
$('#pointer').css({
visibility: "hidden"
});
return $(this).removeClass('highlight');
}));
});
return areas.each(function(index, area) {
var id, name;
id = parseInt($(this).attr('data-id'));
name = $("#names li[data-id=\"" + id + "\"]");
$(this).attr('title', name.text());
$(this).attr('alt', name.text());
return $(this).hover((function() {
var container;
name.addClass('highlight');
container = $('#names');
return container.animate({
scrollTop: name.offset().top - container.offset().top + container.scrollTop()
}, 32);
}), (function() {
return name.removeClass('highlight');
}));
});
});
}).call(this);