Improve sort detection

Before, we relied on the startup data object to detect whether the sort
options were compatible with this feature or not, which gave a wrong
veredict if those options were changed without reloading the page.

This change detects those options much more reliably, as it now parses
the last ViewForum request body to search for those settings.

Bug: twpowertools:5, twpowertools:22
Change-Id: Ic00200f51b611197c0158f9497597af47bee9581
diff --git a/src/contentScripts/communityConsole/start.js b/src/contentScripts/communityConsole/start.js
index 782569f..93ee6ab 100644
--- a/src/contentScripts/communityConsole/start.js
+++ b/src/contentScripts/communityConsole/start.js
@@ -1,5 +1,7 @@
 import {injectScript, injectStylesheet} from '../../common/contentScriptsUtils.js';
 
+import AutoRefresh from './autoRefresh.js';
+
 const SMEI_UNIFIED_PROFILES = 9;
 
 chrome.storage.sync.get(null, function(items) {
@@ -21,6 +23,11 @@
         'data-startup', JSON.stringify(startup));
   }
 
+  // Initialized here instead of in main.js so the first |ViewForumResponse|
+  // event is received if it happens when the page loads.
+  if (items.autorefreshlist)
+    window.autoRefresh = new AutoRefresh();
+
   if (items.ccdarktheme) {
     switch (items.ccdarktheme_mode) {
       case 'switch':