Skip to content

Commit

Permalink
Add option to enable the 'SMEI_SORT_DIRECTION' experiment
Browse files Browse the repository at this point in the history
This option, when enabled, activates the SMEI_SORT_DIRECTION experiment,
which is disabled by default in the Community Console.

This experiment lets user set the sort direction in thread lists, so
threads can be ordered in ascending or descending order.

Fixes: #25
Change-Id: Ie8f6825e70d11ee7d3e20a38a7f20e2a34780d9f
  • Loading branch information
avm99963 committed Dec 27, 2020
1 parent bbc88c6 commit b38b741
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/features.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ de la Consola de la Comunidad_.

![GIF que muestra cómo funciona la función](resources/batch_lock.gif)

### Sentido del orden en la Consola de la Comunidad
> **Opción:** _Activa el experimento `SMEI_SORT_DIRECTION`._
Esta opción activa un experimento disponible en la Consola de la Comunidad que
te permite ordenar las listas de hilos en sentido ascendente o descendente.

![GIF que muestra cómo cambiar entre el sentido ascendente/descendente](resources/smei_sort_direction.gif)

### Punto indicador
> **Opciones:** _Muestra si el autor del hilo ha participado en otros hilos_,
_Muestra el número de preguntas y respuestas escritas por el autor del hilo
Expand Down
8 changes: 8 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ Console thread list_.

![GIF showing how the feature works](resources/batch_lock.gif)

### Sort direction in the Community Console
> **Option name:** _Enable the `SMEI_SORT_DIRECTION` experiment._
This option enables an experiment available in the Community Console which lets
you sort thread lists in ascending or descending order.

![GIF showing how to switch between ascending/descending order](resources/smei_sort_direction.gif)

### Indicator dot
> **Option names:** _Show whether the OP has participated in other threads_,
_Show the number of questions and replies written by the OP within the last `n`
Expand Down
Binary file added docs/resources/smei_sort_direction.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/_locales/ca/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
"message": "Afegeix l'opció per bloquejar diversos fils a la llista de fils de la Consola de la Comunitat.",
"description": "Feature checkbox in the options page"
},
"options_smei_sortdirection": {
"message": "Activa l'experiment <code class=\"help\" title=\"Aquest experiment et permet ordenar la llista de fils de la Consola de la Comunitat en ordre ascendent o descendent.\">SMEI_SORT_DIRECTION</code>.",
"description": "Feature checkbox in the options page"
},
"options_profileindicator_header": {
"message": "Punt indicador",
"description": "Heading for the profile indicator feature options"
Expand Down
4 changes: 4 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
"message": "Add the option to lock multiple threads from the Community Console thread list.",
"description": "Feature checkbox in the options page"
},
"options_smei_sortdirection": {
"message": "Enable the <code class=\"help\" title=\"This experiment lets you sort the Community Console thread list in ascending or descending order.\">SMEI_SORT_DIRECTION</code> experiment.",
"description": "Feature checkbox in the options page"
},
"options_profileindicator_header": {
"message": "Indicator dot",
"description": "Heading for the profile indicator feature options"
Expand Down
4 changes: 4 additions & 0 deletions src/_locales/es/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
"message": "Añade la opción para bloquear varios hilos en la lista de hilos de la Consola de la Comunidad.",
"description": "Feature checkbox in the options page"
},
"options_smei_sortdirection": {
"message": "Activa el experimento <code class=\"help\" title=\"Este experimento te permite ordenar la lista de hilos de la Consola de la Comunidad en orden ascendente o descendente.\">SMEI_SORT_DIRECTION</code>.",
"description": "Feature checkbox in the options page"
},
"options_profileindicator_header": {
"message": "Punto indicador",
"description": "Heading for the profile indicator feature options"
Expand Down
1 change: 1 addition & 0 deletions src/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const defaultOptions = {
'ccforcehidedrawer': false,
'ccdragndropfix': false,
'batchlock': false,
'smei_sortdirection': false,
};

const specialOptions = [
Expand Down
5 changes: 5 additions & 0 deletions src/content_scripts/console_inject_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ chrome.storage.sync.get(null, function(items) {
startup[4][13] = true;
}

if (items.smei_sortdirection) {
if (!startup[1][6].includes(8))
startup[1][6].push(8);
}

document.querySelector('html').setAttribute(
'data-startup', JSON.stringify(startup));
}
Expand Down
1 change: 1 addition & 0 deletions src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h4 data-i18n="enhancements"></h4>
<div class="option"><input type="checkbox" id="ccforcehidedrawer"> <label for="ccforcehidedrawer" data-i18n="ccforcehidedrawer"></label></div>
<div id="dragndrop-wrapper" class="option" hidden><input type="checkbox" id="ccdragndropfix"> <label for="ccdragndropfix" data-i18n="ccdragndropfix"></label></div>
<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="smei_sortdirection"> <label for="smei_sortdirection" data-i18n="smei_sortdirection"></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>
Expand Down

0 comments on commit b38b741

Please sign in to comment.