1
|
|
2
|
|
3
|
(Drupal.cdm_annotationsAutoAttach = (function($){
|
4
|
|
5
|
$('span.annotation_toggle').click( function(){
|
6
|
|
7
|
var spanElement = $(this);
|
8
|
var annotation_box = $(this).parent().find('.annotation_box');;
|
9
|
|
10
|
|
11
|
function getAnnotations (){
|
12
|
var url = spanElement.attr('rel');
|
13
|
|
14
|
if(url != undefined){
|
15
|
$.get(url, displayAnnotations);
|
16
|
}
|
17
|
}
|
18
|
|
19
|
function displayAnnotations(html){
|
20
|
annotation_box.empty().append(html);
|
21
|
var form = annotation_box.find('.annotation_create').find('form');
|
22
|
|
23
|
form.submit(function(){
|
24
|
|
25
|
var options = {'success' : getAnnotations};
|
26
|
|
27
|
$(this).ajaxSubmit(options);
|
28
|
//alert ($(this).formSerialize());
|
29
|
return false;
|
30
|
});
|
31
|
//.slideToggle("fast");
|
32
|
annotation_box.show();
|
33
|
}
|
34
|
|
35
|
getAnnotations();
|
36
|
|
37
|
});
|
38
|
|
39
|
}))(jQuery)
|
40
|
|
41
|
|
42
|
|
43
|
jQuery(document).ready(Drupal.cdm_annotationsAutoAttach);
|