publicpage.js 944 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. window.addEventListener('DOMContentLoaded', function () {
  6. $('#body-public').find('.header-right .menutoggle').click(function() {
  7. $(this).next('.popovermenu').toggleClass('open');
  8. });
  9. $('#save-external-share').click(function () {
  10. $('#external-share-menu-item').toggleClass('hidden')
  11. $('#remote_address').focus();
  12. });
  13. $(document).mouseup(function(e) {
  14. var toggle = $('#body-public').find('.header-right .menutoggle');
  15. var container = toggle.next('.popovermenu');
  16. // if the target of the click isn't the menu toggle, nor a descendant of the
  17. // menu toggle, nor the container nor a descendant of the container
  18. if (!toggle.is(e.target) && toggle.has(e.target).length === 0 &&
  19. !container.is(e.target) && container.has(e.target).length === 0) {
  20. container.removeClass('open');
  21. }
  22. });
  23. });