mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11956] Move code that hides dropdowns to assets
PHPBB3-11956
This commit is contained in:
parent
368b3f0d9e
commit
c521380273
2 changed files with 19 additions and 10 deletions
|
@ -829,6 +829,16 @@ phpbb.applyCodeEditor = function(textarea) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of classes that toggle dropdown menu,
|
||||||
|
* list of classes that contain visible dropdown menu
|
||||||
|
*
|
||||||
|
* Add your own classes to strings with comma (probably you
|
||||||
|
* will never need to do that)
|
||||||
|
*/
|
||||||
|
phpbb.dropdownHandles = '.dropdown-container.dropdown-visible .dropdown-toggle';
|
||||||
|
phpbb.dropdownVisibleContainers = '.dropdown-container.dropdown-visible';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dropdown toggle event handler
|
* Dropdown toggle event handler
|
||||||
* This handler is used by phpBB.registerDropdown() and other functions
|
* This handler is used by phpBB.registerDropdown() and other functions
|
||||||
|
@ -841,7 +851,7 @@ phpbb.toggleDropdown = function() {
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
// Hide other dropdown menus
|
// Hide other dropdown menus
|
||||||
$('.dropdown-container.dropdown-visible .dropdown-toggle').each(phpbb.toggleDropdown);
|
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
|
||||||
|
|
||||||
// Figure out direction of dropdown
|
// Figure out direction of dropdown
|
||||||
var direction = options.direction,
|
var direction = options.direction,
|
||||||
|
@ -952,6 +962,14 @@ $(document).ready(function() {
|
||||||
$('textarea[data-bbcode]').each(function() {
|
$('textarea[data-bbcode]').each(function() {
|
||||||
phpbb.applyCodeEditor(this);
|
phpbb.applyCodeEditor(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide active dropdowns when click event happens outside
|
||||||
|
$('body').click(function(e) {
|
||||||
|
var parents = $(e.target).parents();
|
||||||
|
if (!parents.is(phpbb.dropdownVisibleContainers)) {
|
||||||
|
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery); // Avoid conflicts with other libraries
|
})(jQuery); // Avoid conflicts with other libraries
|
||||||
|
|
|
@ -939,15 +939,6 @@ function parse_document(container)
|
||||||
$('#' + this.getAttribute('data-focus')).focus();
|
$('#' + this.getAttribute('data-focus')).focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide active dropdowns when click event happens outside
|
|
||||||
$('#phpbb').click(function(e) {
|
|
||||||
|
|
||||||
var parents = $(e.target).parents();
|
|
||||||
if (!parents.is('.dropdown-container.dropdown-visible')) {
|
|
||||||
$('.dropdown-container.dropdown-visible .dropdown-toggle').each(phpbb.toggleDropdown);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
parse_document($('body'));
|
parse_document($('body'));
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
Loading…
Add table
Reference in a new issue