Project

General

Profile

Download (848 Bytes) Statistics
| Branch: | Tag: | Revision:
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
			annotation_box.show();//.slideToggle("fast");
32
		}
33
		
34
		getAnnotations();
35
		
36
	});
37
		
38
}
39

    
40

    
41
if (Drupal.jsEnabled) {
42
  $(document).ready(Drupal.cdm_annotationsAutoAttach);
43
}
(3-3/11)