Skip to content

Commit 2e61727

Browse files
authored
Merge pull request #30590 from nextcloud/backport/30571/stable21
[stable21] fix: only use jquery once it is available
2 parents 89504e1 + 97a938f commit 2e61727

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

core/js/public/publicpage.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ window.addEventListener('DOMContentLoaded', function () {
3131
$('#remote_address').focus();
3232
});
3333

34-
});
3534

36-
$(document).mouseup(function(e) {
37-
var toggle = $('#body-public').find('.header-right .menutoggle');
38-
var container = toggle.next('.popovermenu');
35+
$(document).mouseup(function(e) {
36+
var toggle = $('#body-public').find('.header-right .menutoggle');
37+
var container = toggle.next('.popovermenu');
38+
39+
// if the target of the click isn't the menu toggle, nor a descendant of the
40+
// menu toggle, nor the container nor a descendant of the container
41+
if (!toggle.is(e.target) && toggle.has(e.target).length === 0 &&
42+
!container.is(e.target) && container.has(e.target).length === 0) {
43+
container.removeClass('open');
44+
}
45+
});
3946

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

0 commit comments

Comments
 (0)