I just learned that URL unfurling is a thing, and now this chat client supports it (poorly).

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3335 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2016-09-17 20:53:03 +00:00
parent c9b528f1dc
commit a5def62efa
4 changed files with 103 additions and 10 deletions

View File

@ -280,8 +280,12 @@ function printStructured(container, data) {
node.setAttribute("target", data.target || "_blank");
} else if (data.iframe) {
node = document.createElement("iframe");
node.setAttribute("srcdoc", data.iframe);
node.setAttribute("sandbox", "allow-forms allow-scripts allow-top-navigation");
if (data.src) {
node.setAttribute("src", data.src);
} else {
node.setAttribute("srcdoc", data.iframe);
}
node.setAttribute("sandbox", "allow-forms allow-scripts allow-top-navigation allow-same-origin");
node.setAttribute("width", data.width || 320);
node.setAttribute("height", data.height || 240);
if (data.name) {
@ -519,7 +523,13 @@ function blur() {
}
function onMessage(event) {
send({event: "onWindowMessage", message: event.data});
if (event.data && event.data.event == "resizeMe" && event.data.width && event.data.height) {
var iframe = document.getElementById("iframe_" + event.data.name);
iframe.setAttribute("width", event.data.width);
iframe.setAttribute("height", event.data.height);
} else {
send({event: "onWindowMessage", message: event.data});
}
}
function submitButton() {