Repository: incubator-unomi
Updated Branches:
  refs/heads/master 4651cbb79 -> c0de8a55e


UNOMI-9: Improved example to display results on page instead of JS console.

Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b330db77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b330db77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b330db77

Branch: refs/heads/master
Commit: b330db77aa3266af921a3e991a7e6b6694d27ede
Parents: 4651cbb
Author: Chris Laprun <[email protected]>
Authored: Mon Dec 21 14:25:01 2015 +0100
Committer: Chris Laprun <[email protected]>
Committed: Thu Jan 7 15:04:30 2016 +0100

----------------------------------------------------------------------
 wab/src/main/webapp/index.html | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b330db77/wab/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/wab/src/main/webapp/index.html b/wab/src/main/webapp/index.html
index ec6b2bd..979a2fc 100644
--- a/wab/src/main/webapp/index.html
+++ b/wab/src/main/webapp/index.html
@@ -137,15 +137,38 @@
                 };
 
                 contextRequest(function (response) {
-                    console.log("Profile sucessfully updated with tweetNB = " 
+ response.profileProperties.tweetNb + " and tweetedFrom = " + 
response.profileProperties.tweetedFrom);
-                    console.log(response);
+                    var element = document.querySelector('#tweetNB');
+                    element.setAttribute("value", 
response.profileProperties.tweetNb);
+                    var list = document.querySelector("#tweetedFrom");
+                    list.innerHTML = '';
+                    var tweetedFrom = response.profileProperties.tweetedFrom;
+                    for (var index in tweetedFrom) {
+                        var entry = document.createElement('li');
+                        
entry.appendChild(document.createTextNode(tweetedFrom[index]));
+                        list.appendChild(entry);
+                    }
+                    element = document.querySelector("#response");
+                    
element.appendChild(document.createTextNode(JSON.stringify(response)));
                 }, defaultErrorCallback, contextPayload);
             });
         });
-
     </script>
 </head>
 <body>
 <a href="https://twitter.com/share"; class="twitter-share-button" 
data-via="jahia" data-related="jahia" data-hashtags="jahia">Tweet</a>
+<ul>
+    <li>
+        <label for="tweetNB">Number of tweets:</label>
+        <input id="tweetNB" readonly value="0">
+    </li>
+    <li>
+        <label for="tweetedFrom">Tweeted from URLs:</label>
+        <ul id="tweetedFrom"></ul>
+    </li>
+    <li>
+        <label for="response">Raw response:</label>
+        <pre id="response"></pre>
+    </li>
+</ul>
 </body>
 </html>
\ No newline at end of file

Reply via email to