aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-12-18 17:00:34 -0500
committerGitHub <noreply@github.com>2020-12-18 17:00:34 -0500
commit9beb659b178ab922a4d11a821ed6d2f1bce40f96 (patch)
tree72b34732d3737d123009c287494472d1f56ec486 /ext/bg
parent0d0728fac0efa567af4da26aa4954829a6ea21a1 (diff)
Manifest version CSS rules (#1126)
* Add CSS rules for hiding content based on manifest version * Organize other rules
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/css/settings2.css19
-rw-r--r--ext/bg/js/generic-page-main.js6
-rw-r--r--ext/bg/js/permissions-main.js2
-rw-r--r--ext/bg/js/settings2/settings-main.js2
-rw-r--r--ext/bg/js/welcome-main.js2
5 files changed, 26 insertions, 5 deletions
diff --git a/ext/bg/css/settings2.css b/ext/bg/css/settings2.css
index d25004bc..eeba5afc 100644
--- a/ext/bg/css/settings2.css
+++ b/ext/bg/css/settings2.css
@@ -2439,17 +2439,20 @@ code.anki-field-marker {
:root[data-browser=chrome] [data-show-for-browser]:not([data-show-for-browser~=chrome]),
:root[data-browser=firefox] [data-show-for-browser]:not([data-show-for-browser~=firefox]),
:root[data-browser=firefox-mobile] [data-show-for-browser]:not([data-show-for-browser~=firefox-mobile]),
+:root[data-browser=edge] [data-hide-for-browser~=edge],
+:root[data-browser=edge-legacy] [data-hide-for-browser~=edge-legacy],
+:root[data-browser=chrome] [data-hide-for-browser~=chrome],
+:root[data-browser=firefox] [data-hide-for-browser~=firefox],
+:root[data-browser=firefox-mobile] [data-hide-for-browser~=firefox-mobile] {
+ display: none;
+}
+
:root[data-os=mac] [data-show-for-os]:not([data-show-for-os~=mac]),
:root[data-os=win] [data-show-for-os]:not([data-show-for-os~=win]),
:root[data-os=android] [data-show-for-os]:not([data-show-for-os~=android]),
:root[data-os=cros] [data-show-for-os]:not([data-show-for-os~=cros]),
:root[data-os=linux] [data-show-for-os]:not([data-show-for-os~=linux]),
:root[data-os=openbsd] [data-show-for-os]:not([data-show-for-os~=openbsd]),
-:root[data-browser=edge] [data-hide-for-browser~=edge],
-:root[data-browser=edge-legacy] [data-hide-for-browser~=edge-legacy],
-:root[data-browser=chrome] [data-hide-for-browser~=chrome],
-:root[data-browser=firefox] [data-hide-for-browser~=firefox],
-:root[data-browser=firefox-mobile] [data-hide-for-browser~=firefox-mobile],
:root[data-os=mac] [data-hide-for-os~=mac],
:root[data-os=win] [data-hide-for-os~=win],
:root[data-os=android] [data-hide-for-os~=android],
@@ -2459,6 +2462,12 @@ code.anki-field-marker {
display: none;
}
+:root[data-manifest-version='2'] [data-show-for-manifest-version]:not([data-show-for-manifest-version~='2']),
+:root[data-manifest-version='3'] [data-show-for-manifest-version]:not([data-show-for-manifest-version~='3']),
+:root[data-manifest-version='2'] [data-hide-for-manifest-version~='2'],
+:root[data-manifest-version='3'] [data-hide-for-manifest-version~='3'] {
+ display: none;
+}
/* Media-specific styles */
@media (max-width: 800px), (hover: none) and (max-width: 1100px) {
diff --git a/ext/bg/js/generic-page-main.js b/ext/bg/js/generic-page-main.js
index 9102fec3..8e1b3c76 100644
--- a/ext/bg/js/generic-page-main.js
+++ b/ext/bg/js/generic-page-main.js
@@ -15,7 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+function setupEnvironmentInfo() {
+ const {manifest_version: manifestVersion} = chrome.runtime.getManifest();
+ document.documentElement.dataset.manifestVersion = `${manifestVersion}`;
+}
+
(() => {
document.querySelector('#content-scroll-focus').focus();
document.documentElement.dataset.loaded = 'true';
+ setupEnvironmentInfo();
})();
diff --git a/ext/bg/js/permissions-main.js b/ext/bg/js/permissions-main.js
index 3e46c3f2..a464f40e 100644
--- a/ext/bg/js/permissions-main.js
+++ b/ext/bg/js/permissions-main.js
@@ -20,9 +20,11 @@
*/
async function setupEnvironmentInfo() {
+ const {manifest_version: manifestVersion} = chrome.runtime.getManifest();
const {browser, platform} = await api.getEnvironmentInfo();
document.documentElement.dataset.browser = browser;
document.documentElement.dataset.os = platform.os;
+ document.documentElement.dataset.manifestVersion = `${manifestVersion}`;
}
async function isAllowedIncognitoAccess() {
diff --git a/ext/bg/js/settings2/settings-main.js b/ext/bg/js/settings2/settings-main.js
index f86764bc..6e6186e5 100644
--- a/ext/bg/js/settings2/settings-main.js
+++ b/ext/bg/js/settings2/settings-main.js
@@ -39,9 +39,11 @@
*/
async function setupEnvironmentInfo() {
+ const {manifest_version: manifestVersion} = chrome.runtime.getManifest();
const {browser, platform} = await api.getEnvironmentInfo();
document.documentElement.dataset.browser = browser;
document.documentElement.dataset.os = platform.os;
+ document.documentElement.dataset.manifestVersion = `${manifestVersion}`;
}
async function setupGenericSettingsController(genericSettingController) {
diff --git a/ext/bg/js/welcome-main.js b/ext/bg/js/welcome-main.js
index 504bd88b..8d43fdb0 100644
--- a/ext/bg/js/welcome-main.js
+++ b/ext/bg/js/welcome-main.js
@@ -28,9 +28,11 @@
*/
async function setupEnvironmentInfo() {
+ const {manifest_version: manifestVersion} = chrome.runtime.getManifest();
const {browser, platform} = await api.getEnvironmentInfo();
document.documentElement.dataset.browser = browser;
document.documentElement.dataset.os = platform.os;
+ document.documentElement.dataset.manifestVersion = `${manifestVersion}`;
}
async function setupGenericSettingsController(genericSettingController) {