1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Improve settings export

For #705
This commit is contained in:
kkapsner 2024-12-22 00:53:15 +01:00
parent c776ce9e04
commit 453174a18b
4 changed files with 27 additions and 6 deletions

View File

@ -1456,11 +1456,11 @@
}, },
"exportSettings_title": { "exportSettings_title": {
"message": "Export settings", "message": "CanvasBlocker settings export",
"description": "" "description": ""
}, },
"exportSettings_description": { "exportSettings_description": {
"message": "", "message": "This allows you to copy your current settings. You can also paste and modify them here. If something is invalid the textarea will get a red background and the change is not stored.",
"description": "" "description": ""
}, },

View File

@ -1,12 +1,26 @@
html, body { html {
height: 100%; height: 100%;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#settings {
width: 100%; body {
box-sizing: border-box;
height: 100%; height: 100%;
margin: 0;
padding: 0.5em;
box-sizing: border-box;
display: grid;
grid-template-columns: 100%;
grid-template-rows: max-content auto;
}
#description {
margin: 0.5em 0em;
}
#settings {
box-sizing: border-box;
margin: 0;
} }
#settings.invalid { #settings.invalid {
background-color: var(--input-error-background-color); background-color: var(--input-error-background-color);

View File

@ -9,6 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
<div id="description"></div>
<textarea id="settings"></textarea> <textarea id="settings"></textarea>
<script src="../lib/require.js"></script> <script src="../lib/require.js"></script>
<script src="../lib/logging.js"></script> <script src="../lib/logging.js"></script>

View File

@ -8,6 +8,12 @@
const logging = require("../lib/logging"); const logging = require("../lib/logging");
const settingsMigration = require("../lib/settingsMigration"); const settingsMigration = require("../lib/settingsMigration");
require("../lib/theme").init(); require("../lib/theme").init();
const extension = require("../lib/extension");
document.querySelector("head title").textContent = extension.getTranslation("exportSettings_title");
document.getElementById("description").appendChild(
extension.parseTranslation(extension.getTranslation("exportSettings_description"))
);
const input = document.getElementById("settings"); const input = document.getElementById("settings");
settings.onloaded(function(){ settings.onloaded(function(){
const data = {}; const data = {};