Skip to content

Commit

Permalink
Auto Open after timeout done. Version 0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
NizamLZ committed Jan 22, 2018
1 parent cc5b1fa commit 15e259b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ana-web-chat",
"version": "0.3.1",
"version": "0.3.2",
"license": "GNU-GPLv3",
"scripts": {
"ng": "ng",
Expand Down
11 changes: 10 additions & 1 deletion src/assets/embed/ana-web-chat-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
let stompEndpoint = base.getAttr(script, "endpoint");
let businessId = base.getAttr(script, "businessid");
let apiEndpoint = base.getAttr(script, "api-endpoint");
let autoOpen = base.getAttr(script, "auto-open");
let htmlMessages = (base.getAttr(script, "html-messages") === 'true' ? true : false)
let flowId = base.getAttr(script, "flowid");
let fileUploadUrl = "";
Expand Down Expand Up @@ -505,8 +506,16 @@
document.body.appendChild(divEle);

let scriptEle = document.createElement('script')
scriptEle.innerHTML = bodyScript
scriptEle.innerHTML = bodyScript;
document.body.appendChild(scriptEle);

var maxBtn = document.getElementById('ana-max-btn');
autoOpen = parseInt(autoOpen);
if (maxBtn && autoOpen > 0 && !fullpage) {
setTimeout(() => {
maxBtn.click();
}, autoOpen * 1000);
}
}
}
let script = base.scriptEle();
Expand Down

0 comments on commit 15e259b

Please sign in to comment.