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/options/optionsCommon.js b/src/options/optionsCommon.js
index abfc306..99874e5 100644
--- a/src/options/optionsCommon.js
+++ b/src/options/optionsCommon.js
@@ -35,6 +35,9 @@
       case 'ccdarktheme_mode':
         return document.getElementById(opt).value || 'switch';
 
+      case 'interopthreadpage_mode':
+        return document.getElementById(opt).value || 'previous';
+
       default:
         console.warn('Unrecognized option: ' + opt);
         return undefined;
@@ -239,6 +242,24 @@
                 .appendChild(select);
             break;
 
+          case 'interopthreadpage_mode':
+            var select = document.createElement('select');
+            select.id = 'interopthreadpage_mode';
+
+            const threadPageModes = ['previous', 'next'];
+            for (const mode of threadPageModes) {
+              let modeOption = document.createElement('option');
+              modeOption.value = mode;
+              modeOption.textContent =
+                  chrome.i18n.getMessage('options_interopthreadpage_mode_' + mode);
+              if (items.interopthreadpage_mode == mode) modeOption.selected = true;
+              select.appendChild(modeOption);
+            }
+
+            document.getElementById('interopthreadpage_mode--container')
+                .appendChild(select);
+            break;
+
           default:
             console.warn('Unrecognized option: ' + opt);
             break;