Using less weird markup for language chooser
authorAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jun 2016 12:16:57 +0000 (14:16 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jun 2016 12:17:04 +0000 (14:17 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js
wcfsetup/install/files/style/ui/dropdown.scss

index 5f6198ba83341bed9f1d6163bc4fb980f841925b..f31932cac495eef8636322144f6923b5aac2f78a 100644 (file)
@@ -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);
index 4e71dc5723eed0bff25216018033496aa3771ace..8a46f58d45b0eded59348893b1aa25eae9682c23 100644 (file)
 }
 
 .boxFlag > .box24, .boxFlag.box24 {
+       align-items: center;
        display: flex !important;
        min-height: 20px;
        
+       > img:first-child {
+               height: 100%;
+       }
+       
        &.dropdownToggle {
                display: inline-flex !important;
        }