Robert Carnecky hace 10 años
padre
commit
a9b80fa19c
Se han modificado 1 ficheros con 22 adiciones y 0 borrados
  1. 22
    0
      generator/js/output.js

+ 22
- 0
generator/js/output.js Ver fichero

@@ -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);

Loading…
Cancelar
Guardar