Add experiments link to the options page
This link points to the experiments page, and is only shown in
non-release versions of the extension.
Change-Id: I09db9e6ded29be7f6f03f97378cd9311f88d40d3
diff --git a/src/common/common.js b/src/common/common.js
index db20409..619d6d8 100644
--- a/src/common/common.js
+++ b/src/common/common.js
@@ -150,3 +150,9 @@
return manifest.browser_specific_settings !== undefined &&
manifest.browser_specific_settings.gecko !== undefined;
}
+
+// Returns whether the extension is a release version.
+function isReleaseVersion() {
+ var manifest = chrome.runtime.getManifest();
+ return ('version' in manifest) && manifest.version != '0';
+}
diff --git a/src/options/options.css b/src/options/options.css
index 7ebe04f..6933e13 100644
--- a/src/options/options.css
+++ b/src/options/options.css
@@ -7,13 +7,21 @@
max-width: 600px;
}
-.features-link {
+.features-link, .experiments-link {
position: absolute;
top: 8px;
- right: 8px;
width: 24px;
}
+.features-link {
+ right: 8px;
+}
+
+.experiments-link {
+ cursor: pointer;
+ right: 40px;
+}
+
.option {
margin: 4px 0;
line-height: 1.8em;
diff --git a/src/options/options.html b/src/options/options.html
index f4f6651..37f7e7f 100644
--- a/src/options/options.html
+++ b/src/options/options.html
@@ -9,6 +9,15 @@
</head>
<body>
<main>
+ <div class="experiments-link" hidden>
+ <!--
+ Material Design Icon - social/science
+ - LICENSE: Apache License Version 2.0
+ - Source: https://github.com/google/material-design-icons/
+ - Author: Google LLC
+ -->
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><rect fill="none" height="24" width="24"/></g><g><path d="M13,11.33L18,18H6l5-6.67V6h2 M15.96,4H8.04C7.62,4,7.39,4.48,7.65,4.81L9,6.5v4.17L3.2,18.4C2.71,19.06,3.18,20,4,20h16 c0.82,0,1.29-0.94,0.8-1.6L15,10.67V6.5l1.35-1.69C16.61,4.48,16.38,4,15.96,4L15.96,4z"/></g></svg>
+ </div>
<a href="https://gerrit.avm99963.com/plugins/gitiles/infinitegforums/+/master/docs/features.md" target="_blank" class="features-link">
<!--
Material Design Icon - action/help_outline
diff --git a/src/options/options_common.js b/src/options/options_common.js
index 10fee88..098a632 100644
--- a/src/options/options_common.js
+++ b/src/options/options_common.js
@@ -77,6 +77,14 @@
window.addEventListener('load', function() {
i18n();
+ if (window.CONTEXT == 'options' && !isReleaseVersion()) {
+ var experimentsLink = document.querySelector('.experiments-link');
+ experimentsLink.removeAttribute('hidden');
+ experimentsLink.addEventListener('click', _ => chrome.tabs.create({
+ url: chrome.runtime.getURL('options/experiments.html'),
+ }));
+ }
+
chrome.storage.sync.get(null, function(items) {
items = cleanUpOptions(items, false);