From 3ff5ad5dcd7ef61ee3d18926eb02bc266ddb58da Mon Sep 17 00:00:00 2001 From: Dmitri Date: Fri, 21 Apr 2017 21:41:19 +0700 Subject: [PATCH] Formatting and fixes --- component/Bubbles.js | 17 ++++++++++++++--- component/start-here/hello.html | 12 ++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/component/Bubbles.js b/component/Bubbles.js index b1e6ed0..7b3a2e6 100644 --- a/component/Bubbles.js +++ b/component/Bubbles.js @@ -6,10 +6,12 @@ function Bubbles(container, self, options) { typeSpeed = options.typeSpeed || 5; // delay per character, to simulate the machine "typing" widerBy = options.widerBy || 2; // add a little extra width to bubbles to make sure they don't break sidePadding = options.sidePadding || 6; // padding on both sides of chat bubbles - inputCallbackFn = options.inputCallbackFn || (function(o){ console.log(o); }); // should we display an input field? + inputCallbackFn = options.inputCallbackFn || (function(o){ return false }); // should we display an input field? var standingAnswer = "ice"; // remember where to restart convo if interrupted + + // set up the stage container.classList.add("bubble-container"); var bubbleWrap = document.createElement("div"); @@ -44,6 +46,8 @@ function Bubbles(container, self, options) { } inputCallbackFn ? this.typeInput(inputCallbackFn) : false; + + // init typing bubble var bubbleTyping = document.createElement("div"); bubbleTyping.className = "bubble-typing imagine"; @@ -108,6 +112,8 @@ function Bubbles(container, self, options) { start(); } + + // create a bubble var bubbleQueue = false; var addBubble = function(say, posted, reply){ @@ -123,7 +129,10 @@ function Bubbles(container, self, options) { // answer picker styles if(reply !== ""){ var bubbleButtons = bubbleContent.querySelectorAll(".bubble-button"); - bubbleButtons.forEach(function(el){ el.style.width = el.offsetWidth - sidePadding * 2 + widerBy + "px"; }); + bubbleButtons.forEach(function(el){ + if(!el.parentNode.parentNode.classList.contains("reply-freeform")) + el.style.width = el.offsetWidth - sidePadding * 2 + widerBy + "px"; + }); bubble.addEventListener("click", function(){ bubbleButtons.forEach(function(el){ el.style.width = 0 + "px"; @@ -166,4 +175,6 @@ function Bubbles(container, self, options) { }, wait + animationTime * 2); } -} \ No newline at end of file + + +} // close function \ No newline at end of file diff --git a/component/start-here/hello.html b/component/start-here/hello.html index 1b39888..a96ccfa 100644 --- a/component/start-here/hello.html +++ b/component/start-here/hello.html @@ -325,16 +325,14 @@