1
|
// $Id$
|
2
|
|
3
|
|
4
|
|
5
|
(function($){
|
6
|
/**
|
7
|
*
|
8
|
*/
|
9
|
$.fn.cdm_taxontree = function() {
|
10
|
|
11
|
return this.each(function() {
|
12
|
|
13
|
$(this).children('li').not('.invisible').click(function(event) {
|
14
|
event.stopPropagation();
|
15
|
if($(this).hasClass('collapsed')){
|
16
|
var bindChildren = ($(this).find('ul').length == 0);
|
17
|
if(bindChildren){
|
18
|
var url = $(this).attr('title');
|
19
|
if(url != undefined){
|
20
|
$(this).removeAttr('title');
|
21
|
var parent_li = $(this);
|
22
|
var bg_image_tmp = parent_li.css('background-image');
|
23
|
var bg_image_loading = bg_image_tmp.replace(/^(.*)(\/.*)(\))$/, '$1/loading_subtree.gif$3')
|
24
|
parent_li.css('background-image', bg_image_loading);
|
25
|
$.get(url, function(html){
|
26
|
parent_li.css('background-image', bg_image_tmp);
|
27
|
parent_li.append(html).find('ul').cdm_taxontree();
|
28
|
});
|
29
|
}
|
30
|
}
|
31
|
$(this).removeClass('collapsed').addClass('expanded').children('ul').css('display', 'block');
|
32
|
} else if($(this).hasClass('expanded')){
|
33
|
$(this).removeClass('expanded').addClass('collapsed').children('ul').css('display', 'none');
|
34
|
}
|
35
|
}); // END click()
|
36
|
|
37
|
$(this).children('li').children('a').click(function(event) {
|
38
|
event.stopPropagation();
|
39
|
});
|
40
|
});
|
41
|
}; // END cdm_taxontree()
|
42
|
|
43
|
})(jQuery);
|
44
|
|
45
|
if (Drupal.jsEnabled) {
|
46
|
$(document).ready(function() {
|
47
|
|
48
|
$('ul.cdm_taxontree').cdm_taxontree();
|
49
|
|
50
|
$('div.cdm_taxontree_container').hover(
|
51
|
|
52
|
function() {
|
53
|
var container = $(this);
|
54
|
var container_w = parseFloat(container.width())
|
55
|
+ parseFloat(container.css('padding-left'))
|
56
|
+ parseFloat(container.css('padding-right'))
|
57
|
+ parseFloat(container.css('border-left-width'))
|
58
|
+ parseFloat(container.css('border-right-width'))
|
59
|
+ parseFloat(container.css('margin-left'))
|
60
|
+ parseFloat(container.css('margin-right'));
|
61
|
|
62
|
var h = parseFloat($(this).parent('.cdm_taxontree_scroller_x').height());
|
63
|
var scroll_y = $(this).parent('.cdm_taxontree_scroller_x').scrollTop();
|
64
|
$(this).parent('.cdm_taxontree_scroller_x').find('.cdm_taxontree_scroller_y').css('overflow-y', 'auto').css('border-bottom-style', 'solid').scrollTop(scroll_y).end().width(Math.ceil(container_w)).css('overflow-y', 'visible').height(h);
|
65
|
},
|
66
|
|
67
|
function() {
|
68
|
var scroll_y = $(this).parent('.cdm_taxontree_scroller_x').find('.cdm_taxontree_scroller_y').scrollTop();
|
69
|
$(this).parent('.cdm_taxontree_scroller_x').find('.cdm_taxontree_scroller_y').css('overflow-y', 'visible').css('border-bottom-style', 'none').end().css('overflow-y', 'auto').width('auto').scrollTop(scroll_y);
|
70
|
}
|
71
|
);
|
72
|
|
73
|
});
|
74
|
|
75
|
}
|