Add kill switch mechanism
This code implements the kill switch mechanism in the extension. This is
explained in //src/killSwitch/README.md and in the design doc:
https://docs.google.com/document/d/1O5YV6_WcxwrUyz-lwHOSTfZ3oyIFWj2EQee0VuKkhaA/edit.
Bug: twpowertools:64
Change-Id: Ia993c78035bba7038aafd53d156f20954217e86f
diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json
index f435664..10781fa 100644
--- a/src/static/_locales/en/messages.json
+++ b/src/static/_locales/en/messages.json
@@ -15,6 +15,10 @@
"message": "Get infinite scroll and other enhancements in the Google Forums and the Community Console",
"description": "The extension's description"
},
+ "options_killswitchwarning": {
+ "message": "One or more options have been force disabled because they might not be working properly. Please go to the <a href='https://groups.google.com/g/twpowertools-discuss' rel='noreferrer noopener' action='_blank'>twpowertools-discuss Google Group</a> to learn more about why some options have been force disabled.",
+ "description": "Warning shown in the options page if a feature has been remotely force disabled via the kill switch mechanism. This happens when a feature doesn't work properly and might be doing dangerous things, and the maintainer or an authorized user remotely force disables the feature."
+ },
"options_list": {
"message": "Enable infinite scrolling in thread lists.",
"description": "Feature checkbox in the options page"
diff --git a/src/static/options/options.css b/src/static/options/options.css
index 4ab69b3..a3cd7ab 100644
--- a/src/static/options/options.css
+++ b/src/static/options/options.css
@@ -24,11 +24,15 @@
cursor: pointer;
}
-.option {
+.option, .kill-switch-text {
margin: 4px 0;
line-height: 1.8em;
}
+.kill-switch-text {
+ color: red;
+}
+
.help {
cursor: help;
border-bottom: dashed 1px gray;
diff --git a/src/static/options/options.html b/src/static/options/options.html
index f22fb30..91a8205 100644
--- a/src/static/options/options.html
+++ b/src/static/options/options.html
@@ -39,6 +39,7 @@
</a>
</div>
<form>
+ <div class="kill-switch-text" id="kill-switch-warning" hidden data-i18n="killswitchwarning"></div>
<div class="option"><input type="checkbox" id="list"> <label for="list" data-i18n="list"></label></div>
<div class="option"><input type="checkbox" id="thread"> <label for="thread" data-i18n="thread"></label></div>
<div class="option"><input type="checkbox" id="threadall"> <label for="threadall" data-i18n="threadall"></label></div>