From 11777120f595b344efc4aa3652853891883c4850 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 28 Jun 2016 14:16:57 +0200 Subject: [PATCH] Using less weird markup for language chooser --- .../files/js/WoltLab/WCF/Language/Chooser.js | 38 +++++++------------ wcfsetup/install/files/style/ui/dropdown.scss | 5 +++ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js b/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js index 5f6198ba83..f31932cac4 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js @@ -108,9 +108,9 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S }).bind(this); // add language dropdown items - var a, div, h3, img, listItem; + var link, img, listItem, span; for (var availableLanguageId in languages) { - if (objOwns(languages, availableLanguageId)) { + if (languages.hasOwnProperty(availableLanguageId)) { var language = languages[availableLanguageId]; listItem = elCreate('li'); @@ -120,26 +120,19 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S if (language.languageCode !== undefined) elData(listItem, 'language-code', language.languageCode); dropdownMenu.appendChild(listItem); - a = elCreate('a'); - a.className = 'box24'; - listItem.appendChild(a); - - div = elCreate('div'); - //div.className = 'framed'; - a.appendChild(div); + link = elCreate('a'); + link.className = 'box24'; + listItem.appendChild(link); img = elCreate('img'); elAttr(img, 'src', language.iconPath); elAttr(img, 'alt', ''); img.className = 'iconFlag'; - div.appendChild(img); - - div = elCreate('div'); - a.appendChild(div); + link.appendChild(img); - h3 = elCreate('h3'); - h3.textContent = language.languageName; - div.appendChild(h3); + span = elCreate('span'); + span.textContent = language.languageName; + link.appendChild(span); if (availableLanguageId == languageId) { dropdownToggle.innerHTML = listItem.firstChild.innerHTML; @@ -171,19 +164,16 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S else if (languageId === 0) { dropdownToggle.innerHTML = null; - div = elCreate('div'); + var div = elCreate('div'); dropdownToggle.appendChild(div); - var span = elCreate('span'); + span = elCreate('span'); span.className = 'icon icon24 fa-question'; div.appendChild(span); - div = elCreate('div'); - dropdownToggle.appendChild(div); - - h3 = elCreate('h3'); - h3.textContent = Language.get('wcf.global.language.noSelection'); - div.appendChild(h3); + span = elCreate('span'); + span.textContent = Language.get('wcf.global.language.noSelection'); + div.appendChild(span); } UiSimpleDropdown.init(dropdownToggle); diff --git a/wcfsetup/install/files/style/ui/dropdown.scss b/wcfsetup/install/files/style/ui/dropdown.scss index 4e71dc5723..8a46f58d45 100644 --- a/wcfsetup/install/files/style/ui/dropdown.scss +++ b/wcfsetup/install/files/style/ui/dropdown.scss @@ -300,9 +300,14 @@ } .boxFlag > .box24, .boxFlag.box24 { + align-items: center; display: flex !important; min-height: 20px; + > img:first-child { + height: 100%; + } + &.dropdownToggle { display: inline-flex !important; } -- 2.20.1