aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/walled_garden.php
blob: 46c2934ffd4813aeceafb992e3e23264707d7fb5 (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
<?php
/**
 * Walled garden JavaScript
 *
 * @todo update for new JS lib
 */

$cancel_button = elgg_view('input/button', array(
	'value' => elgg_echo('cancel'),
	'class' => 'elgg-button-cancel mlm',
));
$cancel_button = trim($cancel_button);

?>

$(document).ready(function() {

	// add cancel button to inline forms
	$(".elgg-walledgarden-password").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
	$('.elgg-walledgarden-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');

	$(".forgot_link").click(function(event) {
		event.preventDefault();
		$(".elgg-walledgarden-password").fadeToggle();
	});

	$(".registration_link").click(function(event) {
		event.preventDefault();
		$(".elgg-walledgarden-register").fadeToggle();
	});

	$('input.elgg-button-cancel').click(function(event) {
		if ($(".elgg-walledgarden-password").is(':visible')) {
			$(".forgot_link").click();
		} else if ($('.elgg-walledgarden-register').is(':visible')) {
			$(".registration_link").click();
		}
		event.preventDefault();
	});
});