| 1 |
// $Id: xbview.js,v 1.1.2.2 2007/05/02 22:07:18 profix898 Exp $
|
| 2 |
|
| 3 |
Drupal.behaviors.xbview = function (context) {
|
| 4 |
$('a.xb-folder', context).each(function() {
|
| 5 |
$(this).bind('click', function() {
|
| 6 |
Drupal.xbviewFolder($(this).attr('id').substr(3));
|
| 7 |
return false;
|
| 8 |
});
|
| 9 |
});
|
| 10 |
};
|
| 11 |
|
| 12 |
Drupal.xbviewFolder = function(id) {
|
| 13 |
folder = $('#folder-'+id);
|
| 14 |
if (folder.html() == '') {
|
| 15 |
$('body').css('cursor', 'wait');
|
| 16 |
$.ajax({
|
| 17 |
url: Drupal.settings.xbview.callback+id,
|
| 18 |
error: function(http){
|
| 19 |
alert(Drupal.t('HTTP Request Failure (@status)', { '@status': http.status }));
|
| 20 |
},
|
| 21 |
success: function(data){
|
| 22 |
folder.hide().html(data).slideDown('normal');
|
| 23 |
Drupal.attachBehaviors('#folder-'+id);
|
| 24 |
},
|
| 25 |
complete: function(data){
|
| 26 |
$('body').css('cursor', 'default');
|
| 27 |
}
|
| 28 |
});
|
| 29 |
} else {
|
| 30 |
folder.slideUp('normal', function(){ $(this).empty(); });
|
| 31 |
}
|
| 32 |
};
|