mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Add title updating
This commit is contained in:
parent
b90d18948a
commit
57f8e855a1
2 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -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(" ");
|
||||
|
|
|
|||
Loading…
Reference in a new issue