]> git.uio.no Git - usit-rt.git/blob - share/static/js/history-folding.js
Merge branch 'master' of git.uio.no:usit-rt
[usit-rt.git] / share / static / js / history-folding.js
1 function fold_message_stanza(e,showmsg, hidemsg) {
2     var box = jQuery(e).next('.message-stanza');
3     if ( box.hasClass('closed') ) {
4         jQuery([e, box[0]]).removeClass('closed').addClass('open');
5         jQuery(e).text( hidemsg);
6     } else {
7         jQuery([e, box[0]]).addClass('closed').removeClass('open');
8         jQuery(e).text( showmsg);
9     }
10 }
11
12 function toggle_all_folds(e, showmsg, hidemsg) {
13     var link    = jQuery(e);
14     var history = link.closest(".history");
15     var dir     = link.attr('data-direction');
16
17     if (dir == 'open') {
18         history.find(".message-stanza-folder.closed").click();
19         link.attr('data-direction', 'closed').text(hidemsg);
20     }
21     else if (dir == 'closed') {
22         history.find(".message-stanza-folder.open").click();
23         link.attr('data-direction', 'open').text(showmsg);
24     }
25     return false;
26 }