Add option to force disable SMEI_UNIFIED_PROFILES
Proposed here:
https://groups.google.com/g/twpowertools-discuss/c/QSOXU8IbrYU
Fixes: #47
Change-Id: I05caf5248cec1121ee083362910f81c484bfb3b2
diff --git a/src/_locales/ca/messages.json b/src/_locales/ca/messages.json
index 5b01409..aa91d18 100644
--- a/src/_locales/ca/messages.json
+++ b/src/_locales/ca/messages.json
@@ -103,6 +103,10 @@
"message": "Actualitza les llistes de fils de la Consola de la Comunitat automàticament.",
"description": "Feature checkbox in the options page"
},
+ "options_disableunifiedprofiles": {
+ "message": "Desactiva a la força l'experiment <code class=\"help\" title=\"Aquest experiment, quan està actiu, introdueix un rediseny de la interfície dels perfils que també unifica tots els perfils en un únic.\">SMEI_UNIFIED_PROFILES</code> a la Consola de la Comunitat.",
+ "description": "Link to learn more about the profile indicator feature"
+ },
"options_profileindicator_header": {
"message": "Punt indicador",
"description": "Heading for the profile indicator feature options"
diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index 1e05f3c..09881d9 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -107,6 +107,10 @@
"message": "Autorefresh thread lists in the Community Console.",
"description": "Feature checkbox in the options page"
},
+ "options_disableunifiedprofiles": {
+ "message": "Force disable the <code class=\"help\" title=\"This experiment, when enabled, introduces a redesign of the profile view which also unifies all forum profiles into a single one.\">SMEI_UNIFIED_PROFILES</code> experiment in the Community Console.",
+ "description": "Feature checkbox in the options page"
+ },
"options_profileindicator_header": {
"message": "Indicator dot",
"description": "Heading for the profile indicator feature options"
diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.json
index a591db4..4bea06d 100644
--- a/src/_locales/es/messages.json
+++ b/src/_locales/es/messages.json
@@ -107,6 +107,10 @@
"message": "Actualiza las listas de hilos de la Consola de la Comunidad automáticamente.",
"description": "Feature checkbox in the options page"
},
+ "options_disableunifiedprofiles": {
+ "message": "Desactiva forzosamente el experimento <code class=\"help\" title=\"Este experimento, cuando está activado, introduce un rediseño de la interfaz de los perfiles que también unifica todos los perfiles en cada foro en uno único.\">SMEI_UNIFIED_PROFILES</code> en la Consola de la Comunidad.",
+ "description": "Link to learn more about the profile indicator feature"
+ },
"options_profileindicator_moreinfo": {
"message": "+info sobre las 2 opciones anteriores",
"description": "Link to learn more about the profile indicator feature"
diff --git a/src/common/common.js b/src/common/common.js
index f897837..9212389 100644
--- a/src/common/common.js
+++ b/src/common/common.js
@@ -76,6 +76,10 @@
defaultValue: false,
context: 'options',
},
+ 'disableunifiedprofiles': {
+ defaultValue: false,
+ context: 'options',
+ },
// Experiments:
'threadlistavatars': {
diff --git a/src/content_scripts/console_inject_start.js b/src/content_scripts/console_inject_start.js
index 7d5e87b..78a5d2e 100644
--- a/src/content_scripts/console_inject_start.js
+++ b/src/content_scripts/console_inject_start.js
@@ -1,3 +1,6 @@
+const SMEI_SORT_DIRECTION = 8;
+const SMEI_UNIFIED_PROFILES = 9;
+
chrome.storage.sync.get(null, function(items) {
if (items.loaddrafts || items.smei_sortdirection) {
var startup =
@@ -8,8 +11,14 @@
}
if (items.smei_sortdirection) {
- if (!startup[1][6].includes(8))
- startup[1][6].push(8);
+ 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(
diff --git a/src/options/options.html b/src/options/options.html
index 37f7e7f..c0c1d3e 100644
--- a/src/options/options.html
+++ b/src/options/options.html
@@ -44,6 +44,7 @@
<div class="option"><input type="checkbox" id="batchlock"> <label for="batchlock" data-i18n="batchlock"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
<div class="option"><input type="checkbox" id="enhancedannouncementsdot"> <label for="enhancedannouncementsdot" data-i18n="enhancedannouncementsdot"></label></div>
<div class="option"><input type="checkbox" id="repositionexpandthread"> <label for="repositionexpandthread" data-i18n="repositionexpandthread"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
+ <div class="option"><input type="checkbox" id="disableunifiedprofiles"> <label for="disableunifiedprofiles" data-i18n="disableunifiedprofiles"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
<h4 data-i18n="profileindicator_header"></h4>
<div class="option"><input type="checkbox" id="profileindicator"> <label for="profileindicator" data-i18n="profileindicator"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>
<div class="option"><input type="checkbox" id="profileindicatoralt"> <label for="profileindicatoralt" data-i18n="profileindicatoralt"></label> <span class="experimental-label" data-i18n="experimental_label"></span></div>