-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathuser.js
109 lines (99 loc) · 3.62 KB
/
user.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
$(document).ready(function() {
// $('div.affixdiv').attr('data-offset-top', $('#topheader div img').height());
$('div.affixdiv').affix({
offset: {
top: $('#topheader div img').height() + 200
}
});
// popup bio for speakers
$('.speaker').each(function() {
var $this = $(this);
$this.popover({
html: true,
trigger: 'manual',
animation: false,
placement: 'top',
title: $this.find('.speaker-name').html(),
content: $this.find('.speaker-bio').html()
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(this).siblings(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide")
}
}, 100);
});
});
// toggle show/hide abstract for a talk
$('.talk').click(function() {
if (!$(this).next().html().includes('<code>NA_character_</code>')) {
$(this).next().toggle();
}
});
$('.abstract').click(function() {
$(this).toggle();
});
// auto toggle abstract on direct links
$(window).on('hashchange', function(e) {
e.preventDefault();
var hash = location.hash;
console.log('hash changed to ' + hash);
if (hash.startsWith("#talk-2-")) {
console.log($(hash).next().html());
if (!$(hash).next().html().includes('<code>NA_character_</code>')) {
console.log('opening talk abstract for ' + hash);
$(hash).next().show();
}
}
});
$('.point-to-abstract').click(function(event) {
event.preventDefault();
console.log($(this).attr('id'));
window.location.hash = '';
window.location.hash = $(this).attr('id').replace('schedule', 'talk');
return false;
});
$('.point-to-schedule').click(function(event) {
event.preventDefault();
console.log($(this).parent().attr('id'));
window.location.hash = '';
window.location.hash = $(this).parent().attr('id').replace('talk', 'schedule');
return false;
});
$(".sidebar").on("activate", function(){
$(".usermenu li a i").removeClass("icon-white");
$(".usermenu li.active a i").addClass("icon-white")
});
//fancy scrolling animation
$('.usermenu li a').on('click', function(e) {
// prevent default anchor click behavior
e.preventDefault();
// store hash
var hash = this.hash;
// animate
$('html, body').animate({
scrollTop: $(this.hash).offset().top
}, 500, function(){
// when done, add hash to url
// (default click behaviour)
window.location.hash = hash;
});
});
//see https://github.com/twitter/bootstrap/issues/6350
$('[data-clampedwidth]').each(function () {
var elem = $(this);
var parentPanel = elem.data('clampedwidth');
var resizeFn = function () {
var sideBarNavWidth = $(parentPanel).width() - parseInt(elem.css('paddingLeft')) - parseInt(elem.css('paddingRight')) - parseInt(elem.css('marginLeft')) - parseInt(elem.css('marginRight')) - parseInt(elem.css('borderLeftWidth')) - parseInt(elem.css('borderRightWidth'));
elem.css('width', sideBarNavWidth);
};
resizeFn();
$(window).resize(resizeFn);
});
});