Add title updating

This commit is contained in:
Nicholas Jitkoff 2022-04-28 21:10:15 -06:00
parent b90d18948a
commit 57f8e855a1
2 changed files with 4 additions and 1 deletions

View file

@ -37,6 +37,9 @@
// if (e.origin == 'null' || e.origin = ) {
if (e.data.title) document.title = e.data.title;
if (e.data.favicon) setFavicon(e.data.favicon);
if (e.data.updateURL) {
window.location.pathname = "/" + e.data.title.replace(" ", "_") + "/-/" + e.data.image
}
if (e.data.setStorage) document.localStorage.setItem(contentHash, e.data.set);
if (e.data.getStorage) document.getElementById("iframe").postMessage(document.localStorage.getItem(contentHash), e.origin)
// }

View file

@ -186,7 +186,7 @@ function render() {
image = image?.url || image;
instructions = json.recipeInstructions;
let title = clean(json.name);
parent.postMessage({title:title, favicon:"🍳"}, "*");
parent.postMessage({title:title, favicon:"🍳", image:image, updateURL:true}, "*");
// let text = instructions.join(" ");