Fix features in thread lists

Due to an update in the HTML structure of thread lists, many features
stopped working properly. This CL fixes these issues.

In the case of the "reduce whitespace" option, the thread list styles
applied in small screens have been temporarily removed since they have
to be fixed still.

Bug: twpowertools:138
Change-Id: Icf6d74f8a579fedb6af65f44864bd6f744098f2a
diff --git a/src/contentScripts/communityConsole/avatars.js b/src/contentScripts/communityConsole/avatars.js
index 9c555b9..67c8b6d 100644
--- a/src/contentScripts/communityConsole/avatars.js
+++ b/src/contentScripts/communityConsole/avatars.js
@@ -323,15 +323,22 @@
 
   // Inject avatars for thread summary (thread item) |node| in a thread list.
   inject(node) {
-    var header = node.querySelector(
-        'ec-thread-summary .main-header .panel-description a.header');
-    if (header === null) {
+    var header =
+        node.querySelector('ec-thread-summary .main-header .action .header');
+    var headerContent = header.querySelector(':scope > .header-content');
+    var expandBtn = header.querySelector(':scope > .expand-button');
+    if (headerContent === null) {
       console.error(
           '[threadListAvatars] Header is not present in the thread item\'s DOM.');
       return;
     }
+    if (expandBtn === null) {
+      console.error(
+          '[threadListAvatars] Expand button is not present in the thread item\'s DOM.');
+      return;
+    }
 
-    var thread = parseUrl(header.href);
+    var thread = parseUrl(headerContent.href);
     if (thread === false) {
       console.error('[threadListAvatars] Thread\'s link cannot be parsed.');
       return;
@@ -360,7 +367,7 @@
             }
           }
 
-          header.appendChild(avatarsContainer);
+          header.insertBefore(avatarsContainer, expandBtn);
 
           if (res.state == 'private') {
             var label = chrome.i18n.getMessage(