aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/public/publicpage.js
blob: b17eac181b1cde4998cfef7e69dc5e6f292bf663 (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
/**
 * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

window.addEventListener('DOMContentLoaded', function () {

	$('#body-public').find('.header-end .menutoggle').click(function() {
		$(this).next('.popovermenu').toggleClass('open');
	});

	$('#save-external-share').click(function () {
		$('#external-share-menu-item').toggleClass('hidden')
		$('#remote_address').focus();
	});

	$(document).mouseup(function(e) {
		var toggle = $('#body-public').find('.header-end .menutoggle');
		var container = toggle.next('.popovermenu');

		// if the target of the click isn't the menu toggle, nor a descendant of the
		// menu toggle, nor the container nor a descendant of the container
		if (!toggle.is(e.target) && toggle.has(e.target).length === 0 &&
			!container.is(e.target) && container.has(e.target).length === 0) {
			container.removeClass('open');
		}
	});

});