Refactor extension to webpack

This change is the biggest in the history of the project. The entire
project has been refactored so it is built with webpack.

This involves:
- Creating webpack and npm config files.
- Fixing some bugs in the code due to the fact that webpack uses strict
mode.
- Merging some pieces of code which were shared throughout the codebase
(not exhaustive, more work should be done in this direction).
- Splitting the console_inject.js file into separate files (it had 1000+
lines).
- Adapting all the build-related files (Makefile, bash scripts, etc.)
- Changing the docs to explain the new build process.
- Changing the Zuul playbook/roles to adapt to the new build process.

Change-Id: I16476d47825461c3a318b3f1a1eddb06b2df2e89
diff --git a/src/contentScripts/communityConsole/start.js b/src/contentScripts/communityConsole/start.js
new file mode 100644
index 0000000..318e466
--- /dev/null
+++ b/src/contentScripts/communityConsole/start.js
@@ -0,0 +1,45 @@
+import {injectStylesheet} from '../../common/contentScriptsUtils.js';
+
+const SMEI_SORT_DIRECTION = 8;
+const SMEI_UNIFIED_PROFILES = 9;
+
+chrome.storage.sync.get(null, function(items) {
+  /* IMPORTANT NOTE: Remember to change this when changing the "ifs" below!! */
+  if (items.loaddrafts || items.smei_sortdirection ||
+      items.disableunifiedprofiles) {
+    var startup =
+        JSON.parse(document.querySelector('html').getAttribute('data-startup'));
+
+    if (items.loaddrafts) {
+      startup[4][13] = true;
+    }
+
+    if (items.smei_sortdirection) {
+      if (!startup[1][6].includes(SMEI_SORT_DIRECTION))
+        startup[1][6].push(SMEI_SORT_DIRECTION);
+    }
+
+    if (items.disableunifiedprofiles) {
+      var index = startup[1][6].indexOf(SMEI_UNIFIED_PROFILES);
+      if (index > -1) startup[1][6].splice(index, 1);
+    }
+
+    document.querySelector('html').setAttribute(
+        'data-startup', JSON.stringify(startup));
+  }
+
+  if (items.ccdarktheme) {
+    switch (items.ccdarktheme_mode) {
+      case 'switch':
+        if (items.ccdarktheme_switch_status == true)
+          injectStylesheet(chrome.runtime.getURL('css/ccdarktheme.css'));
+        break;
+
+      case 'system':
+        injectStylesheet(chrome.runtime.getURL('css/ccdarktheme.css'), {
+          'media': '(prefers-color-scheme: dark)',
+        });
+        break;
+    }
+  }
+});