diff --git a/edit.html b/edit.html
index f2831947..7cde2c7b 100644
--- a/edit.html
+++ b/edit.html
@@ -41,16 +41,16 @@
body {
margin: 0;
- font: 9pt arial,sans-serif;
+ font: 12px arial,sans-serif;
}
/************ header ************/
#header {
height: calc(100vh - 30px);
overflow: auto;
- width: 15rem;
+ width: 250px;
position: fixed;
top: 0;
- padding: 0.95rem;
+ padding: 15px;
border-right: 1px dashed #AAA;
-webkit-box-shadow: 0 0 3rem -1.2rem black;
}
@@ -58,10 +58,11 @@
margin-top: 0;
}
#sections {
- padding-left: 18rem;
+ padding-left: 280px;
}
#sections h2 {
- margin-top: 0.5rem;
+ margin-top: 1rem;
+ margin-left: 1.7rem;
}
.aligned {
display: table-row;
diff --git a/edit.js b/edit.js
index fcf4f0cb..ace4d0ab 100644
--- a/edit.js
+++ b/edit.js
@@ -1066,23 +1066,26 @@ function beautify(event) {
}
}
-window.addEventListener("load", init, false);
+document.addEventListener("DOMContentLoaded", init);
function init() {
var params = getParams();
if (!params.id) { // match should be 2 - one for the whole thing, one for the parentheses
// This is an add
+ tE("heading", "addStyleTitle");
var section = {code: ""}
for (var i in CssToProperty) {
if (params[i]) {
section[CssToProperty[i]] = [params[i]];
}
}
- addSection(null, section);
- // default to enabled
- document.getElementById("enabled").checked = true
- tE("heading", "addStyleTitle");
- initHooks();
+ onload = () => {
+ onload = null;
+ addSection(null, section);
+ // default to enabled
+ document.getElementById("enabled").checked = true
+ initHooks();
+ };
return;
}
// This is an edit
@@ -1090,14 +1093,25 @@ function init() {
getStylesSafe({id: params.id}).then(styles => {
const style = styles[0];
styleId = style.id;
- initWithStyle({style});
+ setStyleMeta(style);
+ onload = () => {
+ onload = null;
+ initWithStyle({style});
+ };
+ if (document.readyState != 'loading') {
+ onload();
+ }
});
}
-function initWithStyle({style, codeIsUpdated}) {
+function setStyleMeta(style) {
document.getElementById("name").value = style.name;
document.getElementById("enabled").checked = style.enabled;
document.getElementById("url").href = style.url;
+}
+
+function initWithStyle({style, codeIsUpdated}) {
+ setStyleMeta(style);
if (codeIsUpdated === false) {
setCleanGlobal();