|
@@ -0,0 +1,22 @@
|
|
1
|
+function receiveMessage(event) {
|
|
2
|
+ var html = event.data;
|
|
3
|
+ insertCards(html);
|
|
4
|
+}
|
|
5
|
+
|
|
6
|
+function insertCards(html) {
|
|
7
|
+ // Remove all previous content
|
|
8
|
+ while (document.body.hasChildNodes()) {
|
|
9
|
+ document.body.removeChild(document.body.lastChild);
|
|
10
|
+ }
|
|
11
|
+
|
|
12
|
+ // Create a div that holds all the received HTML
|
|
13
|
+ var div = document.createElement("div");
|
|
14
|
+ div.setAttribute("class", "output-container");
|
|
15
|
+ div.id = "output-container";
|
|
16
|
+ div.innerHTML = html;
|
|
17
|
+
|
|
18
|
+ // Add the new div to the document
|
|
19
|
+ document.body.appendChild(div);
|
|
20
|
+}
|
|
21
|
+
|
|
22
|
+window.addEventListener("message", receiveMessage, false);
|