Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 1ad2fbe

Browse files
Nikolai/Minimize elevio call prod (#3279)
* translations: update project_identifier to project_id * translations: update translation files * feat: call elevio on placebo button click * eslint fix * revert unnecessary changes * eslint fix * restart circle-ci * restart circleCi * feat: elevio label translation added * transaltion fix, increase dom selector specificity * empty commit to restart gh-pages * refactor css * hide elevio button on page load * Revert "translations: update project_identifier to project_id" This reverts commit d27e400. * Revert "translations: update translation files" This reverts commit 12760c5. Co-authored-by: Aaron Imming <aaim@protonmail.com>
1 parent 6cf0ce2 commit 1ad2fbe

File tree

6 files changed

+102
-5
lines changed

6 files changed

+102
-5
lines changed

gulp/build.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const getConfig = prefix => ({
1414
index_css : `<link href="css/${getManifest('index.css')}" rel="stylesheet" />`,
1515
bot_css : `<link href="css/${getManifest('bot.css')}" rel="stylesheet" />`,
1616
binary_style_img: 'image/binary-style',
17-
elevio_script :
18-
'<script>!function(e,l,v,i,o,n){e[i]||(e[i]={}),e[i].account_id=n;var g,h;g=l.createElement(v),g.type="text/javascript",g.async=1,g.src=o+n,h=l.getElementsByTagName(v)[0],h.parentNode.insertBefore(g,h);e[i].q=[];e[i].on=function(z,y){e[i].q.push([z,y])}}(window,document,"script","_elev","https://cdn.elev.io/sdk/bootloader/v4/elevio-bootloader.js?cid=","5bbc2de0b7365");</script>',
19-
gtm_iframe:
17+
gtm_iframe :
2018
'<!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P97C2DZ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) -->',
2119
});
2220

src/common/elevio.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,41 @@ import { translate } from '../common/i18n';
55
import { getLanguage } from './lang';
66

77
const Elevio = (() => {
8+
const elShellId = 'elevio-shell';
9+
let elShell;
10+
let elBtnLabel;
11+
const accountId = '5bbc2de0b7365';
12+
const elevioScript = `https://cdn.elev.io/sdk/bootloader/v4/elevio-bootloader.js?cid=${accountId}`;
13+
814
const init = () => {
15+
elShell = document.getElementById(elShellId);
16+
elBtnLabel = elShell.querySelector('span.text');
17+
elBtnLabel.innerText = translate('NEED HELP?');
18+
elShell.classList.remove('invisible');
19+
elShell.addEventListener('click', () => injectElevio(true));
20+
};
21+
22+
const injectElevio = (isOpen = false) => {
23+
window._elev = {}; // eslint-disable-line no-underscore-dangle
24+
window._elev.account_id = accountId; // eslint-disable-line no-underscore-dangle
25+
26+
const script = document.createElement('script');
27+
script.type = 'text/javascript';
28+
script.async = 1;
29+
script.src = elevioScript;
30+
script.id = 'loaded-elevio-script';
31+
document.body.appendChild(script);
32+
33+
window._elev.q = []; // eslint-disable-line no-underscore-dangle
34+
window._elev.on = (z, y) => {
35+
// eslint-disable-line no-underscore-dangle
36+
window._elev.q.push([z, y]); // eslint-disable-line no-underscore-dangle
37+
};
38+
39+
script.onload = () => loadElevio(isOpen);
40+
};
41+
42+
const loadElevio = (isOpen = false) => {
943
if (!window._elev) return; // eslint-disable-line no-underscore-dangle
1044

1145
// eslint-disable-next-line no-underscore-dangle
@@ -29,10 +63,15 @@ const Elevio = (() => {
2963
}
3064

3165
elev.setSettings({
32-
page_url: `${document.location.protocol}//${document.location.hostname}${document.location.pathname}`,
66+
disablePushState: true,
67+
page_url : `${document.location.protocol}//${document.location.hostname}${document.location.pathname}`,
3368
});
3469
setUserInfo(elev);
3570
setTranslations(elev);
71+
72+
if (isOpen) {
73+
elev.open();
74+
}
3675
});
3776
};
3877

static/css/_elevio.scss

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#elevio-shell {
2+
height: 60px;
3+
min-width: 60px;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
background-color: $brand-orange;
8+
position: fixed;
9+
right: 20px !important;
10+
bottom: 20px !important;
11+
border-radius: 100px;
12+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.15);
13+
transition: box-shadow 0.3s ease-in-out;
14+
cursor: pointer;
15+
z-index: 10000 !important;
16+
17+
&:hover {
18+
.text {
19+
max-width: 1000px;
20+
padding: 0 25px;
21+
}
22+
}
23+
.icon {
24+
float: right;
25+
padding: 0 15px;
26+
transform: translateY(2px);
27+
28+
svg {
29+
fill: $white;
30+
height: 30px !important;
31+
width: 30px !important;
32+
}
33+
}
34+
.text {
35+
float: left;
36+
display: inline-block;
37+
padding: 0;
38+
line-height: 60px;
39+
overflow: hidden;
40+
white-space: nowrap;
41+
max-width: 0;
42+
transition: max-width 0.1s ease, padding 0.1s ease;
43+
color: $white;
44+
font-size: 13px;
45+
}
46+
}

