if (this._searchArea.hasClass('dropdown')) {
var $containerID = this._searchArea.wcfIdentify();
+ var $dropdownMenu = WCF.Dropdown.getDropdownMenu($containerID);
var $form = this._searchArea.find('form');
if ($form.length === 0) $form = this._searchArea.parent();
$form.submit(function() {
// copy checkboxes and hidden fields into form
- var $dropdownMenu = WCF.Dropdown.getDropdownMenu($containerID);
-
$dropdownMenu.find('input[type=hidden]').appendTo($form);
$dropdownMenu.find('input[type=checkbox]:checked').each(function(index, input) {
var $input = $(input);
$('<input type="hidden" name="' + $input.attr('name') + '" value="' + $input.attr('value') + '" />').appendTo($form);
});
});
+
+ var $enableFlexWidth = true;
+ require(['Ui/Screen'], function(UiScreen) {
+ UiScreen.on({
+ match: function() { $enableFlexWidth = false; },
+ unmatch: function() { $enableFlexWidth = true; },
+ setup: function() { $enableFlexWidth = false; }
+ })
+ });
+
+ $dropdownMenu.addClass('pageHeaderSearchDropdown');
+ WCF.Dropdown.registerCallback($containerID, (function(containerID, action) {
+ if ($enableFlexWidth && action === 'open' && elById('pageHeader').classList.contains('sticky')) {
+ var width = elById('pageHeaderSearch').clientWidth + elById('topMenu').clientWidth;
+ if (width < 200) width = 200;
+
+ this._searchArea.css('width', width + 'px');
+ $dropdownMenu.css('width', width + 'px');
+ }
+ else {
+ this._searchArea.css('width', '');
+ $dropdownMenu.css('width', '');
+ }
+ }).bind(this));
+
+ $(window).scroll((function () {
+ this._searchArea.css('width', '');
+ }).bind(this));
}
},
_initElement: function(chooserId, element, languageId, languages, callback, allowEmptyValue) {
var container = element.parentNode;
container.classList.add('dropdown');
- var dropdownToggle = elCreate('div');
+ var dropdownToggle = elCreate('a');
dropdownToggle.className = 'dropdownToggle boxFlag box24 inputPrefix';
container.insertBefore(dropdownToggle, element);
}
@include large-screen-only {
- .pageHeader:not(.sticky) .mainMenu {
- background-color: $wcfHeaderMenuBackground;
- position: relative;
-
- /* The `box-shadow` and the `::before` are used to create a full-width
- color stripe that matches the height of the main menu. This trick is
- used to allows us to have all elements in the header share a common
- ancestor in order to easily move elements with flexbox' `order` property.
-
- The `box-shadow` is a neat hack because an `::after` element would
- increase the page width unless we set `overflow: hidden` to the entire
- page header which is bad for multiple reasons. */
- box-shadow: 900px 0 0 0 $wcfHeaderMenuBackground;
-
- &::before {
+ .pageHeader:not(.sticky) {
+ .mainMenu {
background-color: $wcfHeaderMenuBackground;
- bottom: 0;
- content: "";
- left: -100%;
- position: absolute;
- top: 0;
- width: 100%;
+ position: relative;
+
+ /* The `box-shadow` and the `::before` are used to create a full-width
+ color stripe that matches the height of the main menu. This trick is
+ used to allows us to have all elements in the header share a common
+ ancestor in order to easily move elements with flexbox' `order` property.
+
+ The `box-shadow` is a neat hack because an `::after` element would
+ increase the page width unless we set `overflow: hidden` to the entire
+ page header which is bad for multiple reasons. */
+ box-shadow: 900px 0 0 0 $wcfHeaderMenuBackground;
+
+ &::before {
+ background-color: $wcfHeaderMenuBackground;
+ bottom: 0;
+ content: "";
+ left: -100%;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ }
+ }
+
+ .pageHeaderSearchInputContainer .pageHeaderSearchInput {
+ padding-bottom: 10px;
+ padding-top: 10px;
+ width: 200px;
}
}
}
}
.pageHeaderSearch {
- flex: 0 0 auto;
+ align-self: stretch;
+ flex: 0 0 50px;
margin-bottom: 0;
margin-left: 10px;
order: 3;
}
&:not(.searchBarOpen) {
- .pageHeaderSearch {
- font-size: 0;
- width: 50px;
- }
-
.pageHeaderSearchInput,
.pageHeaderSearchInputButton {
display: none;
&.searchBarOpen {
.pageHeaderSearchInputContainer {
- bottom: 0;
- left: 0;
+ height: 100%;
position: absolute;
- right: 0;
- top: 0;
+ top: 100%;
+ transform: translateX(-50px);
z-index: 100;
}
.pageHeaderSearchLabel {
- position: static;
- visibility: hidden;
+ background-color: $wcfHeaderSearchBoxBackgroundActive;
width: 50px;
}
}
}
.boxFlag > .box24, .boxFlag.box24 {
+ display: flex !important;
min-height: 20px;
}
+@include large-screen-only {
+ .dropdownMenu.pageHeaderSearchDropdown {
+ transform: translateY(-10px);
+ }
+}
+
@include small-screen-only {
.dropdownMenu {
left: 0 !important;