WhatsApp me - Version 4.1.15

Version Description

  • NEW: WordPress 5.8 tested & updated.
  • FIX RTL text align right.
  • FIX Send event to all GA4 properties.
  • Prevent faux WhatsApp clicks when chat window is showed automatically
Download this release

Release Info

Developer pacotole
Plugin Icon 128x128 WhatsApp me
Version 4.1.15
Comparing to
See all releases

Code changes from version 4.1.14 to 4.1.15

README.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: creapuntome, pacotole, davidlillo, monillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
  Requires at least: 3.5.0
6
- Tested up to: 5.7
7
  Requires PHP: 5.3
8
- Stable tag: 4.1.14
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -217,6 +217,12 @@ There is a Javascript event that Join.chat triggers automatically before launch
217
 
218
  == Changelog ==
219
 
 
 
 
 
 
 
220
  = 4.1.14 =
221
  * **NEW:** Enhanced telephone input scripts now are included in plugin and self-hosted.
222
 
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
  Requires at least: 3.5.0
6
+ Tested up to: 5.8
7
  Requires PHP: 5.3
8
+ Stable tag: 4.1.15
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
217
 
218
  == Changelog ==
219
 
220
+ = 4.1.15 =
221
+ * **NEW:** WordPress 5.8 tested & updated.
222
+ * FIX RTL text align right.
223
+ * FIX Send event to all GA4 properties.
224
+ * Prevent faux WhatsApp clicks when chat window is showed automatically
225
+
226
  = 4.1.14 =
227
  * **NEW:** Enhanced telephone input scripts now are included in plugin and self-hosted.
228
 
