Permalink
Browse files

plugin responses can have a message and an iframe

  • Loading branch information...
obra committed Aug 6, 2012
1 parent e5201d9 commit bd5222a55dc06c757acdc8638fe0c57cdffa0280
Showing with 11 additions and 1 deletion.
  1. +11 −1 app/scripts/main.js
View
@@ -18,15 +18,25 @@ function handleQuery() {
return;
$("#conversation").append('<div class="user"><span class="yourname">You:</span> <span class="msg">'+cmd+'</span></div>');
var response = Rei.handleQuery(cmd);
+ var best = response.bestResponse;
+ reiSay(best[1].message);
+ if (best[1].iframeUrl) {
+ reiShowIframe(best[1].iframeUrl);
+ }
reiSay(response.bestResponse[1]);
- //reiSay(JSON.stringify(response));
+ reiSay(JSON.stringify(response));
}
function reiSay(string) {
$("#conversation").append('<div class="rei"><span class="reiname">Rei:</span> <span class="msg">'+string+'<span></div>');
}
+function reiShowIframe(url) {
+ $("#conversation").append('<div class="rei"><span class="reiname">Rei:</span> <iframe src="'+url+'"/></div>');
+
+}
+
jQuery("#submit").on("click", function() {
handleQuery();

0 comments on commit bd5222a

Please sign in to comment.