Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 27096b7a authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Hide settings when run on non-supported platform

Chrome syncs installed extensions across computers and will install it also on Windows, macOS and other unsupported platforms.
The extension doesn't work there and showing settings for features that don't exist makes no sense.
The "About" tab is still fully accessible.

Differential Revision: https://phabricator.kde.org/D13326
parent 2ba74255
......@@ -9,6 +9,9 @@
"options_save_success": {
"message": "Settings successfully saved"
},
"options_not_supported_os": {
"message": "This extension is not supported on this operating system."
},
"options_tab_general": {
"description": "The 'General settings' tab in settings",
......
......@@ -4,6 +4,16 @@ body {
overflow: hidden;
}
.not-supported-info {
display: none;
}
body.not-supported .not-supported-info {
display: block;
}
body.not-supported #extensions-selection {
display: none;
}
.tabbar {
display: block;
padding: 0;
......
......@@ -18,6 +18,8 @@
</ul>
<div class="tab active" data-tab-id="general">
<p class="not-supported-info" data-i18n="options_not_supported_os">I18N</p>
<ul id="extensions-selection">
<li>
<label>
......
......@@ -129,23 +129,30 @@ document.addEventListener("DOMContentLoaded", function () {
});
}
loadSettings();
// auto save when changing any setting
// TODO can we do that on closing, or does it not matter how often we do chrome storage sync thing?
document.querySelectorAll("input[type=checkbox]").forEach(function (item) {
item.addEventListener("click", function () {
var saveMessage = document.getElementById("save-message");
saveMessage.innerText = "";
saveSettings(function (error) {
if (error) {
saveMessage.innerText = chrome.i18n.getMessage("options_save_failed");
return;
}
//saveMessage.innerText = chrome.i18n.getMessage("options_save_success");
sendMessage("changed");
// check whether the platform is supported before loading and activating settings
chrome.runtime.getPlatformInfo(function (info) {
if (!SUPPORTED_PLATFORMS.includes(info.os)) {
document.body.classList.add("not-supported");
return;
}
loadSettings();
// auto save when changing any setting
// TODO can we do that on closing, or does it not matter how often we do chrome storage sync thing?
document.querySelectorAll("input[type=checkbox]").forEach(function (item) {
item.addEventListener("click", function () {
var saveMessage = document.getElementById("save-message");
saveMessage.innerText = "";
saveSettings(function (error) {
if (error) {
saveMessage.innerText = chrome.i18n.getMessage("options_save_failed");
return;
}
sendMessage("changed");
});
});
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment