Skip to content

Commit

Permalink
[colors/icc-profile-editor] Expandable log. 'Ready!' notification aft…
Browse files Browse the repository at this point in the history
…er page load.
  • Loading branch information
kdashg committed Aug 8, 2024
1 parent 6ca08c8 commit 04c28ae
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions colors/icc-profile-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
</head>
<body>
<fieldset><legend>Log</legend>
<pre id=e_log style='margin: 0; height: 20em; overflow: scroll;'></pre>
<details>
<summary id=e_log_tip style='white-space: pre;'></summary>
<pre id=e_log_body style='margin: 0; height: 20em; overflow: scroll;'></pre>
</details>
</fieldset>
<hr>
<fieldset>
Expand Down Expand Up @@ -1331,7 +1334,8 @@ <h1>
}

function log(line) {
e_log.textContent = `[@ ${performance.now()} ms] ${line}\n` + e_log.textContent;
e_log_body.textContent = e_log_tip.textContent + '\n' + e_log_body.textContent;
e_log_tip.textContent = `[@ ${performance.now()} ms] ${line}`;
}


Expand All @@ -1351,8 +1355,8 @@ <h1>
log(`Importing...`);
const profile = IccProfile.from_bytes(bytes);

log(`Open successful.`);
console.log({profile});
log(`Loading UI...`);

// -

Expand Down Expand Up @@ -1498,7 +1502,10 @@ <h1>
}
);

log(`Refreshing...`);
profile.edn.signal('refresh', 'self');

log(`Open succeeded.`);
});

async function serialize_to_bytes() {
Expand All @@ -1525,11 +1532,13 @@ <h1>
const bytes = await serialize_to_bytes();

const file_name = e_file_name.value || 'profile.icc';
log(`Saving to '${file_name}...'`);
log(`Saving '${file_name}...'`);
const ICC_PROFILE_MIME = 'application/vnd.iccprofile';
const blob = new Blob([bytes], {type: ICC_PROFILE_MIME});
download_blob(file_name, blob);
});

log('Ready!');
</script>
</body>
</html>

0 comments on commit 04c28ae

Please sign in to comment.