Skip to content

Commit

Permalink
v3.33.2 released
Browse files Browse the repository at this point in the history
  • Loading branch information
resampled committed Jan 15, 2021
1 parent 44ea6e1 commit 3a7826d
Show file tree
Hide file tree
Showing 24 changed files with 405 additions and 38 deletions.
2 changes: 1 addition & 1 deletion examples/Common/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</script>

<!-- BEGIN CHAT {literal} -->
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad","on"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<!-- {/literal} END CHAT -->
</body>
</html>
4 changes: 2 additions & 2 deletions examples/Common/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filename": "../../threadswidget-3.33.1.min.js",
"style": "../../threadswidget-3.33.1.min.css",
"filename": "../../threadswidget-3.33.2.min.js",
"style": "../../threadswidget-3.33.2.min.css",
"webchat": {
"locale": "ru",
"package": "FIX_ME",
Expand Down
2 changes: 1 addition & 1 deletion examples/Custom button/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
</script>

<!-- BEGIN CHAT {literal} -->
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad","on"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<!-- {/literal} END CHAT -->

<script>
Expand Down
4 changes: 2 additions & 2 deletions examples/Custom button/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filename": "../../threadswidget-3.33.1.min.js",
"style": "../../threadswidget-3.33.1.min.css",
"filename": "../../threadswidget-3.33.2.min.js",
"style": "../../threadswidget-3.33.2.min.css",
"webchat": {
"locale": "ru",
"package": "FIX_ME",
Expand Down
2 changes: 1 addition & 1 deletion examples/Locale/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</script>

<!-- BEGIN CHAT {literal} -->
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<script type="text/javascript">!function(configurationFile,e){"use strict";configurationFile=configurationFile||"/settings.json";var t=window,a=document;t.ThreadsWidget={isDummy:!0},["hideInvite","version","commitHash","showChat","hideChat","onHideChat","onScenarios","onLoad","on"].forEach(function(e){t.ThreadsWidget[e]=function(a){var n,i,o;n=e,i=a,o=setInterval(function(){t.ThreadsWidget&&!t.ThreadsWidget.isDummy&&(clearInterval(o),t.ThreadsWidget[n]&&t.ThreadsWidget[n](i))},100)}});var n,i=(n=new XMLHttpRequest,function(e,t,a,i){n.onreadystatechange=function(){if(4===n.readyState)if(200===this.status)a(n.response);else{if("function"!=typeof i)throw new Error(n.response);i(n)}},n.open(e,t),n.send()});function o(t){t.webchat&&(t.webchat.filename=t.filename),t.style&&(t.webchat.style=t.style),e&&"string"==typeof e&&(t.webchat.currentLocale=e),e&&"object"==typeof e&&(e.locale&&"string"==typeof e.locale&&(t.webchat.currentLocale=e.locale),e.unavailable&&"boolean"==typeof e.unavailable&&(t.webchat.isUnavailableOnStart=e.unavailable));try{sessionStorage.setItem("__threadsWidget",JSON.stringify(t.webchat))}catch(e){window.__threadsWidget=JSON.stringify(t.webchat)}if(t.filename){var n=a.createElement("script");n.type="text/javascript",n.async=!0,n.src=t.filename;var i=a.getElementsByTagName("script")[0];i?i.parentNode.insertBefore(n,i):a.body.appendChild(n)}else console&&console.error("Invalid bundle")}function s(){i("GET",configurationFile+"?rnd="+Math.random(),function(e){var t=JSON.parse(e);o(t)})}"complete"===a.readyState?s():t.attachEvent?t.attachEvent("onload",s):t.addEventListener("load",s,!1)}("settings.json",{});</script>
<!-- {/literal} END CHAT -->

<button onclick='ThreadsWidget.setLocale("ru")'>RU</button>
Expand Down
4 changes: 2 additions & 2 deletions examples/Locale/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filename": "../../threadswidget-3.33.1.min.js",
"style": "../../threadswidget-3.33.1.min.css",
"filename": "../../threadswidget-3.33.2.min.js",
"style": "../../threadswidget-3.33.2.min.css",
"webchat": {
"locale": "ru",
"package": "FIX_ME",
Expand Down
Binary file added examples/Multibutton/assets/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions examples/Multibutton/assets/edna.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
142 changes: 142 additions & 0 deletions examples/Multibutton/assets/multibutton.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* Стили главного контейнера */
.ednamb-container {
right: 80px;
bottom: 80px;
z-index: 999999999;
position: fixed;
transition: visibility .3s, transform .3s, transform-origin .3s, scale .3s, opacity .3s, bottom .3s, top .3s, left .3s, right .3s;
opacity: 1;
}

/* Стили главного контейнера в скрытом состоянии */
.ednamb-container.ednamb-hide {
visibility: hidden;
transform: translateY(20%);
opacity: 0;
}

/* Стили блока верхних кнопок */
.ednamb-top-buttons {
position: absolute;
right: 0;
bottom: 100px;
display: flex;
flex-direction: column;
align-items: flex-end;
width: max-content;
opacity: 1;
transition: visibility .3s, transform .3s, transform-origin .3s, scale .3s, opacity .3s, bottom .3s, top .3s, left .3s, right .3s;
}

/* Стили блока верхних кнопок в скрытом состоянии */
.ednamb-top-buttons.ednamb-hide {
visibility: hidden;
transform: translateY(20%);
opacity: 0;
}

/* Стили кнопки из блока верхних кнопок */
.ednamb-top-button {
font-family: "Open Sans", Arial, sans-serif;
background-color: rgba(255, 0, 34, .8);
padding: 7px 15px;
border-radius: 20px;
text-transform: lowercase;
color: white;
margin: 5px 0;
display: block;
text-align: center;
text-decoration: none;
font-size: 14px;
}

/* Стили кнопки из блока верхних кнопок при наведении */
.ednamb-top-button:hover {
background-color: rgba(225, 0, 4, .8);
}

/* Стили блока нижних кнопок */
.ednamb-left-buttons {
height: 86px;
position: absolute;
right: 100px;
bottom: 0;
display: flex;
align-items: center;
justify-content: flex-end;
opacity: 1;
transition: visibility .3s, transform .3s, transform-origin .3s, scale .3s, opacity .3s, bottom .3s, top .3s, left .3s, right .3s;
}

/* Стили блока нижних кнопок в скрытом состоянии */
.ednamb-left-buttons.ednamb-hide {
visibility: hidden;
transform: translateX(90px);
opacity: 0;
}

/* Стили кнопки из блока нижних кнопок */
.ednamb-left-button {
background-color: rgba(170, 170, 170, .9);
background-size: 20px;
background-repeat: no-repeat;
background-position: center;
border-radius: 30%;
display: block;
margin: 0 5px;
width: 32px;
height: 32px;
}

/* Стили кнопки из блока нижних кнопок при наведении */
.ednamb-left-button:hover {
background-color: rgba(150, 150, 150, 1);
}

/* Стили главной кнопки */
.ednamb-button {
width: 88px;
height: 86px;
cursor: pointer;
position: absolute;
right: 2px;
bottom: 3px;
background-image: url("button.png");
filter: drop-shadow(4px 6px 2px rgba(0, 0, 0, 0.25));
transition: all .05s;
}

/* Стили главной кнопки в активном состоянии */
.ednamb-button.ednamb-active {
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.25));
right: 0;
bottom: 0;
}

/* Стили мобильной версии */
@media (max-width: 1024px) and (orientation: portrait) {
/* Стили блока верхних кнопок */
.ednamb-top-buttons {
bottom: 135px;
transition-delay: 0s;
}

/* Стили блока верхних кнопок в скрытом состоянии */
.ednamb-top-buttons.ednamb-hide {
transition-delay: .2s;
}

/* Стили блока нижних кнопок */
.ednamb-left-buttons {
bottom: 95px;
height: auto;
right: 0;
transition-delay: .2s;
}

/* Стили блока нижних кнопок в скрытом состоянии */
.ednamb-left-buttons.ednamb-hide {
transform: translateY(30%);
transition-delay: 0s;
}
}
73 changes: 73 additions & 0 deletions examples/Multibutton/assets/multibutton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
function ednaMultiButton(options) {
function onChatButtonClick(e) {
e && e.preventDefault()

container.classList.add(hideClass)
ThreadsWidget.showChat()
onButtonClick()
}

function onButtonClick(e) {
e && e.preventDefault()

const isActive = button.classList.contains(activeClass)

isActive ? topButtons.classList.add(hideClass) : topButtons.classList.remove(hideClass)
isActive ? leftButtons.classList.add(hideClass) : leftButtons.classList.remove(hideClass)
button.classList.toggle(activeClass)
}

const buttonClass = 'ednamb-button'
const topButtonsClass = 'ednamb-top-buttons'
const leftButtonsClass = 'ednamb-left-buttons'
const hideClass = 'ednamb-hide'
const activeClass = 'ednamb-active'
const containerId = options.containerId || 'ednamb-container'
const leftButtonsList = options.leftButtons || []
const topButtonsList = options.topButtons || []
const container = document.getElementById(containerId)
const button = container.querySelector('.' + buttonClass)
const topButtons = container.querySelector('.' + topButtonsClass)
const leftButtons = container.querySelector('.' + leftButtonsClass)

button.addEventListener('click', onButtonClick)

topButtonsList.forEach(function(item) {
const a = document.createElement('a')

a.href = item.url
a.textContent = item.text
a.classList.add('ednamb-top-button')
topButtons.appendChild(a)
})

leftButtonsList.forEach(function(item) {
const a = document.createElement('a')

a.style.backgroundImage = 'url("' + item.image + '")'
a.classList.add('ednamb-left-button')

if(item.url) {
a.href = item.url
a.target = '_blank'
} else {
a.href = '#'
a.addEventListener('click', onChatButtonClick)
}

leftButtons.appendChild(a)
})

const hasThreads = leftButtonsList.findIndex(function(b) {
return !b.url
}) >= 0

// функция обратного вызова при закрытии чата
if(hasThreads && ThreadsWidget) {
ThreadsWidget.onLoad(function() {
ThreadsWidget.on('hideChat', function() {
container.classList.remove(hideClass)
})
})
}
}
Loading

0 comments on commit 3a7826d

Please sign in to comment.