Add option to choose the thread page design in the CC

This feature allows users to choose whether to show the old thread page
design or the new one.

This CL also adds an experimental feature to activate the nested replies
experiment in the Community Console (only available in the Canary
channel). It has been added as an experimental feature because the
nested replies feature doesn't work yet in the Community Console.

Change-Id: Ifc371848b55f450bedf22d8e35fb4348fffa6c63
diff --git a/src/contentScripts/communityConsole/start.js b/src/contentScripts/communityConsole/start.js
index 250df78..d30a113 100644
--- a/src/contentScripts/communityConsole/start.js
+++ b/src/contentScripts/communityConsole/start.js
@@ -4,9 +4,12 @@
 import AutoRefresh from './autoRefresh.js';
 import ExtraInfo from './extraInfo.js';
 
+const SMEI_NESTED_REPLIES = 15;
+const SMEI_RCE_THREAD_INTEROP = 22;
+
 getOptions(null).then(options => {
   /* IMPORTANT NOTE: Remember to change this when changing the "ifs" below!! */
-  if (options.loaddrafts) {
+  if (options.loaddrafts || options.interopthreadpage) {
     var startup =
         JSON.parse(document.querySelector('html').getAttribute('data-startup'));
 
@@ -14,6 +17,25 @@
       startup[4][13] = true;
     }
 
+    if (options.interopthreadpage) {
+      var index = startup[1][6].indexOf(SMEI_RCE_THREAD_INTEROP);
+
+      switch (options.interopthreadpage_mode) {
+        case 'previous':
+          if (index > -1) startup[1][6].splice(index, 1);
+          break;
+
+        case 'next':
+          if (index == -1) startup[1][6].push(SMEI_RCE_THREAD_INTEROP);
+          break;
+      }
+    }
+
+    if (options.nestedreplies) {
+      if (!startup[1][6].includes(SMEI_NESTED_REPLIES))
+        startup[1][6].push(SMEI_NESTED_REPLIES);
+    }
+
     document.querySelector('html').setAttribute(
         'data-startup', JSON.stringify(startup));
   }