diff options
author | Cesar G <prototech91@gmail.com> | 2014-05-29 18:07:27 -0700 |
---|---|---|
committer | Cesar G <prototech91@gmail.com> | 2014-06-14 09:54:16 -0700 |
commit | edd9c0e06405a08efb1e2153b21f71beb1ea4294 (patch) | |
tree | 0d2e231a526a0b83b7b0184fdc79da9a1580f29d /phpBB/assets/javascript | |
parent | def39a670b65a8075ed46afa4956d1d61193a408 (diff) | |
download | forums-edd9c0e06405a08efb1e2153b21f71beb1ea4294.tar forums-edd9c0e06405a08efb1e2153b21f71beb1ea4294.tar.gz forums-edd9c0e06405a08efb1e2153b21f71beb1ea4294.tar.bz2 forums-edd9c0e06405a08efb1e2153b21f71beb1ea4294.tar.xz forums-edd9c0e06405a08efb1e2153b21f71beb1ea4294.zip |
[ticket/12553] Open the notification dropdown to the left.
PHPBB3-12553
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r-- | phpBB/assets/javascript/core.js | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 37728864c4..d6f241183f 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -873,19 +873,6 @@ phpbb.timezonePreselectSelect = function(forceSelector) { } }; -// Toggle notification list -$('#notification_list_button').click(function(e) { - $('#notification_list').toggle(); - e.preventDefault(); -}); -$('#phpbb').click(function(e) { - var target = $(e.target); - - if (!target.is('#notification_list, #notification_list_button') && !target.parents().is('#notification_list, #notification_list_button')) { - $('#notification_list').hide(); - } -}); - phpbb.ajaxCallbacks = {}; /** @@ -1515,11 +1502,37 @@ phpbb.getFunctionByName = function (functionName) { }; /** -* Apply code editor to all textarea elements with data-bbcode attribute +* Register page dropdowns. */ -$(document).ready(function() { - $('textarea[data-bbcode]').each(function() { - phpbb.applyCodeEditor(this); +phpbb.registerPageDropdowns = function() { + $('body').find('.dropdown-container').each(function() { + var $this = $(this), + trigger = $this.find('.dropdown-trigger:first'), + contents = $this.find('.dropdown'), + options = { + direction: 'auto', + verticalDirection: 'auto' + }, + data; + + if (!trigger.length) { + data = $this.attr('data-dropdown-trigger'); + trigger = data ? $this.children(data) : $this.children('a:first'); + } + + if (!contents.length) { + data = $this.attr('data-dropdown-contents'); + contents = data ? $this.children(data) : $this.children('div:first'); + } + + if (!trigger.length || !contents.length) return; + + if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up'; + if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down'; + if ($this.hasClass('dropdown-left')) options.direction = 'left'; + if ($this.hasClass('dropdown-right')) options.direction = 'right'; + + phpbb.registerDropdown(trigger, contents, options); }); // Hide active dropdowns when click event happens outside @@ -1529,6 +1542,17 @@ $(document).ready(function() { $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); } }); +} + +/** +* Apply code editor to all textarea elements with data-bbcode attribute +*/ +$(document).ready(function() { + $('textarea[data-bbcode]').each(function() { + phpbb.applyCodeEditor(this); + }); + + phpbb.registerPageDropdowns(); $('#color_palette_placeholder').each(function() { phpbb.registerPalette($(this)); |