admin/class-joinchat-admin.php CHANGED
@@ -149,6 +149,7 @@ class JoinChatAdmin {
149
  * Register the stylesheets for the admin area.
150
  *
151
  * @since 3.0.0
 
152
  * @param string $hook The id of the page.
153
  * @return void
154
  */
@@ -156,7 +157,7 @@ class JoinChatAdmin {
156
 
157
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
158
 
159
- wp_register_style( 'joinchat-admin', plugins_url( "css/joinchat{$min}.css", __FILE__ ), array(), $this->version, 'all' );
160
 
161
  if ( $this->enhanced_phone ) {
162
  wp_register_style( 'intl-tel-input', plugins_url( "css/intlTelInput{$min}.css", __FILE__ ), array(), $this->enhanced_phone, 'all' );
@@ -831,7 +832,6 @@ class JoinChatAdmin {
831
  wp_enqueue_media();
832
  // Enqueue assets
833
  wp_enqueue_script( 'joinchat-admin' );
834
- wp_enqueue_style( 'wp-color-picker' );
835
  wp_enqueue_style( 'joinchat-admin' );
836
 
837
  if ( $this->enhanced_phone ) {
149
  * Register the stylesheets for the admin area.
150
  *
151
  * @since 3.0.0
152
+ * @since 4.1.15 Added color picker dependency.
153
  * @param string $hook The id of the page.
154
  * @return void
155
  */
157
 
158
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
159
 
160
+ wp_register_style( 'joinchat-admin', plugins_url( "css/joinchat{$min}.css", __FILE__ ), array( 'wp-color-picker' ), $this->version, 'all' );
161
 
162
  if ( $this->enhanced_phone ) {
163
  wp_register_style( 'intl-tel-input', plugins_url( "css/intlTelInput{$min}.css", __FILE__ ), array(), $this->enhanced_phone, 'all' );
832
  wp_enqueue_media();
833
  // Enqueue assets
834
  wp_enqueue_script( 'joinchat-admin' );
 
835
  wp_enqueue_style( 'joinchat-admin' );
836
 
837
  if ( $this->enhanced_phone ) {
includes/class-joinchat.php CHANGED
@@ -117,7 +117,7 @@ class JoinChat {
117
  $plugin_i18n = new JoinChat_i18n();
118
 
119
  // No delegate to $this->loader, use WordPress add_action
120
- add_action( 'plugins_loaded', array( $plugin_i18n, 'load_plugin_textdomain' ) );
121
 
122
  }
123
 
117
  $plugin_i18n = new JoinChat_i18n();
118
 
119
  // No delegate to $this->loader, use WordPress add_action
120
+ add_action( 'init', array( $plugin_i18n, 'load_plugin_textdomain' ) );
121
 
122
  }
123
 
joinchat.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
- * Version: 4.1.14
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
@@ -26,7 +26,7 @@ if ( ! defined( 'WPINC' ) ) {
26
  /**
27
  * Define constants.
28
  */
29
- define( 'JOINCHAT_VERSION', '4.1.14' );
30
  define( 'JOINCHAT_FILE', __FILE__ );
31
  define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
32
  define( 'JOINCHAT_BASENAME', plugin_basename( JOINCHAT_FILE ) );
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
+ * Version: 4.1.15
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
26
  /**
27
  * Define constants.
28
  */
29
+ define( 'JOINCHAT_VERSION', '4.1.15' );
30
  define( 'JOINCHAT_FILE', __FILE__ );
31
  define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
32
  define( 'JOINCHAT_BASENAME', plugin_basename( JOINCHAT_FILE ) );
public/css/joinchat.css CHANGED
@@ -28,7 +28,9 @@
28
  transition: transform 0.3s ease-in-out;
29
  -webkit-user-select: none;
30
  user-select: none;
 
31
  -webkit-font-smoothing: antialiased;
 
32
  }
33
 
34
  .joinchat *,
@@ -103,10 +105,13 @@
103
  box-shadow: 1px 6px 24px 0 rgba(7, 94, 84, 0.24);
104
  cursor: pointer;
105
  transition: background 0.2s linear;
106
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
107
  will-change: background-color, width;
108
  }
109
 
 
 
 
 
110
  .joinchat__button:hover {
111
  background: #128c7e;
112
  transition: background 1.5s linear;
@@ -117,6 +122,16 @@
117
  transition: none;
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
120
  .joinchat--chatbox .joinchat__button {
121
  background: var(--color);
122
  transition: background 0.2s linear;
@@ -128,20 +143,6 @@
128
  background: var(--hover);
129
  }
130
 
131
- [dir=rtl] .joinchat__button {
132
- flex-direction: row-reverse;
133
- }
134
-
135
- .joinchat--left .joinchat__button {
136
- right: auto;
137
- left: 8px;
138
- flex-direction: row-reverse;
139
- }
140
-
141
- [dir=rtl] .joinchat--left .joinchat__button {
142
- flex-direction: row;
143
- }
144
-
145
  .joinchat__button__open {
146
  width: var(--btn);
147
  height: var(--btn);
@@ -168,6 +169,7 @@
168
  display: block;
169
  width: 100%;
170
  height: 100%;
 
171
  object-fit: cover;
172
  }
173
 
@@ -350,6 +352,10 @@
350
  transition: max-height 0.2s ease-out, opacity 0.4s ease-out, transform 0s linear 0.3s;
351
  }
352
 
 
 
 
 
353
  .joinchat--chatbox .joinchat__box {
354
  opacity: 1;
355
  transform: scale3d(1, 1, 1);
@@ -371,11 +377,10 @@
371
  padding: 0 70px 0 26px;
372
  margin: 0;
373
  background: var(--color);
374
- text-align: left;
375
  }
376
 
377
  [dir=rtl] .joinchat__header {
378
- text-align: right;
379
  }
380
 
381
  .joinchat--dark .joinchat__header {
@@ -413,6 +418,7 @@
413
  color: inherit !important;
414
  text-decoration: none !important;
415
  opacity: 0.9;
 
416
  }
417
 
418
  .joinchat__wa {
@@ -434,13 +440,16 @@
434
  background-size: 12px;
435
  cursor: pointer;
436
  transition: background-color 0.3s ease-out;
437
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
438
  }
439
 
440
  .joinchat__close:hover {
441
  background-color: rgba(0, 0, 0, 0.6);
442
  }
443
 
 
 
 
 
444
  [dir=rtl] .joinchat__close {
445
  right: auto;
446
  left: 24px;
@@ -465,10 +474,6 @@
465
  background: rgba(0, 0, 0, 0);
466
  }
467
 
468
- .joinchat__box__scroll:hover::-webkit-scrollbar-thumb {
469
- background: rgba(0, 0, 0, 0.2);
470
- }
471
-
472
  .joinchat--blur .joinchat__box__scroll {
473
  background: rgba(var(--rgb), 0.2);
474
  -webkit-backdrop-filter: blur(10px);
@@ -479,6 +484,10 @@
479
  background: #1a1a1a;
480
  }
481
 
 
 
 
 
482
  @supports (-webkit-overflow-scrolling: touch) {
483
  .joinchat__box__scroll {
484
  overflow-y: scroll;
28
  transition: transform 0.3s ease-in-out;
29
  -webkit-user-select: none;
30
  user-select: none;
31
+ touch-action: manipulation;
32
  -webkit-font-smoothing: antialiased;
33
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
34
  }
35
 
36
  .joinchat *,
105
  box-shadow: 1px 6px 24px 0 rgba(7, 94, 84, 0.24);
106
  cursor: pointer;
107
  transition: background 0.2s linear;
 
108
  will-change: background-color, width;
109
  }
110
 
111
+ [dir=rtl] .joinchat__button {
112
+ flex-direction: row-reverse;
113
+ }
114
+
115
  .joinchat__button:hover {
116
  background: #128c7e;
117
  transition: background 1.5s linear;
122
  transition: none;
123
  }
124
 
125
+ .joinchat--left .joinchat__button {
126
+ right: auto;
127
+ left: 8px;
128
+ flex-direction: row-reverse;
129
+ }
130
+
131
+ [dir=rtl] .joinchat--left .joinchat__button {
132
+ flex-direction: row;
133
+ }
134
+
135
  .joinchat--chatbox .joinchat__button {
136
  background: var(--color);
137
  transition: background 0.2s linear;
143
  background: var(--hover);
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  .joinchat__button__open {
147
  width: var(--btn);
148
  height: var(--btn);
169
  display: block;
170
  width: 100%;
171
  height: 100%;
172
+ -o-object-fit: cover;
173
  object-fit: cover;
174
  }
175
 
352
  transition: max-height 0.2s ease-out, opacity 0.4s ease-out, transform 0s linear 0.3s;
353
  }
354
 
355
+ [dir=rtl] .joinchat__box {
356
+ text-align: right;
357
+ }
358
+
359
  .joinchat--chatbox .joinchat__box {
360
  opacity: 1;
361
  transform: scale3d(1, 1, 1);
377
  padding: 0 70px 0 26px;
378
  margin: 0;
379
  background: var(--color);
 
380
  }
381
 
382
  [dir=rtl] .joinchat__header {
383
+ padding: 0 26px 0 70px;
384
  }
385
 
386
  .joinchat--dark .joinchat__header {
418
  color: inherit !important;
419
  text-decoration: none !important;
420
  opacity: 0.9;
421
+ filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
422
  }
423
 
424
  .joinchat__wa {
440
  background-size: 12px;
441
  cursor: pointer;
442
  transition: background-color 0.3s ease-out;
 
443
  }
444
 
445
  .joinchat__close:hover {
446
  background-color: rgba(0, 0, 0, 0.6);
447
  }
448
 
449
+ .joinchat__close:active {
450
+ background-color: rgba(0, 0, 0, 0.7);
451
+ }
452
+
453
  [dir=rtl] .joinchat__close {
454
  right: auto;
455
  left: 24px;
474
  background: rgba(0, 0, 0, 0);
475
  }
476
 
 
 
 
 
477
  .joinchat--blur .joinchat__box__scroll {
478
  background: rgba(var(--rgb), 0.2);
479
  -webkit-backdrop-filter: blur(10px);
484
  background: #1a1a1a;
485
  }
486
 
487
+ .joinchat__box__scroll:hover::-webkit-scrollbar-thumb {
488
+ background: rgba(0, 0, 0, 0.2);
489
+ }
490
+
491
  @supports (-webkit-overflow-scrolling: touch) {
492
  .joinchat__box__scroll {
493
  overflow-y: scroll;
public/css/joinchat.min.css CHANGED
@@ -1 +1 @@
1
- .joinchat{--bottom:20px;--sep:20px;--header:70px;--btn:60px;--vh:100vh;--red:37;--green:211;--blue:102;--rgb:var(--red),var(--green),var(--blue);--color:rgb(var(--rgb));--dark:rgb(calc(var(--red) - 75),calc(var(--green) - 75),calc(var(--blue) - 75));--hover:rgb(calc(var(--red) + 50),calc(var(--green) + 50),calc(var(--blue) + 50));--bg:rgba(var(--rgb),0.04);--tolerance:210;--bw:calc((var(--red)*0.2126 + var(--green)*0.7152 + var(--blue)*0.0722 - var(--tolerance))*-100000);--text:rgba(var(--bw),var(--bw),var(--bw),clamp(0.7,var(--bw),1));--msg:var(--color);position:fixed;z-index:1000;right:var(--sep);bottom:var(--bottom);color:var(--text);font:normal normal normal 16px/1.625em -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:0;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;-webkit-user-select:none;user-select:none;-webkit-font-smoothing:antialiased}.joinchat *,.joinchat :after,.joinchat :before{box-sizing:border-box}.joinchat:not(.joinchat--show)>div{display:none}.joinchat--show{transform:scaleX(1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.joinchat.joinchat--left{right:auto;left:var(--sep)}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat{--bottom:6px;--sep:6px;--header:55px}}@media (max-width:767px){.joinchat.joinchat--footer-bar{--bottom:76px}}.joinchat.joinchat--dark{--msg:var(--dark)}@supports not (width:clamp(1px,1%,10px)){.joinchat{--text:rgba(var(--bw),var(--bw),var(--bw),0.9)}}@media (color-index:48){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}.joinchat__button{display:flex;flex-direction:row;position:absolute;z-index:2;bottom:8px;right:8px;height:var(--btn);min-width:var(--btn);max-width:95vw;background:#25d366;color:inherit;border-radius:calc(var(--btn)/2);box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background .2s linear;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:background-color,width}.joinchat__button:hover{background:#128c7e;transition:background 1.5s linear}.joinchat__button:active{background:#128c7e;transition:none}.joinchat--chatbox .joinchat__button{background:var(--color);transition:background .2s linear;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.joinchat--chatbox .joinchat__button:active,.joinchat--chatbox .joinchat__button:hover{background:var(--hover)}[dir=rtl] .joinchat__button{flex-direction:row-reverse}.joinchat--left .joinchat__button{right:auto;left:8px;flex-direction:row-reverse}[dir=rtl] .joinchat--left .joinchat__button{flex-direction:row}.joinchat__button__open{width:var(--btn);height:var(--btn);background:transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E %3Cpath fill='%23fff' d='M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z'/%3E %3C/svg%3E") 50% no-repeat;background-size:60%}.joinchat--chatbox .joinchat__button__open{display:none}.joinchat__button__image{position:absolute;top:1px;right:1px;width:calc(var(--btn) - 2px);height:calc(var(--btn) - 2px);border-radius:50%;overflow:hidden;opacity:0}.joinchat__button__image img{display:block;width:100%;height:100%;object-fit:cover}.joinchat--show .joinchat__button__image{animation:joinchat_image_loop 20s linear 5s infinite normal both}.joinchat--image .joinchat__button__image{opacity:1;animation:none}.joinchat--chatbox .joinchat__button__image{display:none}.joinchat__button__send{display:none;width:var(--btn);height:var(--btn);max-width:var(--btn);padding:12px 11px 12px 13px;margin:0;flex-shrink:0}.joinchat--chatbox .joinchat__button__send{display:block}.joinchat__button__send path{fill:none!important;stroke:var(--text)!important}.joinchat__button__send .joinchat_svg__plain{stroke-dasharray:1097;stroke-dashoffset:1097;animation:joinchat_plain 6s .2s ease-in-out infinite}.joinchat__button__send .joinchat_svg__chat{stroke-dasharray:1020;stroke-dashoffset:1020;animation:joinchat_chat 6s 3.2s ease-in-out infinite}.joinchat__button__sendtext{padding:0;max-width:0;font-weight:600;line-height:var(--btn);white-space:nowrap;opacity:0;overflow:hidden;transition:none}.joinchat--chatbox .joinchat__button__sendtext{padding:0 4px 0 24px;max-width:200px;opacity:1;transition:max-width .2s linear,opacity .4s ease-out .2s}.joinchat--chatbox.joinchat--left .joinchat__button__sendtext{padding:0 24px 0 4px}.joinchat__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;color:#fff;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.joinchat__badge.joinchat__badge--in{animation:joinchat_badge_in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.joinchat__badge.joinchat__badge--out{animation:joinchat_badge_out .4s cubic-bezier(.215,.61,.355,1) 1 both}.joinchat__tooltip{position:absolute;top:14px;right:76px;max-width:calc(100vw - 105px);height:32px;padding:0 14px;border:none;border-radius:16px;background:#fff;color:rgba(0,0,0,.8);line-height:31px;white-space:nowrap;opacity:0;transition:opacity .3s ease-out .4s;filter:drop-shadow(0 1px 4px rgba(0,0,0,.4));transform:translateZ(0);pointer-events:none}.joinchat__tooltip:after{content:"";display:block;position:absolute;top:10px;right:-6px;border:8px solid transparent;border-width:6px 0 6px 8px;border-left-color:#fff}.joinchat__tooltip div{overflow:hidden;text-overflow:ellipsis}.joinchat--tooltip .joinchat__tooltip{animation:joinchat_tootlip 20s linear 5s 1 normal both}@media (hover:hover){.joinchat__button:hover .joinchat__tooltip{opacity:1;animation:none;transition:opacity .2s}}.joinchat--chatbox .joinchat__tooltip{display:none}.joinchat--left .joinchat__tooltip{right:auto;left:76px}.joinchat--left .joinchat__tooltip:after{left:-6px;right:auto;border-color:transparent;border-width:6px 8px 6px 0;border-right-color:#fff}.joinchat__box{display:flex;flex-direction:column;position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - var(--sep)*2);max-width:400px;min-height:170px;max-height:calc(var(--vh) - var(--bottom) - var(--sep));border-radius:32px;background:transparent;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);text-align:left;overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:max-height .2s ease-out,opacity .4s ease-out,transform 0s linear .3s}.joinchat--chatbox .joinchat__box{opacity:1;transform:scaleX(1);transition:max-height .2s ease-out,opacity .2s ease-out,transform 0s linear}.joinchat--left .joinchat__box{right:auto;left:0}.joinchat__header{display:flex;flex-flow:row;align-items:center;position:relative;flex-shrink:0;height:var(--header);padding:0 70px 0 26px;margin:0;background:var(--color);text-align:left}[dir=rtl] .joinchat__header{text-align:right}.joinchat--dark .joinchat__header{background:var(--dark)}.joinchat__header__text{font-size:19px;font-weight:600;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.8}.joinchat__powered{font-size:11px;line-height:18px;color:inherit!important;text-decoration:none!important;fill:currentColor;opacity:.8}.joinchat__powered svg{display:inline-block;width:auto;height:18px;vertical-align:-30%}.joinchat__powered:active,.joinchat__powered:hover{color:inherit!important;text-decoration:none!important;opacity:.9}.joinchat__wa{height:28px;width:auto;fill:currentColor;opacity:.8}.joinchat__close{position:absolute;top:50%;right:24px;width:34px;height:34px;margin-top:-16px;border-radius:50%;background:rgba(0,0,0,.4) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E %3Cpath d='M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z'/%3E %3C/svg%3E") 50% no-repeat;background-size:12px;cursor:pointer;transition:background-color .3s ease-out;-webkit-tap-highlight-color:rgba(0,0,0,0)}.joinchat__close:hover{background-color:rgba(0,0,0,.6)}[dir=rtl] .joinchat__close{right:auto;left:24px}.joinchat__box__scroll{padding:20px 0 70px;padding-bottom:calc(var(--btn) + 10px);background:#fff linear-gradient(0deg,var(--bg),var(--bg));overflow-x:hidden;overflow-y:auto;will-change:scroll-position}.joinchat__box__scroll::-webkit-scrollbar{width:5px;background:transparent}.joinchat__box__scroll::-webkit-scrollbar-thumb{border-radius:3px;background:transparent}.joinchat__box__scroll:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.joinchat--blur .joinchat__box__scroll{background:rgba(var(--rgb),.2);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.joinchat--dark .joinchat__box__scroll{background:#1a1a1a}@supports (-webkit-overflow-scrolling:touch){.joinchat__box__scroll{overflow-y:scroll;-webkit-overflow-scrolling:touch}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__header__text{font-size:17px}.joinchat__close{margin-top:-14px;width:28px;height:28px}.joinchat__box__scroll{padding-top:15px}}@media (color-index:48){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}.joinchat__message{position:relative;min-height:60px;padding:17px 20px;margin:0 26px 26px;border-radius:32px;background:#fff;color:#4a4a4a;filter:drop-shadow(0 1px 2px rgba(0,0,0,.3));transform:translateZ(0)}.joinchat__message:before{content:"";display:block;position:absolute;bottom:20px;left:-15px;width:17px;height:25px;background:inherit;-webkit-clip-path:var(--peak,url(#joinchat__message__peak));clip-path:var(--peak,url(#joinchat__message__peak))}.joinchat--dark .joinchat__message{background:#505050;color:#d8d8d8}@media (color-index:48){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__message{padding:18px 16px;line-height:24px;margin:0 20px 20px}}@keyframes joinchat_badge_in{0%{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes joinchat_badge_out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes joinchat_plain{0%,50%,to{stroke-dashoffset:1097}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_chat{0%,50%,to{stroke-dashoffset:1020}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_image_loop{0%{opacity:0}3%,20%{opacity:1}25%,to{opacity:0}}@keyframes joinchat_tootlip{0%{opacity:0;transform:scaleY(0)}1%,20%{opacity:1;transform:scaleY(1)}25%,to{opacity:0;transform:scaleY(1)}}
1
+ .joinchat{--bottom:20px;--sep:20px;--header:70px;--btn:60px;--vh:100vh;--red:37;--green:211;--blue:102;--rgb:var(--red),var(--green),var(--blue);--color:rgb(var(--rgb));--dark:rgb(calc(var(--red) - 75),calc(var(--green) - 75),calc(var(--blue) - 75));--hover:rgb(calc(var(--red) + 50),calc(var(--green) + 50),calc(var(--blue) + 50));--bg:rgba(var(--rgb),0.04);--tolerance:210;--bw: calc((var(--red)*0.2126 + var(--green)*0.7152 + var(--blue)*0.0722 - var(--tolerance))*-100000);--text:rgba(var(--bw),var(--bw),var(--bw),clamp(0.7,var(--bw),1));--msg:var(--color);position:fixed;z-index:1000;right:var(--sep);bottom:var(--bottom);color:var(--text);font:normal normal normal 16px/1.625em -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:0;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;-webkit-user-select:none;user-select:none;touch-action:manipulation;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}.joinchat *,.joinchat :after,.joinchat :before{box-sizing:border-box}.joinchat:not(.joinchat--show)>div{display:none}.joinchat--show{transform:scaleX(1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.joinchat.joinchat--left{right:auto;left:var(--sep)}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat{--bottom:6px;--sep:6px;--header:55px}}@media (max-width:767px){.joinchat.joinchat--footer-bar{--bottom:76px}}.joinchat.joinchat--dark{--msg:var(--dark)}@supports not (width:clamp(1px,1%,10px)){.joinchat{--text:rgba(var(--bw),var(--bw),var(--bw),0.9)}}@media (color-index:48){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}.joinchat__button{display:flex;flex-direction:row;position:absolute;z-index:2;bottom:8px;right:8px;height:var(--btn);min-width:var(--btn);max-width:95vw;background:#25d366;color:inherit;border-radius:calc(var(--btn)/2);box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background .2s linear;will-change:background-color,width}[dir=rtl] .joinchat__button{flex-direction:row-reverse}.joinchat__button:hover{background:#128c7e;transition:background 1.5s linear}.joinchat__button:active{background:#128c7e;transition:none}.joinchat--left .joinchat__button{right:auto;left:8px;flex-direction:row-reverse}[dir=rtl] .joinchat--left .joinchat__button{flex-direction:row}.joinchat--chatbox .joinchat__button{background:var(--color);transition:background .2s linear;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.joinchat--chatbox .joinchat__button:active,.joinchat--chatbox .joinchat__button:hover{background:var(--hover)}.joinchat__button__open{width:var(--btn);height:var(--btn);background:transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E %3Cpath fill='%23fff' d='M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z'/%3E %3C/svg%3E") 50% no-repeat;background-size:60%}.joinchat--chatbox .joinchat__button__open{display:none}.joinchat__button__image{position:absolute;top:1px;right:1px;width:calc(var(--btn) - 2px);height:calc(var(--btn) - 2px);border-radius:50%;overflow:hidden;opacity:0}.joinchat__button__image img{display:block;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.joinchat--show .joinchat__button__image{animation:joinchat_image_loop 20s linear 5s infinite normal both}.joinchat--image .joinchat__button__image{opacity:1;animation:none}.joinchat--chatbox .joinchat__button__image{display:none}.joinchat__button__send{display:none;width:var(--btn);height:var(--btn);max-width:var(--btn);padding:12px 11px 12px 13px;margin:0;flex-shrink:0}.joinchat--chatbox .joinchat__button__send{display:block}.joinchat__button__send path{fill:none!important;stroke:var(--text)!important}.joinchat__button__send .joinchat_svg__plain{stroke-dasharray:1097;stroke-dashoffset:1097;animation:joinchat_plain 6s .2s ease-in-out infinite}.joinchat__button__send .joinchat_svg__chat{stroke-dasharray:1020;stroke-dashoffset:1020;animation:joinchat_chat 6s 3.2s ease-in-out infinite}.joinchat__button__sendtext{padding:0;max-width:0;font-weight:600;line-height:var(--btn);white-space:nowrap;opacity:0;overflow:hidden;transition:none}.joinchat--chatbox .joinchat__button__sendtext{padding:0 4px 0 24px;max-width:200px;opacity:1;transition:max-width .2s linear,opacity .4s ease-out .2s}.joinchat--chatbox.joinchat--left .joinchat__button__sendtext{padding:0 24px 0 4px}.joinchat__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;color:#fff;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.joinchat__badge.joinchat__badge--in{animation:joinchat_badge_in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.joinchat__badge.joinchat__badge--out{animation:joinchat_badge_out .4s cubic-bezier(.215,.61,.355,1) 1 both}.joinchat__tooltip{position:absolute;top:14px;right:76px;max-width:calc(100vw - 105px);height:32px;padding:0 14px;border:none;border-radius:16px;background:#fff;color:rgba(0,0,0,.8);line-height:31px;white-space:nowrap;opacity:0;transition:opacity .3s ease-out .4s;filter:drop-shadow(0 1px 4px rgba(0,0,0,.4));transform:translateZ(0);pointer-events:none}.joinchat__tooltip:after{content:"";display:block;position:absolute;top:10px;right:-6px;border:8px solid transparent;border-width:6px 0 6px 8px;border-left-color:#fff}.joinchat__tooltip div{overflow:hidden;text-overflow:ellipsis}.joinchat--tooltip .joinchat__tooltip{animation:joinchat_tootlip 20s linear 5s 1 normal both}@media (hover:hover){.joinchat__button:hover .joinchat__tooltip{opacity:1;animation:none;transition:opacity .2s}}.joinchat--chatbox .joinchat__tooltip{display:none}.joinchat--left .joinchat__tooltip{right:auto;left:76px}.joinchat--left .joinchat__tooltip:after{left:-6px;right:auto;border-color:transparent;border-width:6px 8px 6px 0;border-right-color:#fff}.joinchat__box{display:flex;flex-direction:column;position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - var(--sep)*2);max-width:400px;min-height:170px;max-height:calc(var(--vh) - var(--bottom) - var(--sep));border-radius:32px;background:transparent;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);text-align:left;overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:max-height .2s ease-out,opacity .4s ease-out,transform 0s linear .3s}[dir=rtl] .joinchat__box{text-align:right}.joinchat--chatbox .joinchat__box{opacity:1;transform:scaleX(1);transition:max-height .2s ease-out,opacity .2s ease-out,transform 0s linear}.joinchat--left .joinchat__box{right:auto;left:0}.joinchat__header{display:flex;flex-flow:row;align-items:center;position:relative;flex-shrink:0;height:var(--header);padding:0 70px 0 26px;margin:0;background:var(--color)}[dir=rtl] .joinchat__header{padding:0 26px 0 70px}.joinchat--dark .joinchat__header{background:var(--dark)}.joinchat__header__text{font-size:19px;font-weight:600;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.8}.joinchat__powered{font-size:11px;line-height:18px;color:inherit!important;text-decoration:none!important;fill:currentColor;opacity:.8}.joinchat__powered svg{display:inline-block;width:auto;height:18px;vertical-align:-30%}.joinchat__powered:active,.joinchat__powered:hover{color:inherit!important;text-decoration:none!important;opacity:.9;filter:drop-shadow(0 1px 3px rgba(0,0,0,.3))}.joinchat__wa{height:28px;width:auto;fill:currentColor;opacity:.8}.joinchat__close{position:absolute;top:50%;right:24px;width:34px;height:34px;margin-top:-16px;border-radius:50%;background:rgba(0,0,0,.4) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E %3Cpath d='M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z'/%3E %3C/svg%3E") 50% no-repeat;background-size:12px;cursor:pointer;transition:background-color .3s ease-out}.joinchat__close:hover{background-color:rgba(0,0,0,.6)}.joinchat__close:active{background-color:rgba(0,0,0,.7)}[dir=rtl] .joinchat__close{right:auto;left:24px}.joinchat__box__scroll{padding:20px 0 70px;padding-bottom:calc(var(--btn) + 10px);background:#fff linear-gradient(0deg,var(--bg),var(--bg));overflow-x:hidden;overflow-y:auto;will-change:scroll-position}.joinchat__box__scroll::-webkit-scrollbar{width:5px;background:transparent}.joinchat__box__scroll::-webkit-scrollbar-thumb{border-radius:3px;background:transparent}.joinchat--blur .joinchat__box__scroll{background:rgba(var(--rgb),.2);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.joinchat--dark .joinchat__box__scroll{background:#1a1a1a}.joinchat__box__scroll:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}@supports (-webkit-overflow-scrolling:touch){.joinchat__box__scroll{overflow-y:scroll;-webkit-overflow-scrolling:touch}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__header__text{font-size:17px}.joinchat__close{margin-top:-14px;width:28px;height:28px}.joinchat__box__scroll{padding-top:15px}}@media (color-index:48){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}.joinchat__message{position:relative;min-height:60px;padding:17px 20px;margin:0 26px 26px;border-radius:32px;background:#fff;color:#4a4a4a;filter:drop-shadow(0 1px 2px rgba(0,0,0,.3));transform:translateZ(0)}.joinchat__message:before{content:"";display:block;position:absolute;bottom:20px;left:-15px;width:17px;height:25px;background:inherit;-webkit-clip-path:var(--peak,url(#joinchat__message__peak));clip-path:var(--peak,url(#joinchat__message__peak))}.joinchat--dark .joinchat__message{background:#505050;color:#d8d8d8}@media (color-index:48){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__message{padding:18px 16px;line-height:24px;margin:0 20px 20px}}@keyframes joinchat_badge_in{0%{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes joinchat_badge_out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes joinchat_plain{0%,50%,to{stroke-dashoffset:1097}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_chat{0%,50%,to{stroke-dashoffset:1020}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_image_loop{0%{opacity:0}3%,20%{opacity:1}25%,to{opacity:0}}@keyframes joinchat_tootlip{0%{opacity:0;transform:scaleY(0)}1%,20%{opacity:1;transform:scaleY(1)}25%,to{opacity:0;transform:scaleY(1)}}
public/js/joinchat.js CHANGED
@@ -8,6 +8,7 @@
8
  settings: null,
9
  store: null,
10
  chatbox: false,
 
11
  is_mobile: false,
12
  }, joinchat_obj);
13
 
@@ -37,17 +38,16 @@
37
 
38
  // Send Google Analytics custom event (Google Analytics 4 - gtag.js)
39
  if (typeof gtag == 'function' && typeof data_layer == 'object') {
40
- var ga4 = false;
41
- data_layer.forEach(function (item) { if (item[0] == 'config' && item[1].substring(0, 2) == 'G-') ga4 = item[1]; });
42
-
43
- if (ga4) {
44
- gtag('event', action, {
45
- 'event_category': 'JoinChat',
46
- 'event_label': label,
47
- 'send_to': ga4,
48
- 'transport_type': 'beacon',
49
- });
50
- }
51
  }
52
 
53
  // Send Google Tag Manager custom event
@@ -76,6 +76,7 @@
76
  joinchat_obj.chatbox_show = function () {
77
  if (!this.chatbox) {
78
  this.chatbox = true;
 
79
  this.$div.addClass('joinchat--chatbox');
80
 
81
  if (this.settings.message_badge && this.$('.joinchat__badge').hasClass('joinchat__badge--in')) {
@@ -141,21 +142,21 @@
141
  var saved_hashes = (joinchat_obj.store.getItem('joinchat_hashes') || '').split(',').filter(Boolean);
142
  var is_viewed = saved_hashes.indexOf(joinchat_obj.settings.message_hash || 'none') !== -1;
143
 
144
- function chatbox_show() {
145
  clearTimeout(timeoutCTA);
146
  joinchat_obj.chatbox_show();
147
  }
148
 
149
- function chatbox_hide() {
150
  joinchat_obj.save_hash();
151
  joinchat_obj.chatbox_hide();
152
  }
153
 
154
  function joinchat_click() {
155
  if (has_chatbox && !joinchat_obj.chatbox) {
156
- chatbox_show();
157
- } else {
158
- chatbox_hide();
159
  joinchat_obj.open_whatsapp();
160
  }
161
  }
@@ -172,19 +173,19 @@
172
  if (joinchat_obj.settings.message_badge) {
173
  timeoutCTA = setTimeout(function () { joinchat_obj.$('.joinchat__badge').addClass('joinchat__badge--in'); }, button_delay + chat_delay);
174
  } else if (has_pageviews) {
175
- timeoutCTA = setTimeout(chatbox_show, button_delay + chat_delay);
176
  }
177
  }
178
 
179
  // Open Join.chat on mouse over
180
  if (has_chatbox && !joinchat_obj.is_mobile) {
181
  joinchat_obj.$('.joinchat__button')
182
- .on('mouseenter', function () { timeoutHover = setTimeout(chatbox_show, 1500); })
183
  .on('mouseleave', function () { clearTimeout(timeoutHover); });
184
  }
185
 
186
  joinchat_obj.$('.joinchat__button').on('click', joinchat_click);
187
- joinchat_obj.$('.joinchat__close').on('click', chatbox_hide);
188
 
189
  // Only scroll Join.chat message box (no all body)
190
  // TODO: disable also on touch
@@ -233,7 +234,7 @@
233
  $(doc).on('click', '.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]', function (e) {
234
  e.preventDefault();
235
  if (!has_chatbox || $(this).is('.joinchat_app, a[href="#whatsapp"]')) joinchat_obj.open_whatsapp(); // WhatsApp direct
236
- else chatbox_show(); // Open chatbox
237
  });
238
 
239
  // Close chatbox when click on nodes with class "joinchat_close"
@@ -249,7 +250,7 @@
249
  function joinchat_observed(objs) {
250
  $.each(objs, function () {
251
  if (this.intersectionRatio > 0 && (!is_viewed || $(this.target).hasClass('joinchat_force_show'))) {
252
- chatbox_show();
253
  observer.disconnect(); // Only one show for visit
254
  return false;
255
  }
8
  settings: null,
9
  store: null,
10
  chatbox: false,
11
+ showed_at: 0,
12
  is_mobile: false,
13
  }, joinchat_obj);
14
 
38
 
39
  // Send Google Analytics custom event (Google Analytics 4 - gtag.js)
40
  if (typeof gtag == 'function' && typeof data_layer == 'object') {
41
+ data_layer.forEach(function (item) {
42
+ if (item[0] == 'config' && item[1].substring(0, 2) == 'G-') {
43
+ gtag('event', action, {
44
+ 'event_category': 'JoinChat',
45
+ 'event_label': label,
46
+ 'send_to': item[1],
47
+ 'transport_type': 'beacon',
48
+ });
49
+ }
50
+ });
 
51
  }
52
 
53
  // Send Google Tag Manager custom event
76
  joinchat_obj.chatbox_show = function () {
77
  if (!this.chatbox) {
78
  this.chatbox = true;
79
+ this.showed_at = Date.now();
80
  this.$div.addClass('joinchat--chatbox');
81
 
82
  if (this.settings.message_badge && this.$('.joinchat__badge').hasClass('joinchat__badge--in')) {
142
  var saved_hashes = (joinchat_obj.store.getItem('joinchat_hashes') || '').split(',').filter(Boolean);
143
  var is_viewed = saved_hashes.indexOf(joinchat_obj.settings.message_hash || 'none') !== -1;
144
 
145
+ function clear_and_show() {
146
  clearTimeout(timeoutCTA);
147
  joinchat_obj.chatbox_show();
148
  }
149
 
150
+ function save_and_hide() {
151
  joinchat_obj.save_hash();
152
  joinchat_obj.chatbox_hide();
153
  }
154
 
155
  function joinchat_click() {
156
  if (has_chatbox && !joinchat_obj.chatbox) {
157
+ clear_and_show();
158
+ } else if (Date.now() > joinchat_obj.showed_at + 600) { // A bit delay to prevent open WA on auto show
159
+ save_and_hide();
160
  joinchat_obj.open_whatsapp();
161
  }
162
  }
173
  if (joinchat_obj.settings.message_badge) {
174
  timeoutCTA = setTimeout(function () { joinchat_obj.$('.joinchat__badge').addClass('joinchat__badge--in'); }, button_delay + chat_delay);
175
  } else if (has_pageviews) {
176
+ timeoutCTA = setTimeout(clear_and_show, button_delay + chat_delay);
177
  }
178
  }
179
 
180
  // Open Join.chat on mouse over
181
  if (has_chatbox && !joinchat_obj.is_mobile) {
182
  joinchat_obj.$('.joinchat__button')
183
+ .on('mouseenter', function () { timeoutHover = setTimeout(clear_and_show, 1500); })
184
  .on('mouseleave', function () { clearTimeout(timeoutHover); });
185
  }
186
 
187
  joinchat_obj.$('.joinchat__button').on('click', joinchat_click);
188
+ joinchat_obj.$('.joinchat__close').on('click', save_and_hide);
189
 
190
  // Only scroll Join.chat message box (no all body)
191
  // TODO: disable also on touch
234
  $(doc).on('click', '.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]', function (e) {
235
  e.preventDefault();
236
  if (!has_chatbox || $(this).is('.joinchat_app, a[href="#whatsapp"]')) joinchat_obj.open_whatsapp(); // WhatsApp direct
237
+ else clear_and_show(); // Open chatbox
238
  });
239
 
240
  // Close chatbox when click on nodes with class "joinchat_close"
250
  function joinchat_observed(objs) {
251
  $.each(objs, function () {
252
  if (this.intersectionRatio > 0 && (!is_viewed || $(this.target).hasClass('joinchat_force_show'))) {
253
+ clear_and_show();
254
  observer.disconnect(); // Only one show for visit
255
  return false;
256
  }
public/js/joinchat.min.js CHANGED
@@ -1 +1 @@
1
- !function(p,u,d){"use strict";function t(){p(d).trigger("joinchat:starting");var t,o,e=1e3*joinchat_obj.settings.button_delay,n=1e3*joinchat_obj.settings.message_delay,i=!!joinchat_obj.settings.message_hash,a=!!joinchat_obj.$(".joinchat__box").length,s=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,h=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function c(){clearTimeout(o),joinchat_obj.chatbox_show()}function j(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}var _,r,b,l="joinchat--show";function g(){var t=(d.activeElement.type||"").toLowerCase();0<=["date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week"].indexOf(t)?joinchat_obj.chatbox?(joinchat_obj.chatbox_hide(),setTimeout(function(){joinchat_obj.$div.removeClass("joinchat--show")},400)):joinchat_obj.$div.removeClass("joinchat--show"):joinchat_obj.$div.addClass("joinchat--show")}h||i&&n&&!joinchat_obj.settings.message_badge&&s||(l+=" joinchat--tooltip"),setTimeout(function(){joinchat_obj.$div.addClass(l)},e),i&&!h&&n&&(joinchat_obj.settings.message_badge?o=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},e+n):s&&(o=setTimeout(c,e+n))),a&&!joinchat_obj.is_mobile&&joinchat_obj.$(".joinchat__button").on("mouseenter",function(){t=setTimeout(c,1500)}).on("mouseleave",function(){clearTimeout(t)}),joinchat_obj.$(".joinchat__button").on("click",function(){a&&!joinchat_obj.chatbox?c():(j(),joinchat_obj.open_whatsapp())}),joinchat_obj.$(".joinchat__close").on("click",j),joinchat_obj.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();t=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(t<0?1:-1)}),joinchat_obj.is_mobile&&(p(d).on("focus blur","input, textarea",function(t){p(t.target).closest(joinchat_obj.$div).length||(clearTimeout(_),_=setTimeout(g,200))}),p(u).on("resize",function(){clearTimeout(r),r=setTimeout(function(){joinchat_obj.$div[0].style.setProperty("--vh",window.innerHeight+"px")},200)}).trigger("resize")),p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),!a||p(this).is('.joinchat_app, a[href="#whatsapp"]')?joinchat_obj.open_whatsapp():c()}),p(d).on("click",".joinchat_close",function(t){t.preventDefault(),joinchat_obj.chatbox_hide()}),a&&"IntersectionObserver"in u&&(0<(n=p(".joinchat_show, .joinchat_force_show")).length&&(b=new IntersectionObserver(function(t){p.each(t,function(){if(0<this.intersectionRatio&&(!h||p(this.target).hasClass("joinchat_force_show")))return c(),b.disconnect(),!1})}),n.each(function(){b.observe(this)}))),a&&joinchat_obj.$div.css("--peak","url(#joinchat__message__peak)"),p(d).trigger("joinchat:start")}u.joinchat_obj=u.joinchat_obj||{},joinchat_obj=p.extend({$div:null,settings:null,store:null,chatbox:!1,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(t){return p(t||this.$div,this.$div)},joinchat_obj.send_event=function(o,e){o=o||"",e=e||"click";var n,t=u[this.settings.ga_tracker]||u.ga||u.__gaTracker,i=u[this.settings.data_layer]||u.dataLayer;"function"==typeof t&&"function"==typeof t.getAll&&(t("set","transport","beacon"),t.getAll().forEach(function(t){t.send("event","JoinChat",e,o)})),"function"==typeof gtag&&"object"==typeof i&&(n=!1,i.forEach(function(t){"config"==t[0]&&"G-"==t[1].substring(0,2)&&(n=t[1])}),n&&gtag("event",e,{event_category:"JoinChat",event_label:o,send_to:n,transport_type:"beacon"})),"object"==typeof i&&i.push({event:"JoinChat",eventAction:e,eventLabel:o}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:o})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),p(d).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),p(d).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(t,o){t={link:this.whatsapp_link(t||this.settings.telephone,o||this.settings.message_send)},o=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");p(d).trigger("joinchat:open",[t,this.settings]),o.test(t.link)?(this.send_event(t.link),u.open(t.link,"joinchat","noopener")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")};var o,e=(o=function(){if(joinchat_obj.$div=p(".joinchat"),joinchat_obj.$div.length){joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if("object"!=typeof joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0,console.error("Join.chat: can't get settings")}joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?t():p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)}},function(){o&&o.apply(this,arguments),o=null});p(e),p(u).on("load",e),d.addEventListener("DOMContentLoaded",e)}(jQuery,window,document);
1
+ !function(p,d,u){"use strict";function t(){p(u).trigger("joinchat:starting");var t,o,e=1e3*joinchat_obj.settings.button_delay,n=1e3*joinchat_obj.settings.message_delay,i=!!joinchat_obj.settings.message_hash,a=!!joinchat_obj.$(".joinchat__box").length,s=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,h=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function c(){clearTimeout(o),joinchat_obj.chatbox_show()}function j(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}var _,r,b,l="joinchat--show";function g(){var t=(u.activeElement.type||"").toLowerCase();0<=["date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week"].indexOf(t)?joinchat_obj.chatbox?(joinchat_obj.chatbox_hide(),setTimeout(function(){joinchat_obj.$div.removeClass("joinchat--show")},400)):joinchat_obj.$div.removeClass("joinchat--show"):joinchat_obj.$div.addClass("joinchat--show")}h||i&&n&&!joinchat_obj.settings.message_badge&&s||(l+=" joinchat--tooltip"),setTimeout(function(){joinchat_obj.$div.addClass(l)},e),i&&!h&&n&&(joinchat_obj.settings.message_badge?o=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},e+n):s&&(o=setTimeout(c,e+n))),a&&!joinchat_obj.is_mobile&&joinchat_obj.$(".joinchat__button").on("mouseenter",function(){t=setTimeout(c,1500)}).on("mouseleave",function(){clearTimeout(t)}),joinchat_obj.$(".joinchat__button").on("click",function(){a&&!joinchat_obj.chatbox?c():Date.now()>joinchat_obj.showed_at+600&&(j(),joinchat_obj.open_whatsapp())}),joinchat_obj.$(".joinchat__close").on("click",j),joinchat_obj.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();t=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(t<0?1:-1)}),joinchat_obj.is_mobile&&(p(u).on("focus blur","input, textarea",function(t){p(t.target).closest(joinchat_obj.$div).length||(clearTimeout(_),_=setTimeout(g,200))}),p(d).on("resize",function(){clearTimeout(r),r=setTimeout(function(){joinchat_obj.$div[0].style.setProperty("--vh",window.innerHeight+"px")},200)}).trigger("resize")),p(u).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),!a||p(this).is('.joinchat_app, a[href="#whatsapp"]')?joinchat_obj.open_whatsapp():c()}),p(u).on("click",".joinchat_close",function(t){t.preventDefault(),joinchat_obj.chatbox_hide()}),a&&"IntersectionObserver"in d&&(0<(n=p(".joinchat_show, .joinchat_force_show")).length&&(b=new IntersectionObserver(function(t){p.each(t,function(){if(0<this.intersectionRatio&&(!h||p(this.target).hasClass("joinchat_force_show")))return c(),b.disconnect(),!1})}),n.each(function(){b.observe(this)}))),a&&joinchat_obj.$div.css("--peak","url(#joinchat__message__peak)"),p(u).trigger("joinchat:start")}d.joinchat_obj=d.joinchat_obj||{},joinchat_obj=p.extend({$div:null,settings:null,store:null,chatbox:!1,showed_at:0,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(t){return p(t||this.$div,this.$div)},joinchat_obj.send_event=function(o,e){o=o||"",e=e||"click";var t=d[this.settings.ga_tracker]||d.ga||d.__gaTracker,n=d[this.settings.data_layer]||d.dataLayer;"function"==typeof t&&"function"==typeof t.getAll&&(t("set","transport","beacon"),t.getAll().forEach(function(t){t.send("event","JoinChat",e,o)})),"function"==typeof gtag&&"object"==typeof n&&n.forEach(function(t){"config"==t[0]&&"G-"==t[1].substring(0,2)&&gtag("event",e,{event_category:"JoinChat",event_label:o,send_to:t[1],transport_type:"beacon"})}),"object"==typeof n&&n.push({event:"JoinChat",eventAction:e,eventLabel:o}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:o})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.showed_at=Date.now(),this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),p(u).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),p(u).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(t,o){t={link:this.whatsapp_link(t||this.settings.telephone,o||this.settings.message_send)},o=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");p(u).trigger("joinchat:open",[t,this.settings]),o.test(t.link)?(this.send_event(t.link),d.open(t.link,"joinchat","noopener")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")};var o,e=(o=function(){if(joinchat_obj.$div=p(".joinchat"),joinchat_obj.$div.length){joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if("object"!=typeof joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0,console.error("Join.chat: can't get settings")}joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?t():p(u).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)}},function(){o&&o.apply(this,arguments),o=null});p(e),p(d).on("load",e),u.addEventListener("DOMContentLoaded",e)}(jQuery,window,document);