[ticket/11552] Do not hide all links at once

Do not hide some links as long as their is enough space
to keep them out of dropdown menu

PHPBB3-11552
This commit is contained in:
Vjacheslav Trushkin 2013-10-19 22:19:32 +03:00
parent e9481c41f8
commit 7b972204ae
3 changed files with 28 additions and 5 deletions

View file

@ -438,7 +438,7 @@ function insert_single_user(formId, user)
delete test; delete test;
if (oldBrowser) { if (oldBrowser) {
// Fix .linkslist.bulletin lists // Fix .linklist.bulletin lists
$('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin'); $('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
// Do not run functions below for old browsers // Do not run functions below for old browsers
@ -604,7 +604,10 @@ function insert_single_user(formId, user)
var $this = $(this), var $this = $(this),
$body = $('body'), $body = $('body'),
links = $this.children().not('.skip-responsive'), links = $this.children().not('.skip-responsive'),
html = '<li class="responsive-menu" style="display:none;"><a href="javascript:void(0);" class="responsive-menu-link">&nbsp;</a><ul class="responsive-popup" style="display:none;" /></li>'; html = '<li class="responsive-menu" style="display:none;"><a href="javascript:void(0);" class="responsive-menu-link">&nbsp;</a><ul class="responsive-popup" style="display:none;" /></li>',
// List of items that should be hidden last
filterString = '.pagination, .icon-notifications, .icon-pm, .icon-logout, .icon-login, .mark-read',
filtered = links.filter(filterString);
if (links.is('.rightside')) if (links.is('.rightside'))
{ {
@ -690,10 +693,30 @@ function insert_single_user(formId, user)
menu.find('.inputbox').parents('li:first').css('white-space', 'normal'); menu.find('.inputbox').parents('li:first').css('white-space', 'normal');
copied = true; copied = true;
} }
else {
menu.children().css('display', '');
}
links.css('display', 'none');
toggle.css('display', ''); toggle.css('display', '');
$this.addClass('responsive'); $this.addClass('responsive');
// Try to not hide filtered items
if (filtered.length) {
links.not(filterString).css('display', 'none');
maxHeight = 0;
filtered.each(function() {
if (!$(this).height()) return;
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
});
if ($this.height() <= maxHeight) {
menu.children().filter(filterString).css('display', 'none');
return;
}
}
links.css('display', 'none');
} }
toggleLink.click(function() { toggleLink.click(function() {

View file

@ -15,7 +15,7 @@
<!-- ENDIF --> <!-- ENDIF -->
<li><a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li> <li><a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF --> <!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside mark-read"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
</ul> </ul>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -28,7 +28,7 @@
<!-- IF S_HAS_SUBFORUM --> <!-- IF S_HAS_SUBFORUM -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --> <!-- IF not S_IS_BOT and U_MARK_FORUMS -->
<ul class="linklist"> <ul class="linklist">
<li class="rightside"><a href="{U_MARK_FORUMS}" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_SUBFORUMS_READ}</a></li> <li class="rightside mark-read"><a href="{U_MARK_FORUMS}" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_SUBFORUMS_READ}</a></li>
</ul> </ul>
<!-- ENDIF --> <!-- ENDIF -->
<!-- INCLUDE forumlist_body.html --> <!-- INCLUDE forumlist_body.html -->