Minor UI changes + adding webpage to the title.

+ Dark theme support.
+ UI element to make it clearer whether the editing has been enabled.
This commit is contained in:
Adsooi 2023-10-17 18:25:54 +02:00
parent 76d80b1c6a
commit c374b6adc7
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 57 additions and 14 deletions

View file

@ -17,8 +17,8 @@
* *
**/ **/
const TITLE_EDITING = "Simple Content Editor (editing)" const TITLE_EDITING = "Simple Webpage Content Editor (editing)"
const TITLE_NOT_EDITING = "Simple Content Editor" const TITLE_NOT_EDITING = "Simple Webpage Content Editor"
const exportTabHTMLToLink = () => { const exportTabHTMLToLink = () => {
let fullHTML = document.body.parentNode.outerHTML let fullHTML = document.body.parentNode.outerHTML
@ -30,10 +30,12 @@ const exportTabHTMLToLink = () => {
const enableEdition = () => { const enableEdition = () => {
document.body.contentEditable = true document.body.contentEditable = true
return true
} }
const disableEdition = () => { const disableEdition = () => {
document.body.contentEditable = false document.body.contentEditable = false
return true
} }
const queryEditionStatus = () => { const queryEditionStatus = () => {

View file

@ -1,7 +1,7 @@
{ {
"description": "Simple local webpage content editing extension that allows in-browser edition and HTML export.", "description": "Simple local webpage content editing extension that allows in-browser edition and HTML export.",
"manifest_version": 3, "manifest_version": 3,
"name": "Simple Content Editor", "name": "Simple Webpage Content Editor",
"version": "1.0", "version": "1.0",
"author": "Ad5001", "author": "Ad5001",
"developer": { "developer": {
@ -10,14 +10,14 @@
}, },
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "simplecontenteditor@ad5001.eu", "id": "simplewebpagecontenteditor@ad5001.eu",
"strict_min_version": "113.0" "strict_min_version": "113.0"
}, },
"gecko_android": { "gecko_android": {
"strict_min_version": "113.0" "strict_min_version": "113.0"
} }
}, },
"homepage_url": "https://apps.ad5001.eu/simplecontenteditor/", "homepage_url": "https://apps.ad5001.eu/simplewebpagecontenteditor/",
"background": { "background": {
"scripts": ["background.js"] "scripts": ["background.js"]
@ -25,7 +25,7 @@
"action": { "action": {
"default_icon": "icons/editor.svg", "default_icon": "icons/editor.svg",
"default_title": "Simple Content Editor", "default_title": "Simple Webpage Content Editor",
"default_popup": "popup/control.html", "default_popup": "popup/control.html",
"theme_icons": [{ "theme_icons": [{
"light": "icons/editor-photon-dark.svg", "light": "icons/editor-photon-dark.svg",

View file

@ -21,8 +21,17 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Simple Content Editor Control Popup</title> <title>Simple Content Editor Control Popup</title>
<style> <style>
body {
width: 20ch;
--green: green;
--blue: #4185ff;
--red: #bb1111;
--gray-status: gray;
--green-status: #003706;
}
button { button {
margin: .3em; margin-top: .5ch;
border: none; border: none;
border-radius: .5em; border-radius: .5em;
color: white; color: white;
@ -30,7 +39,7 @@
padding-right: 1em; padding-right: 1em;
padding-left: 1em; padding-left: 1em;
cursor: pointer; cursor: pointer;
width: 15ch; width: 100%;
} }
button:hover, button:focus { button:hover, button:focus {
@ -40,30 +49,62 @@
button:active { button:active {
filter: brightness(1.4) filter: brightness(1.4)
} }
#status {
font-family: sans-serif;
line-height: 1em;
}
#status::before {
display: inline-block;
vertical-align: middle;
content: " ";
margin-right: .6ch;
background: var(--gray-status);
width: .6em;
height: .6em;
border-radius: 100%;
}
#start-editing { #start-editing {
background: green; background: var(--green);
} }
#save-html { #save-html {
background: #4185ff; background: var(--blue);
} }
#stop-editing { #stop-editing {
background: #bb1111; background: var(--blue);
}
.editing > #status::before {
background: var(--green-status);
} }
.not-editing > #save-html, .not-editing > #save-html,
.not-editing > #stop-editing, .not-editing > #stop-editing,
.editing > #start-editing { .editing > #start-editing,
.not-editing > #status > #status-editing,
.editing > #status > #status-not-editing {
display: none; display: none;
} }
@media (prefers-color-scheme: dark) {
body {
--green-status: #30e60b;
--gray-status: lightgray;
background: #1c1b22;
color: white;
}
}
</style> </style>
<script src="control.js"></script> <script src="control.js"></script>
</head> </head>
<body id="editing-controls" class="not-editing"> <body id="editing-controls" class="not-editing">
<button id="start-editing">Start Editing</button> <p id="status">Status: <span id="status-not-editing">Not Editing</span><span id="status-editing">Editing</span></p>
<button id="start-editing">Start/Resume Editing</button>
<button id="save-html">Save HTML</button><br> <button id="save-html">Save HTML</button><br>
<button id="stop-editing">Stop Editing</button> <button id="stop-editing">Pause Editing</button>
</body> </body>
</html> </html>