1 <!-- start html templates -->
2 <script id=
"details-menu-up-glyph" type=
"text/x-generic-html-template">
3 <span class=
"glyphicon glyphicon-menu-up" style=
"margin-left: 5px;"
4 aria-hidden=
"true"></span>
6 <script id=
"details-menu-down-glyph" type=
"text/x-generic-html-template">
7 <span class=
"glyphicon glyphicon-menu-down" style=
"margin-left: 5px;"
8 aria-hidden=
"true"></span>
10 <!-- end html templates -->
13 $(window).ready(function() {
14 $('.collapse').removeClass('in');
15 $('.program-session-room-details button').show();
20 .on('show.bs.collapse', function() {
21 var id = $(this).attr('id');
22 // find corresponding
"Details"/
"Collapse details" button.
23 var btn = $('[
data-target=
"#'+ id + '"]');
24 var glyph = $('#details-menu-up-glyph').text();
25 $(btn).text('Collapse details');
26 $(glyph).appendTo(btn);
30 .on('hide.bs.collapse', function() {
31 var id = $(this).attr('id');
32 // find corresponding
"Details"/
"Collapse details" button.
33 var btn = $('[
data-target=
"#'+ id + '"]');
34 var glyph = $('#details-menu-down-glyph').text();
35 $(btn).text('Show details');
36 $(glyph).appendTo(btn);
40 $(window).resize(function() {
44 $(window).scroll(function() {
45 position_toggle_all();
48 function init_toggle_all(reinit=false) {
49 var block = '.program-session-details-toggle-all';
52 toggle_all_click_init();
55 window.toggle_all_pos = $(block).offset();
56 position_toggle_all();
60 function reinit_toggle_all() {
61 // make position static to know the real position of toggle all.
63 init_toggle_all(true);
66 function toggle_all_fixed() {
67 $('.program-session-details-toggle-all button').addClass('fixed');
70 function toggle_all_static() {
71 $('.program-session-details-toggle-all button').removeClass('fixed');
74 function position_toggle_all() {
75 var toggle_all_btn = '.program-session-details-toggle-all button';
76 var t_pos = window.toggle_all_pos;
77 var w_top = $(window).scrollTop();
86 function toggle_all_click_init() {
87 var toggle_all_btn = '.program-session-details-toggle-all button';
88 var details_btn = '.program-session-room-details button';
90 // initially everything is collapsed.
96 $(toggle_all_btn).click(function() {
98 if (window.toggle_all.collapsed) {
99 $('.collapse').collapse('show');
100 window.toggle_all.collapsed = false;
102 $('.collapse').collapse('hide');
103 window.toggle_all.collapsed = true;
106 // set toggle all clicked.
107 window.toggle_all.clicked = true;
110 $('.collapse').on('shown.bs.collapse', function() {
111 update_toggle_all_text('Collapse all');
114 $('.collapse').on('hidden.bs.collapse', function() {
115 update_toggle_all_text('Expand all');
119 function update_toggle_all_text(txt) {
120 var toggle_all_btn = '.program-session-details-toggle-all button';
122 // update text only when toggle all is clicked.
123 if (window.toggle_all.clicked)
124 $(toggle_all_btn).text(txt);
126 // reset toggle clicked
127 window.toggle_all.clicked = false;
131 <script type=
"text/javascript">
132 $(
".program-link").addClass(
"active");