static/css/bot.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import 'toolbox';
88
@import 'reality-check';
99
@import 'tour';
10+
@import 'elevio';
1011

1112
* {
1213
box-sizing: border-box;

templates/bot.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<audio id="error" src="sound/out-of-bounds.ogg" autostart="false"></audio>
179179
<audio id="severe-error" src="sound/i-am-being-serious.ogg" autostart="false"></audio>
180180
{{> bundle}} {{> bot}}
181-
{{> elevio_script }}
181+
{{> ../templates/partials/elevio }}
182182
{{> gtm_iframe }}
183183
<div class="notifyjs-corner" style="bottom: 0px; right: 0px;"></div>
184184
<div class="notifyjs-corner" style="bottom: 0px; left: 0px;"></div>

templates/partials/elevio.mustache

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div id='elevio-shell' class='invisible'>
2+
<span class='text'></span>
3+
<span class='icon'>
4+
<svg viewBox="0 0 74.2 74.2">
5+
<g>
6+
<path d="M37.1,74.2C16.7,74.2,0,57.6,0,37.1S16.7,0,37.1,0s37.1,16.7,37.1,37.1S57.6,74.2,37.1,74.2z M37.1,4.8C19.3,4.8,4.8,19.3,4.8,37.1c0,17.8,14.5,32.3,32.3,32.3s32.3-14.5,32.3-32.3C69.4,19.3,54.9,4.8,37.1,4.8z"/>
7+
<g>
8+
<path id="XMLID_17_" d="M29.4,22.7c1.9-2.1,4.6-3.1,8-3.1c3.1,0,5.6,0.9,7.5,2.6s2.8,4,2.8,6.7c0,1.7-0.3,3-1,4 c-0.7,1-2.1,2.6-4.2,4.6c-1.5,1.5-2.5,2.7-3,3.7c-0.3,0.7-0.5,1.5-0.6,2.6c-0.1,1.1-1,1.9-2.1,1.9h0c-1.2,0-2.2-1-2.1-2.3 c0.1-1.2,0.4-2.3,0.7-3.1c0.5-1.4,1.7-2.9,3.6-4.7l1.9-1.9c0.6-0.5,1-1.1,1.4-1.7c0.6-1,1-2.1,1-3.2c0-1.5-0.5-2.9-1.4-4 c-0.9-1.1-2.5-1.7-4.6-1.7c-2.7,0-4.5,1-5.5,2.9c-0.4,0.7-0.7,1.7-0.8,2.8c-0.1,1-1,1.8-2.1,1.8h0c-1.3,0-2.3-1.1-2.1-2.4 C27.1,26.2,28,24.3,29.4,22.7z M36.9,49.7L36.9,49.7c1.3,0,2.3,1,2.3,2.3v0.2c0,1.3-1,2.3-2.3,2.3h0c-1.3,0-2.3-1-2.3-2.3V52 C34.5,50.7,35.6,49.7,36.9,49.7z" className="st0"/>
9+
</g>
10+
</g>
11+
</svg>
12+
</span>
13+
</div>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy