aboutsummaryrefslogtreecommitdiff
path: root/mod/developers/views/default/js/developers/developers.php
blob: 6e82295aad6a16b185dc31c7551864b549580786 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
 * Elgg developers tool JavaScript
 */
?>

elgg.provide('elgg.dev');

elgg.dev.init = function() {
	$('.developers-form-inspect').live('submit', elgg.dev.inspectSubmit);
};

/**
 * Submit the inspect form through Ajax
 *
 * Requires the jQuery Form Plugin.
 *
 * @param {Object} event
 */
elgg.dev.inspectSubmit = function(event) {

	$("#developers-inspect-results").hide();
	$("#developers-ajax-loader").show();
	
	$(this).ajaxSubmit({
		dataType : 'json',
		success  : function(response) {
			if (response) {
				$("#developers-inspect-results").html(response.output);
				$("#developers-inspect-results").jstree({
					"plugins" : [ "themes", "html_data" ],
					"themes" : {"icons" : false}
				}).bind("loaded.jstree", function() {
					$("#developers-inspect-results").fadeIn();
					$("#developers-ajax-loader").hide();
				});
			}
		}
	});

	event.preventDefault();
};

elgg.register_hook_handler('init', 'system', elgg.dev.init);