Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty - Version 2.4.7

Version Description

Infrastructure improvements

Download this release

Release Info

Developer galdub
Plugin Icon wp plugin Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty
Version 2.4.7
Comparing to
See all releases

Code changes from version 2.4.6 to 2.4.7

Files changed (63) hide show
  1. {assets → admin/assets}/css/admin-cht-style.css +0 -0
  2. {assets → admin/assets}/css/cht-style.css +6 -0
  3. {assets → admin/assets}/css/cht-widget.css +0 -0
  4. {assets → admin/assets}/css/spectrum.min.css +0 -0
  5. {assets → admin/assets}/css/src/_channels.less +0 -0
  6. {assets → admin/assets}/css/src/_file-input.less +0 -0
  7. {assets → admin/assets}/css/src/_icon.less +0 -0
  8. {assets → admin/assets}/css/src/_main.less +0 -0
  9. {assets → admin/assets}/css/src/_sticky-preview.less +0 -0
  10. {assets → admin/assets}/css/src/_variables.less +0 -0
  11. {assets → admin/assets}/css/src/_widget-icon__block.less +0 -0
  12. {assets → admin/assets}/css/src/cht-style.less +0 -0
  13. {assets → admin/assets}/fonts/icomoon.svg +0 -0
  14. {assets → admin/assets}/fonts/icomoon.ttf +0 -0
  15. {assets → admin/assets}/fonts/icomoon.woff +0 -0
  16. {assets → admin/assets}/images/arrow.png +0 -0
  17. {assets → admin/assets}/images/bg.svg +0 -0
  18. {assets → admin/assets}/images/chaty-default.png +0 -0
  19. {icon → admin/assets/images}/chaty.svg +0 -0
  20. {assets → admin/assets}/images/icon-check-purple.svg +0 -0
  21. {assets → admin/assets}/images/icon-check-white.svg +0 -0
  22. {assets → admin/assets}/images/icon-check.svg +0 -0
  23. {assets → admin/assets}/images/logo.svg +0 -0
  24. {assets → admin/assets}/images/move-icon.png +0 -0
  25. {assets → admin/assets}/images/new_widget_bg.png +0 -0
  26. {assets → admin/assets}/images/new_widget_img.png +0 -0
  27. {assets → admin/assets}/images/owner.png +0 -0
  28. {assets → admin/assets}/images/payment.png +0 -0
  29. {assets → admin/assets}/images/premio-owner.png +0 -0
  30. {assets → admin/assets}/images/rocket.svg +0 -0
  31. {assets → admin/assets}/images/rpt_recommended.png +0 -0
  32. {assets → admin/assets}/js/cht-scripts-heart.min.js +0 -0
  33. admin/assets/js/cht-scripts.min.js +1623 -0
  34. {assets → admin/assets}/js/fileinput.min.js +0 -0
  35. {assets → admin/assets}/js/jquery.sticky.js +0 -0
  36. {assets → admin/assets}/js/popper.min.js +0 -0
  37. {assets → admin/assets}/js/spectrum.min.js +0 -0
  38. {assets → admin/assets}/package-lock.json +0 -0
  39. admin/class-admin-base.php +166 -183
  40. admin/class-social-icons.php +17 -4
  41. assets/js/cht-front-script.js +0 -533
  42. assets/js/cht-scripts.min.js +0 -646
  43. cht-icons.php +6 -6
  44. {assets/css → css}/chaty-front.css +97 -21
  45. frontend/class-frontend.php +0 -466
  46. includes/class-frontend.php +647 -0
  47. js/cht-front-script.js +619 -0
  48. readme.txt +4 -1
  49. views/admin.php +0 -173
  50. views/admin/admin.php +59 -0
  51. views/admin/channels-section.php +658 -0
  52. views/{modals → admin}/chaty-deactivate-form.php +69 -95
  53. views/{parts → admin}/chaty_widget.php +5 -5
  54. views/{parts/section2.php → admin/customize-widget-section.php} +155 -165
  55. views/{parts → admin}/help.php +1 -1
  56. views/{parts/section3.php → admin/launch-section.php} +1 -0
  57. views/{parts → admin}/trigger-and-target.php +7 -7
  58. views/{update.php → admin/update.php} +0 -0
  59. views/{upgrade.php → admin/upgrade.php} +0 -6
  60. views/modals/token.php +0 -32
  61. views/parts/custom-styles.php +0 -29
  62. views/parts/section1.php +0 -518
  63. views/widget.php +121 -50
{assets → admin/assets}/css/admin-cht-style.css RENAMED
File without changes
{assets → admin/assets}/css/cht-style.css RENAMED
@@ -1726,6 +1726,9 @@ input:checked + .chaty-slider:before {
1726
  .main .form-horizontal__item.hide-show-button.active {
1727
  display: flex;
1728
  }
 
 
 
1729
  .chaty-channels .social-item-box .custom-chaty-image {
1730
  display: none;
1731
  }
@@ -4307,4 +4310,7 @@ span.default-chaty-icon.has-fa-icon svg {
4307
  .preview.mobiel-view .page .chaty-widget .social-item-box {
4308
  height: 24px;
4309
  margin: 0 0 4px 0;
 
 
 
4310
  }
1726
  .main .form-horizontal__item.hide-show-button.active {
1727
  display: flex;
1728
  }
1729
+ .custom-chaty-image {
1730
+ display: none;
1731
+ }
1732
  .chaty-channels .social-item-box .custom-chaty-image {
1733
  display: none;
1734
  }
4310
  .preview.mobiel-view .page .chaty-widget .social-item-box {
4311
  height: 24px;
4312
  margin: 0 0 4px 0;
4313
+ }
4314
+ label.custom-control.custom-radio:before {
4315
+ display: none;
4316
  }
{assets → admin/assets}/css/cht-widget.css RENAMED
File without changes
{assets → admin/assets}/css/spectrum.min.css RENAMED
File without changes
{assets → admin/assets}/css/src/_channels.less RENAMED
File without changes
{assets → admin/assets}/css/src/_file-input.less RENAMED
File without changes
{assets → admin/assets}/css/src/_icon.less RENAMED
File without changes
{assets → admin/assets}/css/src/_main.less RENAMED
File without changes
{assets → admin/assets}/css/src/_sticky-preview.less RENAMED
File without changes
{assets → admin/assets}/css/src/_variables.less RENAMED
File without changes
{assets → admin/assets}/css/src/_widget-icon__block.less RENAMED
File without changes
{assets → admin/assets}/css/src/cht-style.less RENAMED
File without changes
{assets → admin/assets}/fonts/icomoon.svg RENAMED
File without changes
{assets → admin/assets}/fonts/icomoon.ttf RENAMED
File without changes
{assets → admin/assets}/fonts/icomoon.woff RENAMED
File without changes
{assets → admin/assets}/images/arrow.png RENAMED
File without changes
{assets → admin/assets}/images/bg.svg RENAMED
File without changes
{assets → admin/assets}/images/chaty-default.png RENAMED
File without changes
{icon → admin/assets/images}/chaty.svg RENAMED
File without changes
{assets → admin/assets}/images/icon-check-purple.svg RENAMED
File without changes
{assets → admin/assets}/images/icon-check-white.svg RENAMED
File without changes
{assets → admin/assets}/images/icon-check.svg RENAMED
File without changes
{assets → admin/assets}/images/logo.svg RENAMED
File without changes
{assets → admin/assets}/images/move-icon.png RENAMED
File without changes
{assets → admin/assets}/images/new_widget_bg.png RENAMED
File without changes
{assets → admin/assets}/images/new_widget_img.png RENAMED
File without changes
{assets → admin/assets}/images/owner.png RENAMED
File without changes
{assets → admin/assets}/images/payment.png RENAMED
File without changes
{assets → admin/assets}/images/premio-owner.png RENAMED
File without changes
{assets → admin/assets}/images/rocket.svg RENAMED
File without changes
{assets → admin/assets}/images/rpt_recommended.png RENAMED
File without changes
{assets → admin/assets}/js/cht-scripts-heart.min.js RENAMED
File without changes
admin/assets/js/cht-scripts.min.js ADDED
@@ -0,0 +1,1623 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * easyModal.js v1.3.2
3
+ * A minimal jQuery modal that works with your CSS.
4
+ * Author: Flavius Matis - http://flaviusmatis.github.com/
5
+ * URL: https://github.com/flaviusmatis/easyModal.js
6
+ *
7
+ * Copyright 2012, Flavius Matis
8
+ * Released under the MIT license.
9
+ * http://flaviusmatis.github.com/license.html
10
+ */
11
+
12
+ /* jslint browser: true */
13
+ /* global jQuery */
14
+
15
+ jQuery(document).ready(function () {
16
+ var chatyError;
17
+ jQuery("#cht-form").submit(function () {
18
+ set_social_channel_order();
19
+ phoneNumberReg = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
20
+ if (jQuery("#cht-form #Whatsapp").length && jQuery("#cht-form #Whatsapp").val() != "") {
21
+ InputVal = jQuery.trim(jQuery("#cht-form #Whatsapp").val());
22
+ chatyError = check_for_number_chaty(InputVal, "Whatsapp");
23
+ if(chatyError) {
24
+ if(!confirm("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
25
+ jQuery("#cht-form #Whatsapp").focus();
26
+ return false;
27
+ }
28
+ }
29
+ }
30
+ if (jQuery("#cht-form #Phone").length && jQuery("#cht-form #Phone").val() != "") {
31
+ InputVal = jQuery.trim(jQuery("#cht-form #Phone").val());
32
+ chatyError = check_for_number_chaty(InputVal, "Phone");
33
+ if(chatyError) {
34
+ if(!confirm("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
35
+ jQuery("#cht-form #Phone").focus();
36
+ return false;
37
+ }
38
+ }
39
+ }
40
+ if (jQuery("#cht-form #Facebook_Messenger").length && jQuery("#cht-form #Facebook_Messenger").val() != "") {
41
+ faceBookMeReg = /(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
42
+ faceBookReg = /(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
43
+ InputVal = jQuery.trim(jQuery("#Facebook_Messenger").val());
44
+ jQuery("#cht-form #Facebook_Messenger").val(InputVal);
45
+ if (!faceBookReg.test(InputVal) && !faceBookMeReg.test(InputVal)) {
46
+ alert("Please make sure your Facebook page's URL looks like, \nhttps://m.me/YOURPAGE");
47
+ jQuery("#cht-form #Facebook_Messenger").focus();
48
+ return false;
49
+ }
50
+ }
51
+ if (jQuery("#cht-form #SMS").length && jQuery("#cht-form #SMS").val() != "") {
52
+ InputVal = jQuery.trim(jQuery("#cht-form #SMS").val());
53
+ chatyError = check_for_number_chaty(InputVal, "SMS");
54
+ if(chatyError) {
55
+ if(!confirm("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
56
+ jQuery("#cht-form #SMS").focus();
57
+ return false;
58
+ }
59
+ }
60
+ }
61
+ if (jQuery("#cht-form #Viber").length && jQuery("#cht-form #Viber").val() != "") {
62
+ InputVal = jQuery.trim(jQuery("#cht-form #Viber").val());
63
+ chatyError = check_for_number_chaty(InputVal, "Viber");
64
+ if(chatyError) {
65
+ if(!confirm("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
66
+ jQuery("#cht-form #Viber").focus();
67
+ return false;
68
+ }
69
+ }
70
+ }
71
+ errorCount = 0;
72
+ if (jQuery("#chaty-page-options .cht-required").length) {
73
+ jQuery("#chaty-page-options .cht-required").each(function () {
74
+ if (jQuery.trim(jQuery(this).val()) == "") {
75
+ jQuery(this).addClass("cht-input-error");
76
+ errorCount++;
77
+ }
78
+ });
79
+ }
80
+ if (jQuery(".chaty-data-and-time-rules .cht-required").length) {
81
+ jQuery(".chaty-data-and-time-rules .cht-required").each(function () {
82
+ if (jQuery.trim(jQuery(this).val()) == "") {
83
+ jQuery(this).addClass("cht-input-error");
84
+ errorCount++;
85
+ }
86
+ });
87
+ }
88
+ console.log("errorCount: "+ errorCount);
89
+ if (errorCount != 0) {
90
+ return false;
91
+ } else {
92
+ var inputError = 0;
93
+ if(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
94
+ jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
95
+ if(jQuery.trim(jQuery(this).val()) == "") {
96
+ inputError++;
97
+ }
98
+ });
99
+ if(inputError == jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
100
+ if(confirm("You need to fill out at least one channel details for Chaty to show up on your website. Click cancel to keep editing.")) {
101
+ return true;
102
+ } else {
103
+ jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
104
+ if(jQuery.trim(jQuery(this).val()) == "") {
105
+ inputError = 1;
106
+ }
107
+ });
108
+ jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").addClass("border-red");
109
+ jQuery("#channels-selected-list > li:not(#chaty-social-close) .channels__input:first").focus();
110
+ return false;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ return true;
116
+ });
117
+ });
118
+
119
+ function check_for_number_chaty(phoneNumber, validationFor) {
120
+ if (phoneNumber != "") {
121
+ if (phoneNumber[0] == "+") {
122
+ phoneNumber = phoneNumber.substr(1, phoneNumber.length)
123
+ }
124
+ if (validationFor == "Phone") {
125
+ if (phoneNumber[0] == "*") {
126
+ phoneNumber = phoneNumber.substr(1, phoneNumber.length)
127
+ }
128
+ }
129
+ if (isNaN(phoneNumber)) {
130
+ return true;
131
+ }
132
+ }
133
+ return false;
134
+ }
135
+
136
+ (function ($, sr) {
137
+ var debounce = function (func, threshold, execAsap) {
138
+ var timeout;
139
+
140
+ return function debounced() {
141
+ var obj = this;
142
+ var
143
+ args = arguments;
144
+
145
+ function delayed() {
146
+ if (!execAsap) func.apply(obj, args);
147
+ timeout = null;
148
+ }
149
+
150
+ if (timeout) clearTimeout(timeout);
151
+ else if (execAsap) func.apply(obj, args);
152
+
153
+ timeout = setTimeout(delayed, threshold || 100);
154
+ };
155
+ };
156
+ // smartModalResize
157
+ jQuery.fn[sr] = function (fn) {
158
+ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
159
+ };
160
+ }(jQuery, 'smartModalResize'));
161
+
162
+ (function ($) {
163
+ 'use strict';
164
+
165
+ var methods = {
166
+ init: function (options) {
167
+ var defaults = {
168
+ top: 'auto',
169
+ left: 'auto',
170
+ autoOpen: false,
171
+ overlayOpacity: 0.5,
172
+ overlayColor: '#000',
173
+ overlayClose: true,
174
+ overlayParent: 'body',
175
+ closeOnEscape: true,
176
+ closeButtonClass: '.close',
177
+ transitionIn: '',
178
+ transitionOut: '',
179
+ onOpen: false,
180
+ onClose: false,
181
+ zIndex: function () {
182
+ return (function (value) {
183
+ return value === -Infinity ? 0 : value + 1;
184
+ }(Math.max.apply(Math, $.makeArray(jQuery('*').map(function () {
185
+ return jQuery(this).css('z-index');
186
+ }).filter(function () {
187
+ return $.isNumeric(this);
188
+ }).map(function () {
189
+ return parseInt(this, 10);
190
+ })))));
191
+ },
192
+ updateZIndexOnOpen: true,
193
+ hasVariableWidth: false
194
+ };
195
+
196
+ options = $.extend(defaults, options);
197
+
198
+ return this.each(function () {
199
+ var o = options;
200
+
201
+
202
+ var $overlay = jQuery('<div class="lean-overlay"></div>');
203
+
204
+
205
+ var $modal = jQuery(this);
206
+
207
+ $overlay.css({
208
+ display: 'none',
209
+ position: 'fixed',
210
+ // When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
211
+ // because the value would be replaced when opening the modal.
212
+ 'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex()),
213
+ top: 0,
214
+ left: 0,
215
+ height: '100%',
216
+ width: '100%',
217
+ background: o.overlayColor,
218
+ opacity: o.overlayOpacity,
219
+ overflow: 'auto'
220
+ }).appendTo(o.overlayParent);
221
+
222
+ $modal.css({
223
+ display: 'none',
224
+ position: 'fixed',
225
+ // When updateZIndexOnOpen is set to true, we avoid computing the z-index on initialization,
226
+ // because the value would be replaced when opening the modal.
227
+ 'z-index': (o.updateZIndexOnOpen ? 0 : o.zIndex() + 1),
228
+ left: parseInt(o.left, 10) > -1 ? o.left + 'px' : 50 + '%',
229
+ top: parseInt(o.top, 10) > -1 ? o.top + 'px' : 50 + '%'
230
+ });
231
+
232
+ $modal.bind('openModal', function () {
233
+ var overlayZ = o.updateZIndexOnOpen ? o.zIndex() : parseInt($overlay.css('z-index'), 10);
234
+
235
+
236
+ var modalZ = overlayZ + 1;
237
+
238
+ if (o.transitionIn !== '' && o.transitionOut !== '') {
239
+ $modal.removeClass(o.transitionOut).addClass(o.transitionIn);
240
+ }
241
+ $modal.css({
242
+ display: 'block',
243
+ 'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
244
+ 'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px',
245
+ 'z-index': modalZ
246
+ });
247
+
248
+ $overlay.css({'z-index': overlayZ, display: 'block'});
249
+
250
+ if (o.onOpen && typeof o.onOpen === 'function') {
251
+ // onOpen callback receives as argument the modal window
252
+ o.onOpen($modal[0]);
253
+ }
254
+ });
255
+
256
+ $modal.bind('closeModal', function () {
257
+ if (o.transitionIn !== '' && o.transitionOut !== '') {
258
+ $modal.removeClass(o.transitionIn).addClass(o.transitionOut);
259
+ $modal.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
260
+ $modal.css('display', 'none');
261
+ $overlay.css('display', 'none');
262
+ });
263
+ } else {
264
+ $modal.css('display', 'none');
265
+ $overlay.css('display', 'none');
266
+ }
267
+ if (o.onClose && typeof o.onClose === 'function') {
268
+ // onClose callback receives as argument the modal window
269
+ o.onClose($modal[0]);
270
+ }
271
+ });
272
+
273
+ // Close on overlay click
274
+ $overlay.click(function () {
275
+ if (o.overlayClose) {
276
+ $modal.trigger('closeModal');
277
+ }
278
+ });
279
+
280
+ jQuery(document).keydown(function (e) {
281
+ // ESCAPE key pressed
282
+ if (o.closeOnEscape && e.keyCode === 27) {
283
+ $modal.trigger('closeModal');
284
+ }
285
+ });
286
+
287
+ jQuery(window).smartModalResize(function () {
288
+ if (o.hasVariableWidth) {
289
+ $modal.css({
290
+ 'margin-left': (parseInt(o.left, 10) > -1 ? 0 : -($modal.outerWidth() / 2)) + 'px',
291
+ 'margin-top': (parseInt(o.top, 10) > -1 ? 0 : -($modal.outerHeight() / 2)) + 'px'
292
+ });
293
+ }
294
+ });
295
+
296
+ // Close when button pressed
297
+ $modal.on('click', o.closeButtonClass, function (e) {
298
+ $modal.trigger('closeModal');
299
+ e.preventDefault();
300
+ });
301
+
302
+ // Automatically open modal if option set
303
+ if (o.autoOpen) {
304
+ $modal.trigger('openModal');
305
+ }
306
+ });
307
+ }
308
+ };
309
+
310
+ $.fn.easyModal = function (method) {
311
+ // Method calling logic
312
+ if (methods[method]) {
313
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
314
+ }
315
+
316
+ if (typeof method === 'object' || !method) {
317
+ return methods.init.apply(this, arguments);
318
+ }
319
+
320
+ $.error('Method ' + method + ' does not exist on jQuery.easyModal');
321
+ };
322
+ }(jQuery));
323
+ (function ($) {
324
+ jQuery(document).ready(function () {
325
+ jQuery('input, .icon, textarea, .btn-cancel:not(.close-btn-set) ').click(function (event) {
326
+ window.onbeforeunload = function (e) {
327
+ e = e || window.event;
328
+ e.preventDefault = true;
329
+ e.cancelBubble = true;
330
+ e.returnValue = 'Your beautiful goodbye message';
331
+ };
332
+ });
333
+
334
+ jQuery(document).on('submit', 'form', function (event) {
335
+ window.onbeforeunload = null;
336
+ });
337
+
338
+ //jQuery('.preview').stick_in_parent({
339
+ // offset_top: 200
340
+ //});
341
+
342
+ jQuery('.upg').click(function (event) {
343
+ jQuery('.valid_domain_input').val(jQuery('.valid_domain_input').val().replace(' ', ''));
344
+ if (!/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery('.valid_domain_input').val())) {
345
+ event.preventDefault();
346
+ jQuery('.valid_domain').fadeIn().css({
347
+ display: 'block'
348
+ });
349
+ }
350
+ });
351
+ jQuery('.del_token').click(function (event) {
352
+ $.ajax({
353
+ type: 'POST',
354
+ url: ajaxurl,
355
+ data: {
356
+ action: 'del_token',
357
+ nonce_code: cht_nonce_ajax.cht_nonce
358
+ },
359
+ success: function (bool) {
360
+ location.reload();
361
+ },
362
+ error: function (xhr, status, error) {
363
+
364
+ }
365
+ });
366
+ });
367
+
368
+ jQuery(document).on("blur", "#channels-selected-list > li:not(#chaty-social-close) .channels__input", function(){
369
+ if(jQuery(this).hasClass("border-red") && jQuery(this).val() != "") {
370
+ jQuery(this).removeClass("border-red");
371
+ }
372
+ });
373
+
374
+ (function easyModal() {
375
+ jQuery('.easy-modal').easyModal({
376
+ top: 150,
377
+ overlay: 0.2
378
+ });
379
+ jQuery('.easy-modal-open').click(function (e) {
380
+ var target = jQuery(this).attr('href');
381
+ jQuery(target).trigger('openModal');
382
+ e.preventDefault();
383
+ });
384
+ jQuery('.easy-modal-close').click(function (e) {
385
+ e.preventDefault();
386
+ jQuery('.easy-modal').trigger('closeModal');
387
+ });
388
+ }());
389
+ var count_click = 1000000003;
390
+ jQuery('.show_up').click(function () {
391
+ count_click += 10;
392
+ jQuery('#upgrade-modal').css({
393
+ 'z-index': count_click,
394
+ display: 'block',
395
+ 'margin-left': '-258px'
396
+ });
397
+ });
398
+
399
+ (function colorPicker() {
400
+ jQuery('.color-picker-btn, .color-picker-btn-close, .color-picker-custom button').on('click', function (e) {
401
+ e.preventDefault();
402
+
403
+ jQuery('.color-picker').toggle();
404
+ jQuery('.color-picker-btn').toggle();
405
+ });
406
+
407
+ jQuery('.color-picker-radio input').change(function () {
408
+ var $this = jQuery(this);
409
+ jQuery('.color-picker-custom input[name="cht_custom_color"]').val('');
410
+ jQuery('.color-picker-custom .circle').html('?').css({
411
+ 'background-color': '#fff'
412
+ });
413
+ if ($this.prop('checked')) {
414
+ jQuery('.color-picker-radio input').prop('checked', false);
415
+ $this.prop('checked', true);
416
+ var color = $this.val();
417
+ var title = $this.prop('title');
418
+ } else {
419
+ color = jQuery('.color-picker-custom input').val();
420
+ title = 'Custom';
421
+ }
422
+
423
+ jQuery('.color-picker-btn .circle').css({backgroundColor: color});
424
+ jQuery('.color-picker-btn .text').text(title);
425
+ jQuery('#chaty-social-close ellipse').attr("fill", color);
426
+ });
427
+
428
+ jQuery('.color-picker-custom input').change(function () {
429
+ jQuery('.color-picker-radio input').prop('checked', false);
430
+
431
+ var $this = jQuery(this);
432
+
433
+ var color = $this.val();
434
+
435
+ jQuery('.color-picker-btn .circle').css({backgroundColor: color});
436
+ jQuery('.color-picker-btn .text').text('Custom');
437
+ jQuery('#chaty-social-close ellipse').attr("fill", color);
438
+ });
439
+ }());
440
+
441
+ (function customSelect() {
442
+ jQuery('[name="cht_position"]').change(function () {
443
+ if (jQuery('#positionCustom').prop('checked')) {
444
+ jQuery('#positionPro').show();
445
+ } else {
446
+ jQuery('#positionPro').hide();
447
+ }
448
+ });
449
+ }());
450
+
451
+
452
+ /**
453
+ * add Token
454
+ */
455
+
456
+ var AddTokenBtn = jQuery('.update_token');
457
+
458
+ AddTokenBtn.on('click', function (e) {
459
+ e.preventDefault();
460
+ var token = jQuery('input[name="cht_token"]').val();
461
+
462
+ $.ajax({
463
+ type: 'POST',
464
+ url: ajaxurl,
465
+ data: {
466
+ action: 'add_token',
467
+ nonce_code: cht_nonce_ajax.cht_nonce,
468
+ token: token
469
+ },
470
+ beforeSend: function (xhr) {
471
+
472
+ },
473
+ success: function (bool) {
474
+ if (bool) {
475
+ alert('Your pro plan is activated');
476
+ location.reload();
477
+ } else {
478
+ alert('You`ve entered a wrong token');
479
+ }
480
+ },
481
+ error: function (xhr, status, error) {
482
+
483
+ }
484
+ });
485
+ });
486
+ jQuery('textarea[name=cht_cta]').keyup(function (event) {
487
+ jQuery('.tooltiptext span').html(jQuery(this).val());
488
+ if (jQuery(this).val().length == 0) {
489
+ jQuery('.cta').hide(200);
490
+ jQuery('.tooltiptext span').hide(200);
491
+ } else {
492
+ jQuery('.cta').show(300);
493
+ jQuery('.tooltiptext span').show(200);
494
+ }
495
+ });
496
+ });
497
+ }(jQuery));
498
+
499
+ (function ($) {
500
+ jQuery(document).ready(function () {
501
+ (function preview() {
502
+ (function previewColor() {
503
+ jQuery('.color-picker-radio input').change(function () {
504
+ var $this = jQuery(this);
505
+
506
+ if ($this.prop('checked')) {
507
+ var color = $this.val();
508
+ } else {
509
+ color = jQuery('.color-picker-custom input').val();
510
+ }
511
+ detectIcon();
512
+ });
513
+
514
+ jQuery('.color-picker-custom input').change(function () {
515
+ var $this = jQuery(this);
516
+
517
+ var color = $this.val();
518
+
519
+ detectIcon();
520
+ });
521
+
522
+ jQuery(document).on("change", "#chaty_default_state", function(){
523
+
524
+ detectIcon();
525
+ });
526
+
527
+ jQuery('#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll').click(function () {
528
+ detectIcon();
529
+ });
530
+ }());
531
+
532
+ (function previewTooltip() {
533
+ var $widgetTooltip = jQuery('#widgetTooltip');
534
+ var $icon = jQuery('.preview .page .icon');
535
+
536
+ function tooltipToggle() {
537
+ if (jQuery('[name=cht_cta]').val().length >= 1) {
538
+ $icon.removeClass('no-tooltip');
539
+ } else {
540
+ $icon.addClass('no-tooltip');
541
+ }
542
+ }
543
+
544
+ tooltipToggle();
545
+
546
+ $widgetTooltip.change(function () {
547
+ tooltipToggle();
548
+ });
549
+ }());
550
+
551
+ function previewPosition() {
552
+ var $inputPosBot = jQuery('#positionBottom');
553
+ var $inputPosSide = jQuery('#positionSide');
554
+ var $chatyWidget = jQuery('.preview .page .chaty-widget');
555
+ var customSpace = '7px';
556
+
557
+ var value = jQuery('[name="cht_position"]:checked').val();
558
+
559
+ if (value === 'right') {
560
+ $chatyWidget.css({right: customSpace, left: 'auto', bottom: '7px'});
561
+ } else if (value === 'left') {
562
+ $chatyWidget.css({left: customSpace, right: 'auto', bottom: '7px'});
563
+ } else if (value === 'custom') {
564
+ if ($inputPosBot.val()) {
565
+ var positionBottom = $inputPosBot.val() + 'px';
566
+ } else {
567
+ positionBottom = customSpace;
568
+ }
569
+
570
+ if ($inputPosSide.val()) {
571
+ var positionSide = $inputPosSide.val() + 'px';
572
+ } else {
573
+ positionSide = customSpace;
574
+ }
575
+
576
+ $inputPosBot.change(function () {
577
+ positionBottom = jQuery('#positionBottom').val() + 'px';
578
+
579
+ $chatyWidget.css({bottom: positionBottom});
580
+ });
581
+
582
+ $inputPosSide.change(function () {
583
+ var valueCustom = jQuery('[name="positionSide"]:checked').val();
584
+ positionSide = jQuery(this).val() + 'px';
585
+
586
+ if (valueCustom === 'right') {
587
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
588
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
589
+ $chatyWidget.css({right: positionSide, left: 'auto'});
590
+ } else if (valueCustom === 'left') {
591
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
592
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
593
+ $chatyWidget.css({left: positionSide, right: 'auto'});
594
+ }
595
+ });
596
+
597
+ jQuery('[name="positionSide"]').change(function () {
598
+ var valueCustom = jQuery('[name="positionSide"]:checked').val();
599
+
600
+ if (valueCustom === 'right') {
601
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
602
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
603
+ $chatyWidget.css({right: positionSide, left: 'auto'});
604
+ } else if (valueCustom === 'left') {
605
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
606
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
607
+ $chatyWidget.css({left: positionSide, right: 'auto'});
608
+ }
609
+ });
610
+ }
611
+ }
612
+
613
+ previewPosition();
614
+
615
+
616
+ jQuery('input[name="cht_position"]').change(function () {
617
+ var valueCustom = jQuery('[name="cht_position"]:checked').val();
618
+
619
+ if (valueCustom === 'right') {
620
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-left');
621
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-right');
622
+ } else if (valueCustom === 'left') {
623
+ jQuery('.page-body .chaty-widget ').removeClass('chaty-widget-icons-right');
624
+ jQuery('.page-body .chaty-widget ').addClass('chaty-widget-icons-left');
625
+ }
626
+ previewPosition();
627
+ });
628
+
629
+ }());
630
+ jQuery('.popover').hide();
631
+ two_soc();
632
+
633
+ var socialIcon = jQuery('.channels-icons > .icon-sm');
634
+
635
+
636
+ var socialInputsContainer = jQuery('.social-inputs');
637
+
638
+ var click = 0;
639
+ jQuery('input[name=cht_custom_color]').keyup(function (event) {
640
+ var color = jQuery(this).val();
641
+ jQuery('.circle').html('');
642
+ jQuery('.color-picker-custom .circle').css({
643
+ 'background-color': color
644
+ });
645
+ if (jQuery(this).val().length < 1) {
646
+ jQuery('.color-picker-custom .circle').html('?');
647
+ }
648
+ });
649
+ socialIcon.on('click', function () {
650
+ ++click;
651
+ two_soc();
652
+
653
+ var $this = jQuery(this);
654
+
655
+ var social = $this.data('social');
656
+
657
+ var socialItem = socialInputsContainer.find('.social-form-group');
658
+
659
+ if ($this.hasClass('active')) {
660
+ var del = ',' + jQuery(this).attr('data-social');
661
+
662
+ var newlocaldata = jQuery('.add_slug').val();
663
+ newlocaldata = newlocaldata.replace(del, '');
664
+ jQuery('.add_slug').val(newlocaldata);
665
+ newlocaldata = newlocaldata.replace(del, '');
666
+ jQuery('.add_slug').val(newlocaldata);
667
+ newlocaldata = newlocaldata.replace(del, '');
668
+ jQuery('.add_slug').val(newlocaldata);
669
+ newlocaldata = newlocaldata.replace(del, '');
670
+
671
+
672
+ jQuery('.add_slug').val(newlocaldata);
673
+
674
+ $this.toggleClass('active');
675
+ return;
676
+ }
677
+ socialIcon.addClass('disabled');
678
+ icon = jQuery(this).data('social');
679
+
680
+ if (jQuery('.add_slug').val().indexOf(icon) == '1' && jQuery('.add_slug').val() != '') {
681
+ var del = ',' + icon;
682
+ var newlocaldata = jQuery('.add_slug').val();
683
+
684
+ newlocaldata = newlocaldata.replace(del, '');
685
+ jQuery('.add_slug').val(newlocaldata);
686
+ newlocaldata = newlocaldata.replace(del, '');
687
+ jQuery('.add_slug').val(newlocaldata);
688
+ newlocaldata = newlocaldata.replace(del, '');
689
+ jQuery('.add_slug').val(newlocaldata);
690
+ } else {
691
+ jQuery('.add_slug').val(jQuery('.add_slug').val() + ',' + jQuery(this).attr('data-social'));
692
+ }
693
+
694
+
695
+ /* if(jQuery('section').is("#pro")){
696
+
697
+ }else if(click >='3'){
698
+ // alert(click);
699
+ jQuery('.popover').show().effect( "shake", {times:3}, 600 );
700
+ click = jQuery('.channels-selected__item.free').length;
701
+ return;
702
+
703
+
704
+ } */
705
+
706
+ if (!jQuery('section').is('#pro') && jQuery('.channels-icons > .icon.active').length >= 2) {
707
+ jQuery('.popover').show().effect('shake', {times: 3}, 600);
708
+ socialIcon.removeClass('disabled');
709
+ return;
710
+ }
711
+
712
+ $this.toggleClass('active');
713
+
714
+
715
+ if (jQuery('section').is('#pro')) {
716
+ var token = 'pro';
717
+ } else {
718
+ var token = 'free';
719
+ }
720
+
721
+
722
+ $.ajax({
723
+ type: 'POST',
724
+ dataType: 'json',
725
+ url: ajaxurl,
726
+ data: {
727
+ action: 'choose_social',
728
+ social: social,
729
+ nonce_code: cht_nonce_ajax.cht_nonce,
730
+ version: token,
731
+ widget_index: jQuery("#widget_index").val()
732
+ },
733
+ beforeSend: function (xhr) {
734
+
735
+ },
736
+ success: function (data) {
737
+ var item = jQuery(data);
738
+ var itemName = item.find('.icon').data('title');
739
+
740
+ if (!jQuery('.channels-selected div[data-social="' + itemName + '"]').length) {
741
+ jQuery('#chaty-social-close').before(item);
742
+ }
743
+
744
+ socialIcon.removeClass('disabled');
745
+ detectIcon();
746
+ two_soc();
747
+
748
+ //jQuery('.chaty-color-field').wpColorPicker({
749
+ // pick: "Background Color",
750
+ // target: false,
751
+ // change: function(event, ui){
752
+ // chaty_set_bg_color();
753
+ // }
754
+ //});
755
+ jQuery('.chaty-color-field').spectrum({
756
+ chooseText: "Submit",
757
+ preferredFormat: "hex",
758
+ showInput: true,
759
+ cancelText: "Cancel",
760
+ move: function (color) {
761
+ jQuery(this).val(color.toHexString());
762
+ chaty_set_bg_color();
763
+ }
764
+ });
765
+ check_for_chaty_close_button();
766
+ },
767
+ error: function (xhr, status, error) {
768
+
769
+ }
770
+ });
771
+
772
+ two_soc();
773
+ });
774
+
775
+
776
+ /**
777
+ * Cancel Btn
778
+ */
779
+ var cancelBtn = jQuery('body');
780
+
781
+ cancelBtn.on('click', '.icon, .btn-cancel:not(.close-btn-set)', function (e) {
782
+
783
+ if (jQuery(this).hasClass("close-btn-set")) {
784
+ return;
785
+ }
786
+
787
+ e.preventDefault();
788
+
789
+ if (jQuery(this).hasClass('icon') && jQuery(this).hasClass('active')) {
790
+ return;
791
+ }
792
+
793
+ icon = jQuery(this).data('social');
794
+ if (jQuery(this).hasClass('btn-cancel')) {
795
+ jQuery('.icon.active[data-social^="' + icon + '"]').removeClass('active');
796
+
797
+ var del = ',' + icon;
798
+ var newlocaldata = jQuery('.add_slug').val();
799
+ newlocaldata = newlocaldata.replace(del, '');
800
+
801
+ jQuery('.add_slug').val(newlocaldata);
802
+ }
803
+ var del_item = jQuery('#chaty-social-' + icon);
804
+ del_item.remove();
805
+
806
+ var item = jQuery(this).parent('.channels-selected__item');
807
+
808
+
809
+ var social = jQuery(this).data('social');
810
+
811
+ // $.ajax({
812
+ // type: 'POST',
813
+ // dataType: 'json',
814
+ // url: ajaxurl,
815
+ // data: {
816
+ // action: 'remove_social',
817
+ // nonce_code: cht_nonce_ajax.cht_nonce,
818
+ // social: social,
819
+ // widget_index: jQuery("#widget_index").val()
820
+ // },
821
+ // beforeSend: function (xhr) {
822
+ //
823
+ // },
824
+ // success: function (bool) {
825
+ // if (bool) {
826
+ // item.closest("li").remove();
827
+ // del_item.remove();
828
+ //
829
+ //
830
+ // jQuery('.icon-sm').each(function () {
831
+ // if (jQuery(this).data('social') === social) {
832
+ // // jQuery(this).removeClass('active');
833
+ // }
834
+ // });
835
+ // set_social_channel_order();
836
+ // }
837
+ // check_for_chaty_close_button();
838
+ // },
839
+ // error: function (xhr, status, error) {
840
+ //
841
+ // }
842
+ // });
843
+ detectIcon();
844
+ two_soc();
845
+ set_social_channel_order();
846
+ check_for_chaty_close_button();
847
+ });
848
+
849
+ function two_soc() {
850
+ if (jQuery('section').is('#pro')) {
851
+ return;
852
+ }
853
+
854
+ if (jQuery('.channels-selected__item').length <= 1) {
855
+ jQuery('.channels-selected__item').hide();
856
+ jQuery('.popover').hide();
857
+ } else if (jQuery('.channels-selected__item').length >= 2) {
858
+ jQuery('.channels-selected__item').show();
859
+ }
860
+ }
861
+
862
+ jQuery('.btn-help').click(function (event) {
863
+ window.open(
864
+ 'https://premio.io/help/chaty/',
865
+ '_blank' // <- This is what makes it open in a new window.
866
+ );
867
+ });
868
+
869
+
870
+ var freeCustomInput = jQuery('.free-custom-radio, .free-custom-checkbox');
871
+
872
+ freeCustomInput.on('click', function (e) {
873
+ e.preventDefault();
874
+ });
875
+ var chatyCta = jQuery('[name=cht_cta]');
876
+ var toolTip = jQuery('.preview .tooltip-show');
877
+
878
+ chatyCta.keyup(function () {
879
+ var $icon = jQuery('.preview .page .icon');
880
+ if (chatyCta.val().length >= 1) {
881
+ $icon.removeClass('no-tooltip');
882
+ } else {
883
+ $icon.addClass('no-tooltip');
884
+ }
885
+ toolTip.attr('data-title', chatyCta.val());
886
+ });
887
+
888
+
889
+ var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
890
+ ' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
891
+ ' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
892
+ ' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
893
+ ' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
894
+ ' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
895
+ ' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
896
+ ' </svg>',
897
+ defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
898
+ ' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
899
+ ' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
900
+ ' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
901
+ ' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
902
+ ' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
903
+ ' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
904
+ ' </svg>',
905
+ iconBlock = document.getElementById('iconWidget'),
906
+ desktopIcon,
907
+ mobileIcon,
908
+ colorFill = jQuery('.color-picker-radio input:checked').val();
909
+
910
+ jQuery('#testUpload').on('change', function () {
911
+ if (this.value.length > 0) {
912
+ document.querySelector('.js-upload').disabled = false;
913
+ } else {
914
+ document.querySelector('.js-upload').disabled = true;
915
+ document.getElementById('uploadInput').checked = false;
916
+ }
917
+ });
918
+
919
+ jQuery(document).on("keyup", "textarea.test_textarea", function(){
920
+ detectIcon();
921
+ });
922
+
923
+ jQuery('.js-switch-preview').on('change', function () {
924
+ if (getPreviewDesktop()) {
925
+ jQuery(this).closest(".preview").removeClass('mobiel-view');
926
+ } else {
927
+ jQuery(this).closest(".preview").addClass('mobiel-view');
928
+ }
929
+ detectIcon();
930
+ });
931
+
932
+ function detectIcon() {
933
+ var desktop,
934
+ mobile,
935
+ colorSelf = false;
936
+ jQuery("#iconWidget").removeClass("img-p-active");
937
+
938
+ if (getPreviewDesktop()) {
939
+ if (jQuery('.js-chanel-desktop:checked').length === 0) {
940
+ desktop = false;
941
+ }
942
+ if (jQuery('.js-chanel-desktop:checked').length === 1) {
943
+ desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
944
+ if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
945
+ jQuery("#iconWidget").addClass("img-p-active");
946
+ }
947
+ }
948
+ if (jQuery('.js-chanel-desktop:checked').length > 1) {
949
+ desktop = defaultIcon;
950
+ colorSelf = true;
951
+ }
952
+ } else {
953
+ if (jQuery('.js-chanel-mobile:checked').length === 0) {
954
+ mobile = false;
955
+ }
956
+ if (jQuery('.js-chanel-mobile:checked').length === 1) {
957
+ mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
958
+ if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
959
+ jQuery("#iconWidget").addClass("img-p-active");
960
+ }
961
+ }
962
+ if (jQuery('.js-chanel-mobile:checked').length > 1) {
963
+ mobile = defaultIcon;
964
+ colorSelf = true;
965
+ }
966
+ }
967
+
968
+ desktopIcon = desktop;
969
+ mobileIcon = mobile;
970
+
971
+ if (getPreviewDesktop()) {
972
+ setIcon(desktopIcon, colorSelf)
973
+ } else {
974
+ setIcon(mobileIcon, colorSelf)
975
+ }
976
+ }
977
+
978
+ function stickyelement_iconformat(icon) {
979
+ var originalOption = icon.element;
980
+ return jQuery('<span><i class="' + icon.text + '"></i> ' + icon.text + '</span>');
981
+ }
982
+
983
+ function setIcon(icon, colorSelf) {
984
+ if (icon) {
985
+ //jQuery('.preview .page .chaty-widget').show();
986
+ iconBlock.innerHTML = icon;
987
+ } else {
988
+ //jQuery('.preview .page .chaty-widget').hide();
989
+ iconBlock.innerHTML = '';
990
+ }
991
+ if (colorSelf) {
992
+ var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
993
+ jQuery('.preview .page svg circle').css({fill: color});
994
+ jQuery('#chaty-social-close ellipse').attr("fill", color);
995
+ }
996
+
997
+ thisVal = jQuery("#chaty_default_state").val();
998
+ if(thisVal == "open") {
999
+ jQuery(".hide-show-button").addClass("active");
1000
+ } else {
1001
+ jQuery(".hide-show-button").removeClass("active");
1002
+ }
1003
+
1004
+ jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click");
1005
+ if(thisVal == "open") {
1006
+ jQuery(".chaty-widget").addClass("active");
1007
+ } else if(thisVal == "hover") {
1008
+ jQuery(".chaty-widget").addClass("hover");
1009
+ } else {
1010
+ jQuery(".chaty-widget").addClass("click");
1011
+ }
1012
+
1013
+ jQuery(".chaty-channels").html("");
1014
+ var eClass = ".js-chanel-mobile";
1015
+ if (getPreviewDesktop()) {
1016
+ var eClass = ".js-chanel-desktop";
1017
+ }
1018
+
1019
+ if(thisVal == "open" && jQuery(eClass+':checked').length > 1) {
1020
+ jQuery("#chaty_attention_effect").val("");
1021
+ jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", true);
1022
+ jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state");
1023
+ if(jQuery(".test_textarea").val() != "Doesn't apply for the open state") {
1024
+ jQuery(".test_textarea").attr("data-value", jQuery(".test_textarea").val());
1025
+ }
1026
+ jQuery(".test_textarea").val("Doesn't apply for the open state");
1027
+ } else {
1028
+ jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", false);
1029
+ jQuery("#chaty_attention_effect option:first-child").text("None");
1030
+ jQuery(".test_textarea").attr("placeholder","");
1031
+ if(jQuery(".test_textarea").val() == "Doesn't apply for the open state") {
1032
+ jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value"));
1033
+ }
1034
+ }
1035
+
1036
+ if (jQuery(eClass+':checked').length > 1) {
1037
+ jQuery(eClass+':checked').each(function(){
1038
+ var socialIcon = jQuery(this).closest("li").find(".icon").html();
1039
+ var socialIcon = jQuery(this).closest("li").find(".icon").html();
1040
+ var socialIconText = jQuery(this).closest("li").find(".chaty-title").val();
1041
+ var eClass = jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";
1042
+ if(socialIconText != "") {
1043
+ socialIconText = "<span class='social-tooltip'>"+socialIconText+"</span>";
1044
+ }
1045
+ jQuery(".chaty-channels").append("<div class='social-item-box "+eClass+"'><span class='tooltip-icon'>"+socialIcon+"</span>"+socialIconText+"</div>");
1046
+ });
1047
+
1048
+ if(jQuery("#chaty_default_state").val() == "open" && jQuery("#cht_close_button").is(":checked")) {
1049
+ jQuery("#iconWidget").css("display", "block");
1050
+ jQuery(".chaty-widget .tooltiptext").css("display","block");
1051
+ jQuery(".chaty-widget").removeClass("hide-arrow");
1052
+ } else if(jQuery("#chaty_default_state").val() != "open") {
1053
+ jQuery("#iconWidget").css("display", "block");
1054
+ jQuery(".chaty-widget .tooltiptext").css("display","block");
1055
+ jQuery(".chaty-widget").removeClass("hide-arrow");
1056
+ } else if(jQuery("#chaty_default_state").val() == "open") {
1057
+ jQuery("#iconWidget").hide();
1058
+ jQuery(".chaty-widget .tooltiptext").hide();
1059
+ jQuery(".chaty-widget").addClass("hide-arrow");
1060
+ }
1061
+ jQuery(".chaty-widget").removeClass("has-single");
1062
+ } else if (jQuery(eClass+':checked').length == 1) {
1063
+ if(jQuery("#chaty_default_state").val() == "open" && !jQuery("#cht_close_button").is(":checked")) {
1064
+ jQuery("#iconWidget").css("display","block");
1065
+ jQuery(".chaty-widget .tooltiptext").css("display","block");
1066
+ jQuery(".chaty-widget").removeClass("hide-arrow");
1067
+ } else if(jQuery("#chaty_default_state").val() != "open") {
1068
+ jQuery("#iconWidget").css("display","block");
1069
+ jQuery(".chaty-widget .tooltiptext").css("display","block");
1070
+ jQuery(".chaty-widget").removeClass("hide-arrow");
1071
+ }
1072
+ jQuery(".chaty-widget").addClass("has-single");
1073
+ } else if (jQuery(eClass+':checked').length == 0) {
1074
+ jQuery("#iconWidget").hide();
1075
+ jQuery(".chaty-widget .tooltiptext").hide();
1076
+ jQuery(".chaty-widget").addClass("hide-arrow");
1077
+ jQuery(".chaty-widget").removeClass("has-single");
1078
+ }
1079
+ jQuery(".chaty-channels .remove-icon-img").remove();
1080
+
1081
+ if(jQuery("#trigger_on_time").is(":checked")) {
1082
+ jQuery("#chaty_trigger_time").attr("readonly", false);
1083
+ } else {
1084
+ jQuery("#chaty_trigger_time").attr("readonly", true);
1085
+ }
1086
+
1087
+ if(jQuery("#chaty_trigger_on_scroll").is(":checked")) {
1088
+ jQuery("#chaty_trigger_on_page_scroll").attr("readonly", false);
1089
+ } else {
1090
+ jQuery("#chaty_trigger_on_page_scroll").attr("readonly", true);
1091
+ }
1092
+
1093
+
1094
+ if(jQuery(".chaty-widget .tooltiptext").text() == "") {
1095
+ jQuery(".chaty-widget .tooltiptext").hide();
1096
+ } else {
1097
+ if(jQuery("#chaty_default_state").val() == "open" && jQuery(eClass+':checked').length > 1) {
1098
+ jQuery(".chaty-widget .tooltiptext").hide();
1099
+ } else {
1100
+ jQuery(".chaty-widget .tooltiptext").css("display", "block");
1101
+ }
1102
+ }
1103
+ }
1104
+
1105
+ function getPreviewDesktop() {
1106
+ return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
1107
+ }
1108
+
1109
+ function changeWidgetIcon() {
1110
+
1111
+ jQuery(document).on('change', '.js-chanel-icon', function () {
1112
+ detectIcon();
1113
+ });
1114
+
1115
+ function calc(a) {
1116
+ var count = {}, res = 0, q;
1117
+ for (q = 0; q < a.length; ++q) {
1118
+ count[a[q].dataset.type] = ~~count[a[q].dataset.type] + 1;
1119
+ }
1120
+ for (q in count) {
1121
+ if (count.hasOwnProperty(q) && count[q] > 1) {
1122
+ res += count[q];
1123
+ }
1124
+ }
1125
+ return res;
1126
+ }
1127
+
1128
+
1129
+ jQuery(document).on('change', '.js-widget-i', function (ev) {
1130
+ if (ev.target.classList.contains('js-upload')) {
1131
+ defaultIcon = jQuery('.file-preview-image').last().parent().html();
1132
+ } else {
1133
+ defaultIcon = jQuery('i[data-type=' + ev.target.dataset.type + ']').html()
1134
+ }
1135
+ detectIcon();
1136
+ });
1137
+ }
1138
+
1139
+ changeWidgetIcon();
1140
+
1141
+ if (jQuery(".js-widget-i:checked").attr("data-type") !== 'chat-image') {
1142
+ defaultIcon = jQuery('i[data-type=' + jQuery(".js-widget-i:checked").attr("data-type") + ']').html();
1143
+ detectIcon();
1144
+ };
1145
+ });
1146
+
1147
+ jQuery(document).ready(function () {
1148
+
1149
+ jQuery(document).on("click", ".remove-chaty-options", function (e) {
1150
+ e.preventDefault();
1151
+ e.stopPropagation();
1152
+ if(confirm("Are you sure you want to delete this widget?")) {
1153
+ $.ajax({
1154
+ type: 'POST',
1155
+ url: ajaxurl,
1156
+ data: {
1157
+ action: 'remove_chaty_widget',
1158
+ nonce_code: cht_nonce_ajax.cht_nonce,
1159
+ widget_index: jQuery("#widget_index").val()
1160
+ },
1161
+ beforeSend: function (xhr) {
1162
+
1163
+ },
1164
+ success: function (res) {
1165
+ window.location = res;
1166
+ },
1167
+ error: function (xhr, status, error) {
1168
+
1169
+ }
1170
+ });
1171
+ }
1172
+ })
1173
+
1174
+ /* Date: 2019-07-26 */
1175
+ var location_href = window.location.href;
1176
+ if (window.location.href.indexOf('page=chaty-app&widget=') > -1) {
1177
+ jQuery('#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li').each(function () {
1178
+ var element_href = jQuery(this).find('a').attr('href');
1179
+ if (typeof element_href !== 'undefined') {
1180
+ jQuery(this).removeClass('current');
1181
+ if (window.location.href.indexOf(element_href) > -1 && element_href.indexOf('&widget=') > -1) {
1182
+ jQuery(this).addClass('current');
1183
+ }
1184
+ }
1185
+ });
1186
+ }
1187
+ });
1188
+ }(jQuery));
1189
+
1190
+
1191
+ jQuery(window).scroll(function () {
1192
+ check_for_preview_pos();
1193
+ });
1194
+ jQuery(document).ready(function () {
1195
+ check_for_preview_pos();
1196
+ });
1197
+
1198
+ function check_for_preview_pos() {
1199
+ if(jQuery(".chaty-setting-form").length) {
1200
+ if(jQuery(window).width() > 1179) {
1201
+ var topPos = parseInt(jQuery(".chaty-setting-form").offset().top);
1202
+ jQuery(".btn-save-sticky").css("top", (topPos+58));
1203
+ jQuery(".preview").css("top", (topPos+18));
1204
+ jQuery(".btn-help").css("top", (topPos+58+145));
1205
+ jQuery("a.remove-chaty-widget-sticky").css("top", (topPos+58+145+119));
1206
+ } else {
1207
+ jQuery(".btn-save-sticky").attr("style", "");
1208
+ jQuery(".preview").attr("style", "");
1209
+ jQuery(".btn-help").attr("style", "");
1210
+ jQuery("a.remove-chaty-widget-sticky").attr("style", "");
1211
+ }
1212
+ }
1213
+
1214
+ if (jQuery("#scroll-to-item").length && jQuery("#admin-preview").length) {
1215
+ if(jQuery("body").hasClass("has-premio-box")) {
1216
+ topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 625;
1217
+ } else {
1218
+ topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 485;
1219
+ }
1220
+
1221
+ if (topPos < 0) {
1222
+ topPos = Math.abs(topPos);
1223
+ jQuery("#admin-preview").css("margin-top", ((-1) * topPos) + "px");
1224
+ } else {
1225
+ jQuery("#admin-preview").css("margin-top", "0");
1226
+ }
1227
+ }
1228
+ }
1229
+
1230
+ var totalPageOptions = 0;
1231
+ var pageOptionContent = "";
1232
+ var totalDateAndTimeOptions = 0;
1233
+ var dateAndTimeOptionContent = "";
1234
+ jQuery(document).ready(function () {
1235
+ totalPageOptions = parseInt(jQuery(".chaty-page-option").length);
1236
+ pageOptionContent = jQuery(".chaty-page-options-html").html();
1237
+ jQuery(".chaty-page-options-html").remove();
1238
+ totalDateAndTimeOptions = parseInt(jQuery(".chaty-date-time-option").length);
1239
+ dateAndTimeOptionContent = jQuery(".chaty-date-and-time-options-html").html();
1240
+ jQuery(".chaty-date-and-time-options-html").remove();
1241
+
1242
+ jQuery("#create-rule").click(function () {
1243
+ // appendHtml = pageOptionContent.replace(/__count__/g, totalPageOptions, pageOptionContent);
1244
+ // totalPageOptions++;
1245
+ // jQuery(".chaty-page-options").append(appendHtml);
1246
+ // jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
1247
+ // jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
1248
+ //
1249
+ // if (jQuery("#is_pro_plugin").val() == "0") {
1250
+ // jQuery(".chaty-page-options").find("input").attr("name", "");
1251
+ // jQuery(".chaty-page-options").find("select").attr("name", "");
1252
+ // jQuery(".chaty-page-options").find("input").removeClass("cht-required");
1253
+ // jQuery(".chaty-page-options").find("select").removeClass("cht-required");
1254
+ // jQuery(this).remove();
1255
+ // }
1256
+ jQuery(".page-options").toggle();
1257
+ });
1258
+
1259
+ jQuery("#create-data-and-time-rule").click(function () {
1260
+ jQuery(".chaty-data-and-time-rules").toggle();
1261
+ });
1262
+
1263
+ jQuery(document).on("change", "#chaty_attention_effect", function(){
1264
+ var currentClass = jQuery(this).attr("data-effect");
1265
+ if(currentClass != "") {
1266
+ jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
1267
+ }
1268
+ jQuery("#iconWidget").removeClass("start-now");
1269
+ jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now");
1270
+ jQuery(this).attr("data-effect", jQuery(this).val());
1271
+ });
1272
+
1273
+ setInterval(function(){
1274
+ var currentClass = jQuery("#chaty_attention_effect").attr("data-effect");
1275
+ if(currentClass != "") {
1276
+ jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
1277
+ jQuery("#iconWidget").removeClass("start-now");
1278
+ setTimeout(function(){
1279
+ jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now");
1280
+ }, 1000);
1281
+ } else {
1282
+ jQuery("#chaty_attention_effect").attr("data-effect", jQuery("#chaty_attention_effect").val());
1283
+ }
1284
+ }, 5000);
1285
+
1286
+ jQuery(document).on("click", ".remove-chaty", function () {
1287
+ jQuery(this).closest(".chaty-page-option").remove();
1288
+ jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
1289
+ jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
1290
+ });
1291
+
1292
+ jQuery(document).on("click", ".remove-page-option", function () {
1293
+ jQuery(this).closest(".chaty-date-time-option").remove();
1294
+ });
1295
+
1296
+ jQuery("#image-upload-content .custom-control-label").click(function (e) {
1297
+ e.stopPropagation();
1298
+ jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked", true);
1299
+ jQuery('.js-widget-i').trigger("change");
1300
+ return false;
1301
+ });
1302
+ //jQuery('.chaty-color-field').wpColorPicker({
1303
+ // pick: "Background Color",
1304
+ // target: false,
1305
+ // change: function(event, ui){
1306
+ // chaty_set_bg_color();
1307
+ // }
1308
+ //});
1309
+
1310
+ jQuery('.chaty-color-field').spectrum({
1311
+ chooseText: "Submit",
1312
+ preferredFormat: "hex",
1313
+ cancelText: "Cancel",
1314
+ showInput: true,
1315
+ move: function (color) {
1316
+ jQuery(this).val(color.toHexString());
1317
+ chaty_set_bg_color();
1318
+ change_custom_preview();
1319
+ }
1320
+ });
1321
+ jQuery(".chaty-color-field").change(function () {
1322
+ chaty_set_bg_color();
1323
+ change_custom_preview();
1324
+ });
1325
+
1326
+ jQuery(".remove-chaty-img").on("click", function (e) {
1327
+ e.stopPropagation();
1328
+ });
1329
+
1330
+ jQuery("#channels-selected-list").sortable({
1331
+ placeholder: "ui-chaty-state-hl",
1332
+ items: "li:not(#chaty-social-close)",
1333
+ update: function (event, ui) {
1334
+ set_social_channel_order();
1335
+ change_custom_preview();
1336
+ }
1337
+ });
1338
+
1339
+ jQuery(".close-button-img img, .close-button-img .image-upload").click(function () {
1340
+ var image = wp.media({
1341
+ title: 'Upload Image',
1342
+ // mutiple: true if you want to upload multiple files at once
1343
+ multiple: false,
1344
+ library: {
1345
+ type: 'image',
1346
+ }
1347
+ }).open()
1348
+ .on('select', function (e) {
1349
+ var uploaded_image = image.state().get('selection').first();
1350
+ imageData = uploaded_image.toJSON();
1351
+ jQuery('.close-button-img').addClass("active");
1352
+ jQuery('.close-button-img input').val(imageData.id);
1353
+ jQuery('.close-button-img img').attr("src", imageData.url);
1354
+ change_custom_preview();
1355
+ });
1356
+ });
1357
+
1358
+ jQuery(".remove-close-img").click(function () {
1359
+ default_image = jQuery("#default_image").val();
1360
+ jQuery('.close-button-img').removeClass("active");
1361
+ jQuery('.close-button-img input').val("");
1362
+ jQuery('.close-button-img img').attr("src", default_image);
1363
+ change_custom_preview();
1364
+ });
1365
+
1366
+ jQuery(document).on("click", ".chaty-widget.click", function(e){
1367
+ e.preventDefault();
1368
+ // jQuery(".chaty-channels").toggle();
1369
+ jQuery(".chaty-widget").toggleClass("active");
1370
+ });
1371
+
1372
+ jQuery(document).on('change', '.url-options.cht-required', function (ev) {
1373
+ thisVal = jQuery(this).val();
1374
+ siteURL = jQuery("#chaty_site_url").val();
1375
+ newURL = siteURL;
1376
+ if (thisVal == "page_has_url") {
1377
+ newURL = siteURL;
1378
+ } else if (thisVal == "page_contains") {
1379
+ newURL = siteURL + "%s%";
1380
+ } else if (thisVal == "page_start_with") {
1381
+ newURL = siteURL + "s%";
1382
+ } else if (thisVal == "page_end_with") {
1383
+ newURL = siteURL + "%s";
1384
+ }
1385
+ jQuery(this).closest(".url-content").find(".chaty-url").text(newURL);
1386
+ });
1387
+
1388
+ check_for_chaty_close_button();
1389
+ chaty_set_bg_color();
1390
+ change_custom_preview();
1391
+
1392
+ jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function (e) {
1393
+ e.preventDefault();
1394
+ jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active");
1395
+ });
1396
+
1397
+ /*Default Values*/
1398
+ if (jQuery("input[name='cht_position']:checked").length == 0) {
1399
+ jQuery("#right-position").attr("checked", true);
1400
+ jQuery("input[name='cht_position']:checked").trigger("change");
1401
+ }
1402
+ if (jQuery("input[name='widget_icon']:checked").length == 0) {
1403
+ jQuery("input[name='widget_icon']:first").attr("checked", true);
1404
+ jQuery("input[name='widget_icon']:checked").trigger("change");
1405
+ }
1406
+
1407
+ /*font family Privew*/
1408
+ jQuery('.form-fonts').on( 'change', function() {
1409
+ var font_val = jQuery(this).val();
1410
+ jQuery('.chaty-google-font').remove();
1411
+ if (font_val != "") {
1412
+ jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
1413
+ jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
1414
+ } else {
1415
+ jQuery('.preview-section-chaty #admin-preview .page-body').attr("style","");
1416
+ }
1417
+ });
1418
+ });
1419
+
1420
+ jQuery(window).load(function () {
1421
+ check_for_chaty_close_button();
1422
+ chaty_set_bg_color();
1423
+ jQuery(".chaty-page-options .chaty-page-option").removeClass("last");
1424
+ jQuery(".chaty-page-options .chaty-page-option:last").addClass("last");
1425
+
1426
+ jQuery('.url-options.cht-required').each(function () {
1427
+ jQuery(this).trigger("change");
1428
+ });
1429
+ var font_val = jQuery('.form-fonts').val();
1430
+ jQuery('.chaty-google-font').remove();
1431
+ if (font_val != "") {
1432
+ jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
1433
+ jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
1434
+ }
1435
+ // jQuery("#chaty_default_state").trigger("change");
1436
+ });
1437
+
1438
+ var selectedsocialSlug = "";
1439
+
1440
+ function upload_chaty_image(socialSlug) {
1441
+ selectedsocialSlug = socialSlug;
1442
+ var image = wp.media({
1443
+ title: 'Upload Image',
1444
+ // mutiple: true if you want to upload multiple files at once
1445
+ multiple: false,
1446
+ library: {
1447
+ type: 'image',
1448
+ }
1449
+ }).open()
1450
+ .on('select', function (e) {
1451
+ var uploaded_image = image.state().get('selection').first();
1452
+ imageData = uploaded_image.toJSON();
1453
+ jQuery('#cht_social_image_' + selectedsocialSlug).val(imageData.id);
1454
+ jQuery('.custom-image-' + selectedsocialSlug + " img").attr("src", imageData.url);
1455
+ jQuery("#chaty-social-" + selectedsocialSlug + " .channels-selected__item").addClass("img-active");
1456
+ change_custom_preview();
1457
+ });
1458
+ }
1459
+
1460
+ function toggle_chaty_setting(socId) {
1461
+ jQuery("#chaty-social-" + socId).find(".chaty-advance-settings").toggle();
1462
+ change_custom_preview();
1463
+ }
1464
+
1465
+ function chaty_set_bg_color() {
1466
+ jQuery(".chaty-color-field").each(function () {
1467
+ if (jQuery(this).val() != "" && jQuery(this).val() != "#ffffff") {
1468
+ if (jQuery(this).closest("li").data("id") != "Linkedin" || (jQuery(this).closest("li").data("id") == "Linkedin" && jQuery(this).val() != "#ffffff")) {
1469
+ defaultColor = jQuery(this).val();
1470
+ jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill", defaultColor);
1471
+ jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background", defaultColor);
1472
+ jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background", defaultColor);
1473
+ }
1474
+ }
1475
+ });
1476
+ change_custom_preview();
1477
+ }
1478
+
1479
+ function upload_qr_code() {
1480
+ var image = wp.media({
1481
+ title: 'Upload QR Image',
1482
+ multiple: false,
1483
+ library: {
1484
+ type: 'image',
1485
+ }
1486
+ }).open()
1487
+ .on('select', function (e) {
1488
+ var uploaded_image = image.state().get('selection').first();
1489
+ imageData = uploaded_image.toJSON();
1490
+ jQuery('#upload_qr_code_val').val(imageData.id);
1491
+ jQuery('#upload_qr_code img').attr("src", imageData.url);
1492
+ jQuery(".remove-qr-code").addClass("active");
1493
+ change_custom_preview();
1494
+ });
1495
+ }
1496
+
1497
+ function remove_qr_code() {
1498
+ jQuery(".remove-qr-code").removeClass("active");
1499
+ jQuery('#upload_qr_code_val').val("");
1500
+ default_image = jQuery("#default_image").val();
1501
+ jQuery('#upload_qr_code img').attr("src", default_image);
1502
+ change_custom_preview();
1503
+ }
1504
+
1505
+ function remove_chaty_image(socId) {
1506
+ default_image = jQuery("#default_image").val();
1507
+ jQuery("#chaty-social-" + socId + " .channels-selected__item").removeClass("img-active");
1508
+ jQuery('#cht_social_image_' + socId).val("");
1509
+ jQuery('#cht_social_image_src_' + socId).attr("src", default_image);
1510
+ change_custom_preview();
1511
+ }
1512
+
1513
+ var baseIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
1514
+ ' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
1515
+ ' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
1516
+ ' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
1517
+ ' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
1518
+ ' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
1519
+ ' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
1520
+ ' </svg>',
1521
+ defaultIcon = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n' +
1522
+ ' <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n' +
1523
+ ' </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n' +
1524
+ ' <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
1525
+ ' C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n' +
1526
+ ' <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n' +
1527
+ ' C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n' +
1528
+ ' </svg>'
1529
+ var iconBlock = document.getElementById('iconWidget');
1530
+
1531
+ function set_social_channel_order() {
1532
+ socialString = [];
1533
+ jQuery("#channels-selected-list li").each(function () {
1534
+ socialString.push(jQuery(this).attr("data-id"));
1535
+ });
1536
+ socialString = socialString.join(",");
1537
+ jQuery("#cht_numb_slug").val(socialString);
1538
+ check_for_chaty_close_button();
1539
+ }
1540
+
1541
+ function check_for_chaty_close_button() {
1542
+ if (jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length >= 2) {
1543
+ jQuery("#chaty-social-close").show();
1544
+ } else {
1545
+ jQuery("#chaty-social-close").hide();
1546
+ }
1547
+ change_custom_preview();
1548
+ var srtString = "";
1549
+ jQuery("#channels-selected-list > li").each(function(){
1550
+ if(jQuery(this).attr("data-id") != "undefined" && jQuery(this).attr("data-id") != "") {
1551
+ srtString += jQuery(this).attr("data-id")+",";
1552
+ }
1553
+ srtString = srtString.trimRight(",")
1554
+ });
1555
+ jQuery(".add_slug").val(srtString);
1556
+ }
1557
+
1558
+ function change_custom_preview() {
1559
+ var desktop,
1560
+ mobile,
1561
+ colorSelf = false;
1562
+ jQuery("#iconWidget").removeClass("img-p-active");
1563
+ if (getChtPreviewDesktop()) {
1564
+ if (jQuery('.js-chanel-desktop:checked').length === 0) {
1565
+ desktop = false;
1566
+ }
1567
+ if (jQuery('.js-chanel-desktop:checked').length === 1) {
1568
+ desktop = jQuery('.js-chanel-desktop:checked').closest("li").find(".icon.icon-md").html();
1569
+ if (jQuery('.js-chanel-desktop:checked').closest(".channels-selected__item").hasClass("img-active")) {
1570
+ jQuery("#iconWidget").addClass("img-p-active");
1571
+ }
1572
+ }
1573
+ if (jQuery('.js-chanel-desktop:checked').length > 1) {
1574
+ desktop = defaultIcon;
1575
+ colorSelf = true;
1576
+ }
1577
+ } else {
1578
+ if (jQuery('.js-chanel-mobile:checked').length === 0) {
1579
+ mobile = false;
1580
+ }
1581
+ if (jQuery('.js-chanel-mobile:checked').length === 1) {
1582
+ mobile = jQuery('.js-chanel-mobile:checked').closest("li").find(".icon.icon-md").html();
1583
+ if (jQuery('.js-chanel-mobile:checked').closest(".channels-selected__item").hasClass("img-active")) {
1584
+ jQuery("#iconWidget").addClass("img-p-active");
1585
+ }
1586
+ }
1587
+ if (jQuery('.js-chanel-mobile:checked').length > 1) {
1588
+ mobile = defaultIcon;
1589
+ colorSelf = true;
1590
+ }
1591
+ }
1592
+
1593
+
1594
+ desktopIcon = desktop;
1595
+ mobileIcon = mobile;
1596
+
1597
+ if (getChtPreviewDesktop()) {
1598
+ setChtIcon(desktopIcon, colorSelf)
1599
+ } else {
1600
+ setChtIcon(mobileIcon, colorSelf)
1601
+ }
1602
+ }
1603
+
1604
+ function getChtPreviewDesktop() {
1605
+ return jQuery('#previewDesktop').attr('checked') === 'checked' ? true : false;
1606
+ }
1607
+
1608
+ function setChtIcon(icon, colorSelf) {
1609
+ iconBlock = document.getElementById('iconWidget');
1610
+ if (icon) {
1611
+ //jQuery('.preview .page .chaty-widget').show();
1612
+ iconBlock.innerHTML = icon;
1613
+ } else {
1614
+ //jQuery('.preview .page .chaty-widget').hide();
1615
+ iconBlock.innerHTML = '';
1616
+ }
1617
+ if (colorSelf) {
1618
+ var color = jQuery('.color-picker-custom input').val() ? jQuery('.color-picker-custom input').val() : jQuery('.color-picker-radio input:checked').val();
1619
+ jQuery('.preview .page svg circle').css({fill: color});
1620
+ jQuery('#chaty-social-close ellipse').attr("fill", color);
1621
+ }
1622
+ jQuery('.js-widget-i:checked').trigger("change");
1623
+ }
{assets → admin/assets}/js/fileinput.min.js RENAMED
File without changes
{assets → admin/assets}/js/jquery.sticky.js RENAMED
File without changes
{assets → admin/assets}/js/popper.min.js RENAMED
File without changes
{assets → admin/assets}/js/spectrum.min.js RENAMED
File without changes
{assets → admin/assets}/package-lock.json RENAMED
File without changes
admin/class-admin-base.php CHANGED
@@ -16,6 +16,7 @@ class CHT_Admin_Base
16
  public $page;
17
  public $socials;
18
  public $fa_icons;
 
19
  public $colors;
20
  protected $token;
21
  protected static $response = null;
@@ -38,7 +39,6 @@ class CHT_Admin_Base
38
  // Adds all of the options for the administrative settings
39
  add_action('admin_init', array($this, 'cht_register_inputs'));
40
  add_action('admin_head', array($this, 'cht_inline_css_admin'));
41
- add_action('init', array($this, 'check_page_available'));
42
  }
43
  // add_action('updated_option', array($this, 'cht_clear_all_caches'));
44
 
@@ -57,37 +57,16 @@ class CHT_Admin_Base
57
  add_action( 'plugins_loaded', array( $this, 'chaty_text' ) );
58
  }
59
 
60
- public function chaty_text() {
61
- load_plugin_textdomain("chaty", FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
62
- }
63
-
64
- public function chaty_update_status() {
65
- if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'chaty_update_status')) {
66
- $status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING);
67
- $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
68
- update_option("chaty_update_message", 2);
69
- if($status == 1) {
70
- $url = 'https://go.premio.io/api/update.php?email='.$email.'&plugin=chaty';
71
- $handle = curl_init();
72
- curl_setopt($handle, CURLOPT_URL, $url);
73
- curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
74
- $response = curl_exec($handle);
75
- curl_close($handle);
76
- }
77
- }
78
-
79
- }
80
 
81
- public static function get_current_count() {
82
- $current_count = get_option("chaty_total_channel_click");
83
- if($current_count === false || empty($current_count)) {
84
- return 0;
85
- }
86
- return intval($current_count);
87
  }
88
 
89
- /* sending message to plugin owner why plugin is deactivated */
90
-
91
  /* chaty_plugin_deactivate start */
92
  public function chaty_plugin_deactivate()
93
  {
@@ -169,6 +148,15 @@ class CHT_Admin_Base
169
  wp_die();
170
  }
171
 
 
 
 
 
 
 
 
 
 
172
  public function add_deactivate_modal()
173
  {
174
  global $pagenow;
@@ -177,112 +165,7 @@ class CHT_Admin_Base
177
  return;
178
  }
179
 
180
- include CHT_DIR . '/views/modals/chaty-deactivate-form.php';
181
- }
182
-
183
- public function plugin_action_links($links)
184
- {
185
- $links['need_help'] = '<a target="_blank" href="https://premio.io/help/chaty/?utm_source=pluginspage" >'.__( 'Need help?', CHT_OPT ).'</a>';
186
- $links['go_pro'] = '<a href="' . CHT_PRO_URL . '" class="chaty-plugins-gopro">' . esc_attr__('Upgrade', CHT_OPT) . '</a>';
187
- wp_register_style('chaty-admin-custom-style', CHT_PLUGIN_URL . '/assets/css/admin-cht-style.css');
188
- wp_enqueue_style('chaty-admin-custom-style');
189
-
190
- return $links;
191
- }
192
-
193
- public function wcp_admin_send_message_to_owner()
194
- {
195
- $response = array();
196
- $response['status'] = 0;
197
- $response['error'] = 0;
198
- $response['errors'] = array();
199
- $response['message'] = "";
200
- $errorArray = [];
201
- $errorMessage = esc_attr__("%s is required", CHT_OPT);
202
-
203
- $textarea_text = filter_input(INPUT_POST, 'textarea_text', FILTER_SANITIZE_STRING);
204
- $user_email = filter_input(INPUT_POST, 'user_email', FILTER_SANITIZE_EMAIL);
205
- $nonce = filter_input(INPUT_POST, 'nonce', FILTER_SANITIZE_STRING);
206
-
207
- if (empty($textarea_text)) {
208
- $error = array(
209
- "key" => "textarea_text",
210
- "message" => esc_attr__("Please enter your message", "wcp")
211
- );
212
- $errorArray[] = $error;
213
- }
214
- if (empty($user_email)) {
215
- $error = array(
216
- "key" => "user_email",
217
- "message" => sprintf($errorMessage, esc_attr__("Email", "wcp"))
218
- );
219
- $errorArray[] = $error;
220
- } else if (!filter_var($user_email, FILTER_VALIDATE_EMAIL)) {
221
- $error = array(
222
- 'key' => "user_email",
223
- "message" => "Email is not valid"
224
- );
225
- $errorArray[] = $error;
226
- }
227
- if (empty($errorArray)) {
228
- if (empty($nonce)) {
229
- $error = array(
230
- 'key' => "nonce",
231
- "message" => "Your request is not valid"
232
- );
233
- $errorArray[] = $error;
234
- } else if (!wp_verify_nonce($nonce, "chaty_send_message_to_owner")) {
235
- $error = array(
236
- 'key' => "nonce",
237
- "message" => "Your request is not valid"
238
- );
239
- $errorArray[] = $error;
240
- }
241
- }
242
- if (empty($errorArray)) {
243
- global $current_user;
244
- $text_message = $textarea_text;
245
- $email = $user_email;
246
- $domain = site_url();
247
- $user_name = $current_user->first_name . " " . $current_user->last_name;
248
- $subject = "Chaty request: " . $domain;
249
- $headers = "MIME-Version: 1.0\r\n";
250
- $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
251
- $headers .= 'From: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
252
- $headers .= 'Reply-To: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
253
- $headers .= 'X-Mailer: PHP/' . phpversion();
254
- ob_start();
255
- ?>
256
- <table border="0" cellspacing="0" cellpadding="5">
257
- <tr>
258
- <th>Domain</th>
259
- <td><?php echo esc_url($domain) ?></td>
260
- </tr>
261
- <tr>
262
- <th>Email</th>
263
- <td><?php esc_attr_e($email, CHT_OPT) ?></td>
264
- </tr>
265
- <tr>
266
- <th>Message</th>
267
- <td><?php esc_attr_e(nl2br($text_message), CHT_OPT) ?></td>
268
- </tr>
269
- </table>
270
- <?php
271
- $message = ob_get_clean();
272
- $email_id = "gal@premio.io";
273
- $status = wp_mail($email_id, $subject, $message, $headers);
274
- if ($status) {
275
- $response['status'] = 1;
276
- } else {
277
- $response['status'] = 0;
278
- $response['message'] = "Not able to send mail";
279
- }
280
- } else {
281
- $response['error'] = 1;
282
- $response['errors'] = $errorArray;
283
- }
284
- echo json_encode($response);
285
- wp_die();
286
  }
287
 
288
  public function del_space($text)
@@ -303,8 +186,8 @@ class CHT_Admin_Base
303
  }
304
  #toplevel_page_chaty-app .dashicons-before{
305
  background-color: #A0A3A8;
306
- -webkit-mask: url('<?php echo esc_url(plugins_url('../icon/chaty.svg', __FILE__)) ?>') no-repeat center;
307
- mask: url('<?php echo esc_url(plugins_url('../icon/chaty.svg', __FILE__)) ?>') no-repeat center;
308
  }
309
  .current#toplevel_page_chaty-app .dashicons-before{
310
  background-color: #fff;
@@ -314,6 +197,7 @@ class CHT_Admin_Base
314
  echo ob_get_clean();
315
  }
316
 
 
317
  public function enqueue_styles()
318
  {
319
  $query_args = array(
@@ -321,20 +205,21 @@ class CHT_Admin_Base
321
  'subset' => 'latin,latin-ext'
322
  );
323
  wp_enqueue_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
324
- wp_enqueue_style($this->plugin_slug . 'spectrum', plugins_url('../assets/css/spectrum.min.css', __FILE__), array(), CHT_VERSION);
325
- wp_enqueue_style($this->plugin_slug, plugins_url('../assets/css/cht-style.css', __FILE__), array(), CHT_VERSION);
326
  }
327
 
 
328
  public function enqueue_scripts()
329
  {
330
  $is_shown = get_option("chaty_update_message");
331
  if($is_shown !== false) {
332
  wp_enqueue_script($this->plugin_slug . '-jq-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js');
333
- wp_enqueue_script($this->plugin_slug . 'fileinput', plugins_url('../assets/js/fileinput.min.js', __FILE__), array('jquery'), CHT_VERSION);
334
- wp_enqueue_script($this->plugin_slug . 'spectrum', plugins_url('../assets/js/spectrum.min.js', __FILE__), array('jquery'), CHT_VERSION);
335
- wp_enqueue_script($this->plugin_slug . 'pop', plugins_url('../assets/js/popper.min.js', __FILE__), array('jquery'), CHT_VERSION);
336
- wp_enqueue_script($this->plugin_slug, plugins_url('../assets/js/cht-scripts.min.js', __FILE__), array('jquery', 'wp-color-picker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'), CHT_VERSION);
337
- wp_enqueue_script($this->plugin_slug . 'stick', plugins_url('../assets/js/jquery.sticky.js', __FILE__), array('jquery'), CHT_VERSION);
338
  wp_localize_script($this->plugin_slug . 'stick', 'cht_nonce_ajax',
339
  array(
340
  'cht_nonce' => wp_create_nonce('cht_nonce_ajax')
@@ -352,7 +237,7 @@ class CHT_Admin_Base
352
  'manage_options',
353
  $this->plugin_slug,
354
  array($this, 'display_cht_admin_page'),
355
- plugins_url('chaty/icon/chaty.svg')
356
  );
357
 
358
  add_submenu_page(
@@ -389,43 +274,36 @@ class CHT_Admin_Base
389
  add_action('admin_print_scripts-' . $this->page, array($this, 'enqueue_scripts'));
390
  }
391
 
392
- public function chaty_widget_page()
393
- {
394
- include_once CHT_DIR . '/views/parts/chaty_widget.php';
395
- }
396
-
397
- public function check_page_available()
398
- {
399
-
400
- }
401
-
402
  public function getUpgradeMenuItemUrl()
403
  {
404
  return CHT_PRO_URL;
405
  }
406
 
 
 
 
 
407
 
 
408
  public function display_cht_admin_page()
409
  {
410
  $is_shown = get_option("chaty_update_message");
411
  if($is_shown === false) {
412
- include_once CHT_DIR . '/views/update.php';
413
  } else {
414
- $fonts = self::get_font_list();
415
- $current_count = self::get_current_count();
416
  $channel_class = "";
417
- if($current_count <= 35) {
418
- $channel_class = "update-chaty-counter";
419
- }
420
- include_once CHT_DIR . '/views/admin.php';
421
  }
422
  }
423
 
424
  public function display_cht_admin_upgrade_page()
425
  {
426
- include_once CHT_DIR . '/views/upgrade.php';
427
  }
428
 
 
429
  protected function get_token()
430
  {
431
  return get_option('cht_license_key');
@@ -440,18 +318,16 @@ class CHT_Admin_Base
440
 
441
  public function is_pro($token = '')
442
  {
443
- if ($token === '') {
444
- $token = $this->get_token();
445
- }
446
  return false;
447
  }
448
 
449
  public function data_has_expired()
450
  {
451
- return strtotime(date('Y-m-d')) > strtotime(date('Y-m-d', strtotime($this->data_activ())));
452
  }
453
 
454
- public function data_activ()
 
455
  {
456
  if (!$this->is_pro()) return;
457
  $body = null;
@@ -461,6 +337,7 @@ class CHT_Admin_Base
461
  if (isset($body->expired_date)) return $body->expired_date->date;
462
  }
463
 
 
464
  public function data_check()
465
  {
466
  if ($this->is_pro()) {
@@ -468,6 +345,7 @@ class CHT_Admin_Base
468
  };
469
  }
470
 
 
471
  public function get_current_color()
472
  {
473
  $def_color = get_option('cht_color');
@@ -482,6 +360,7 @@ class CHT_Admin_Base
482
  return $color;
483
  }
484
 
 
485
  public function get_position_style()
486
  {
487
  $position = get_option('cht_position');
@@ -504,13 +383,6 @@ class CHT_Admin_Base
504
  return $pos_style;
505
  }
506
 
507
- public static function chaty_sanitize_options($value)
508
- {
509
- $value = stripslashes($value);
510
- $value = filter_var($value, FILTER_SANITIZE_STRING);
511
- return $value;
512
- }
513
-
514
  public function cht_register_inputs()
515
  {
516
  /**
@@ -617,25 +489,20 @@ class CHT_Admin_Base
617
  }
618
  }
619
 
 
620
  public function device()
621
  {
622
  return 'desktop_active mobile_active';
623
- // if (isset(get_option('cht_devices')['desktop']) && isset(get_option('cht_devices')['mobile'])) {
624
- // return 'desktop_active mobile_active';
625
- // } else if (isset(get_option('cht_devices')['mobile'])) {
626
- // return 'mobile_active';
627
- // } else if (isset(get_option('cht_devices')['desktop'])) {
628
- // return 'desktop_active';
629
- // }
630
- // return 'none';
631
  }
632
 
 
633
  public function getCustomWidgetImg()
634
  {
635
  $value = get_option('cht_widget_img');
636
  return isset($value['url']) ? $value['url'] : '';
637
  }
638
 
 
639
  public function uploadCustomWidget($value, $old_value, $option)
640
  {
641
  $option = !empty($option) ? $option : 'cht_widget_img';
@@ -665,6 +532,7 @@ class CHT_Admin_Base
665
  return '';
666
  }
667
 
 
668
  public function getCallToAction()
669
  {
670
  if (get_option('cht_cta')) {
@@ -1597,6 +1465,121 @@ class CHT_Admin_Base
1597
  'Zilla Slab Highlight' => 'Google Fonts',
1598
  );
1599
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1600
  }
1601
 
1602
  new CHT_Admin_Base();
16
  public $page;
17
  public $socials;
18
  public $fa_icons;
19
+ public $widget_index = '';
20
  public $colors;
21
  protected $token;
22
  protected static $response = null;
39
  // Adds all of the options for the administrative settings
40
  add_action('admin_init', array($this, 'cht_register_inputs'));
41
  add_action('admin_head', array($this, 'cht_inline_css_admin'));
 
42
  }
43
  // add_action('updated_option', array($this, 'cht_clear_all_caches'));
44
 
57
  add_action( 'plugins_loaded', array( $this, 'chaty_text' ) );
58
  }
59
 
60
+ public function plugin_action_links($links)
61
+ {
62
+ $links['need_help'] = '<a target="_blank" href="https://premio.io/help/chaty/?utm_source=pluginspage" >'.__( 'Need help?', CHT_OPT ).'</a>';
63
+ $links['go_pro'] = '<a href="' . CHT_PRO_URL . '" class="chaty-plugins-gopro">' . esc_attr__('Upgrade', CHT_OPT) . '</a>';
64
+ wp_register_style('chaty-admin-custom-style', CHT_PLUGIN_URL . '/assets/css/admin-cht-style.css');
65
+ wp_enqueue_style('chaty-admin-custom-style');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
+ return $links;
 
 
 
 
 
68
  }
69
 
 
 
70
  /* chaty_plugin_deactivate start */
71
  public function chaty_plugin_deactivate()
72
  {
148
  wp_die();
149
  }
150
 
151
+ /* function to sanitize input values */
152
+ public static function chaty_sanitize_options($value)
153
+ {
154
+ $value = stripslashes($value);
155
+ $value = filter_var($value, FILTER_SANITIZE_STRING);
156
+ return $value;
157
+ }
158
+
159
+ // add popup model html on Plugin List page
160
  public function add_deactivate_modal()
161
  {
162
  global $pagenow;
165
  return;
166
  }
167
 
168
+ include CHT_DIR . '/views/admin/chaty-deactivate-form.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  }
170
 
171
  public function del_space($text)
186
  }
187
  #toplevel_page_chaty-app .dashicons-before{
188
  background-color: #A0A3A8;
189
+ -webkit-mask: url('<?php echo esc_url(plugins_url('chaty/admin/assets/images/chaty.svg')) ?>') no-repeat center;
190
+ mask: url('<?php echo esc_url(plugins_url('chaty/admin/assets/images/chaty.svg')) ?>') no-repeat center;
191
  }
192
  .current#toplevel_page_chaty-app .dashicons-before{
193
  background-color: #fff;
197
  echo ob_get_clean();
198
  }
199
 
200
+ /* admin css files */
201
  public function enqueue_styles()
202
  {
203
  $query_args = array(
205
  'subset' => 'latin,latin-ext'
206
  );
207
  wp_enqueue_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
208
+ wp_enqueue_style($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/css/spectrum.min.css', __FILE__), array(), CHT_VERSION);
209
+ wp_enqueue_style($this->plugin_slug, plugins_url('../admin/assets/css/cht-style.css', __FILE__), array(), CHT_VERSION);
210
  }
211
 
212
+ /* admin js files */
213
  public function enqueue_scripts()
214
  {
215
  $is_shown = get_option("chaty_update_message");
216
  if($is_shown !== false) {
217
  wp_enqueue_script($this->plugin_slug . '-jq-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js');
218
+ wp_enqueue_script($this->plugin_slug . 'fileinput', plugins_url('../admin/assets/js/fileinput.min.js', __FILE__), array('jquery'), CHT_VERSION);
219
+ wp_enqueue_script($this->plugin_slug . 'spectrum', plugins_url('../admin/assets/js/spectrum.min.js', __FILE__), array('jquery'), CHT_VERSION);
220
+ wp_enqueue_script($this->plugin_slug . 'pop', plugins_url('../admin/assets/js/popper.min.js', __FILE__), array('jquery'), CHT_VERSION);
221
+ wp_enqueue_script($this->plugin_slug, plugins_url('../admin/assets/js/cht-scripts.min.js', __FILE__), array('jquery', 'wp-color-picker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'), CHT_VERSION);
222
+ wp_enqueue_script($this->plugin_slug . 'stick', plugins_url('../admin/assets/js/jquery.sticky.js', __FILE__), array('jquery'), CHT_VERSION);
223
  wp_localize_script($this->plugin_slug . 'stick', 'cht_nonce_ajax',
224
  array(
225
  'cht_nonce' => wp_create_nonce('cht_nonce_ajax')
237
  'manage_options',
238
  $this->plugin_slug,
239
  array($this, 'display_cht_admin_page'),
240
+ plugins_url('chaty/admin/assets/images/chaty.svg')
241
  );
242
 
243
  add_submenu_page(
274
  add_action('admin_print_scripts-' . $this->page, array($this, 'enqueue_scripts'));
275
  }
276
 
277
+ /* returns upgrade menu item url */
 
 
 
 
 
 
 
 
 
278
  public function getUpgradeMenuItemUrl()
279
  {
280
  return CHT_PRO_URL;
281
  }
282
 
283
+ public function chaty_widget_page()
284
+ {
285
+ include_once CHT_DIR . '/views/admin/chaty_widget.php';
286
+ }
287
 
288
+ /* chaty admin page for settings */
289
  public function display_cht_admin_page()
290
  {
291
  $is_shown = get_option("chaty_update_message");
292
  if($is_shown === false) {
293
+ include_once CHT_DIR . '/views/admin/update.php';
294
  } else {
 
 
295
  $channel_class = "";
296
+ $fonts = self::get_font_list();
297
+ include_once CHT_DIR . '/views/admin/admin.php';
 
 
298
  }
299
  }
300
 
301
  public function display_cht_admin_upgrade_page()
302
  {
303
+ include_once CHT_DIR . '/views/admin/upgrade.php';
304
  }
305
 
306
+ /* returns EDD token */
307
  protected function get_token()
308
  {
309
  return get_option('cht_license_key');
318
 
319
  public function is_pro($token = '')
320
  {
 
 
 
321
  return false;
322
  }
323
 
324
  public function data_has_expired()
325
  {
326
+ return strtotime(date('Y-m-d')) > strtotime(date('Y-m-d', strtotime($this->active_license())));
327
  }
328
 
329
+ /* checking for license is expired or not */
330
+ public function active_license()
331
  {
332
  if (!$this->is_pro()) return;
333
  $body = null;
337
  if (isset($body->expired_date)) return $body->expired_date->date;
338
  }
339
 
340
+ /* checking for license key */
341
  public function data_check()
342
  {
343
  if ($this->is_pro()) {
345
  };
346
  }
347
 
348
+ /* get current color for widget */
349
  public function get_current_color()
350
  {
351
  $def_color = get_option('cht_color');
360
  return $color;
361
  }
362
 
363
+ /* checking for widget position */
364
  public function get_position_style()
365
  {
366
  $position = get_option('cht_position');
383
  return $pos_style;
384
  }
385
 
 
 
 
 
 
 
 
386
  public function cht_register_inputs()
387
  {
388
  /**
489
  }
490
  }
491
 
492
+ /* checking for devices desktop/mobile */
493
  public function device()
494
  {
495
  return 'desktop_active mobile_active';
 
 
 
 
 
 
 
 
496
  }
497
 
498
+ /* return custom widget URL if uploaded */
499
  public function getCustomWidgetImg()
500
  {
501
  $value = get_option('cht_widget_img');
502
  return isset($value['url']) ? $value['url'] : '';
503
  }
504
 
505
+ /* uploads custom widget image */
506
  public function uploadCustomWidget($value, $old_value, $option)
507
  {
508
  $option = !empty($option) ? $option : 'cht_widget_img';
532
  return '';
533
  }
534
 
535
+ /* returns CTA text */
536
  public function getCallToAction()
537
  {
538
  if (get_option('cht_cta')) {
1465
  'Zilla Slab Highlight' => 'Google Fonts',
1466
  );
1467
  }
1468
+
1469
+ public function chaty_text() {
1470
+ load_plugin_textdomain("chaty", FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
1471
+ }
1472
+
1473
+ public function chaty_update_status() {
1474
+ if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'chaty_update_status')) {
1475
+ $status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING);
1476
+ $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
1477
+ update_option("chaty_update_message", 2);
1478
+ if($status == 1) {
1479
+ $url = 'https://go.premio.io/api/update.php?email='.$email.'&plugin=chaty';
1480
+ $handle = curl_init();
1481
+ curl_setopt($handle, CURLOPT_URL, $url);
1482
+ curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
1483
+ $response = curl_exec($handle);
1484
+ curl_close($handle);
1485
+ }
1486
+ }
1487
+ }
1488
+
1489
+ public function wcp_admin_send_message_to_owner()
1490
+ {
1491
+ $response = array();
1492
+ $response['status'] = 0;
1493
+ $response['error'] = 0;
1494
+ $response['errors'] = array();
1495
+ $response['message'] = "";
1496
+ $errorArray = [];
1497
+ $errorMessage = esc_attr__("%s is required", CHT_OPT);
1498
+
1499
+ $textarea_text = filter_input(INPUT_POST, 'textarea_text', FILTER_SANITIZE_STRING);
1500
+ $user_email = filter_input(INPUT_POST, 'user_email', FILTER_SANITIZE_EMAIL);
1501
+ $nonce = filter_input(INPUT_POST, 'nonce', FILTER_SANITIZE_STRING);
1502
+
1503
+ if (empty($textarea_text)) {
1504
+ $error = array(
1505
+ "key" => "textarea_text",
1506
+ "message" => esc_attr__("Please enter your message", "wcp")
1507
+ );
1508
+ $errorArray[] = $error;
1509
+ }
1510
+ if (empty($user_email)) {
1511
+ $error = array(
1512
+ "key" => "user_email",
1513
+ "message" => sprintf($errorMessage, esc_attr__("Email", "wcp"))
1514
+ );
1515
+ $errorArray[] = $error;
1516
+ } else if (!filter_var($user_email, FILTER_VALIDATE_EMAIL)) {
1517
+ $error = array(
1518
+ 'key' => "user_email",
1519
+ "message" => "Email is not valid"
1520
+ );
1521
+ $errorArray[] = $error;
1522
+ }
1523
+ if (empty($errorArray)) {
1524
+ if (empty($nonce)) {
1525
+ $error = array(
1526
+ 'key' => "nonce",
1527
+ "message" => "Your request is not valid"
1528
+ );
1529
+ $errorArray[] = $error;
1530
+ } else if (!wp_verify_nonce($nonce, "chaty_send_message_to_owner")) {
1531
+ $error = array(
1532
+ 'key' => "nonce",
1533
+ "message" => "Your request is not valid"
1534
+ );
1535
+ $errorArray[] = $error;
1536
+ }
1537
+ }
1538
+ if (empty($errorArray)) {
1539
+ global $current_user;
1540
+ $text_message = $textarea_text;
1541
+ $email = $user_email;
1542
+ $domain = site_url();
1543
+ $user_name = $current_user->first_name . " " . $current_user->last_name;
1544
+ $subject = "Chaty request: " . $domain;
1545
+ $headers = "MIME-Version: 1.0\r\n";
1546
+ $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
1547
+ $headers .= 'From: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
1548
+ $headers .= 'Reply-To: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
1549
+ $headers .= 'X-Mailer: PHP/' . phpversion();
1550
+ ob_start();
1551
+ ?>
1552
+ <table border="0" cellspacing="0" cellpadding="5">
1553
+ <tr>
1554
+ <th>Domain</th>
1555
+ <td><?php echo esc_url($domain) ?></td>
1556
+ </tr>
1557
+ <tr>
1558
+ <th>Email</th>
1559
+ <td><?php esc_attr_e($email, CHT_OPT) ?></td>
1560
+ </tr>
1561
+ <tr>
1562
+ <th>Message</th>
1563
+ <td><?php esc_attr_e(nl2br($text_message), CHT_OPT) ?></td>
1564
+ </tr>
1565
+ </table>
1566
+ <?php
1567
+ $message = ob_get_clean();
1568
+ $email_id = "gal@premio.io";
1569
+ $status = wp_mail($email_id, $subject, $message, $headers);
1570
+ if ($status) {
1571
+ $response['status'] = 1;
1572
+ } else {
1573
+ $response['status'] = 0;
1574
+ $response['message'] = "Not able to send mail";
1575
+ }
1576
+ } else {
1577
+ $response['error'] = 1;
1578
+ $response['errors'] = $errorArray;
1579
+ }
1580
+ echo json_encode($response);
1581
+ wp_die();
1582
+ }
1583
  }
1584
 
1585
  new CHT_Admin_Base();
admin/class-social-icons.php CHANGED
@@ -10,6 +10,7 @@ class CHT_Social_Icons
10
 
11
  public static function get_instance()
12
  {
 
13
  if (!self::$instance) {
14
  self::$instance = new CHT_Social_Icons;
15
  }
@@ -17,6 +18,7 @@ class CHT_Social_Icons
17
  return self::$instance;
18
  }
19
 
 
20
  public function get_colors()
21
  {
22
  return array(
@@ -30,6 +32,7 @@ class CHT_Social_Icons
30
  );
31
  }
32
 
 
33
  public function get_widget_types()
34
  {
35
  return [
@@ -41,6 +44,7 @@ class CHT_Social_Icons
41
  ];
42
  }
43
 
 
44
  public function get_icons_list()
45
  {
46
  return array(
@@ -79,8 +83,18 @@ class CHT_Social_Icons
79
  'slug' => 'Instagram',
80
  'title' => 'Instagram',
81
  'color' => '#ffffff',
82
- 'svg' => '<defs><linearGradient id="linear-gradient" x1="0.892" y1="0.192" x2="0.128" y2="0.85" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#4a64d5"/><stop offset="0.322" stop-color="#9737bd"/><stop offset="0.636" stop-color="#f15540"/><stop offset="1" stop-color="#fecc69"/></linearGradient></defs><circle class="color-element" cx="19.5" cy="19.5" r="19.5" fill="url(#linear-gradient)"/>
83
- <path id="Path_1923" data-name="Path 1923" d="M13.177,0H5.022A5.028,5.028,0,0,0,0,5.022v8.155A5.028,5.028,0,0,0,5.022,18.2h8.155A5.028,5.028,0,0,0,18.2,13.177V5.022A5.028,5.028,0,0,0,13.177,0Zm3.408,13.177a3.412,3.412,0,0,1-3.408,3.408H5.022a3.411,3.411,0,0,1-3.408-3.408V5.022A3.412,3.412,0,0,1,5.022,1.615h8.155a3.412,3.412,0,0,1,3.408,3.408v8.155Z" transform="translate(10 10.4)" fill="#fff"/><path id="Path_1924" data-name="Path 1924" d="M45.658,40.97a4.689,4.689,0,1,0,4.69,4.69A4.695,4.695,0,0,0,45.658,40.97Zm0,7.764a3.075,3.075,0,1,1,3.075-3.075A3.078,3.078,0,0,1,45.658,48.734Z" transform="translate(-26.558 -26.159)" fill="#fff"/><path id="Path_1925" data-name="Path 1925" d="M120.105,28.251a1.183,1.183,0,1,0,.838.347A1.189,1.189,0,0,0,120.105,28.251Z" transform="translate(-96.119 -14.809)" fill="#fff"/>'
 
 
 
 
 
 
 
 
 
 
84
  ),
85
  array(
86
  'example' => 'myusername',
@@ -102,8 +116,7 @@ class CHT_Social_Icons
102
  'help' => '',
103
  'help_title' => "Find your link",
104
  'help_link' => "https://developers.line.biz/en/docs/messaging-api/sharing-bot/#url-scheme-to-link-to-the-add-friend-screen",
105
- 'svg' => '
106
- <circle class="color-element" cx="19.4395" cy="19.4395" r="19.4395" fill="#38B900"></circle>
107
  <path d="M24 9.36561C24 4.19474 18.6178 0 12 0C5.38215 0 0 4.19474 0 9.36561C0 13.9825 4.25629 17.8606 10.0229 18.5993C10.4073 18.6785 10.9565 18.8368 11.0664 19.1797C11.1762 19.4699 11.1487 19.9184 11.0938 20.235C11.0938 20.235 10.9565 21.0528 10.9291 21.2111C10.8741 21.5013 10.6819 22.3456 11.9725 21.8443C13.2632 21.3167 18.8924 17.9398 21.3913 15.1433C23.1487 13.2702 24 11.4234 24 9.36561Z" transform="translate(7 10)" fill="white"></path>
108
  <path d="M1.0984 0H0.24714C0.10984 0 -2.09503e-07 0.105528 -2.09503e-07 0.211056V5.22364C-2.09503e-07 5.35555 0.10984 5.43469 0.24714 5.43469H1.0984C1.2357 5.43469 1.34554 5.32917 1.34554 5.22364V0.211056C1.34554 0.105528 1.2357 0 1.0984 0Z" transform="translate(15.4577 16.8593)" fill="#38B900" class="color-element"></path>
109
  <path d="M4.66819 0H3.81693C3.67963 0 3.56979 0.105528 3.56979 0.211056V3.19222L1.18078 0.0791458C1.18078 0.0791458 1.18078 0.0527642 1.15332 0.0527642C1.15332 0.0527642 1.15332 0.0527641 1.12586 0.0263821C1.12586 0.0263821 1.12586 0.0263821 1.0984 0.0263821H0.247139C0.10984 0.0263821 4.19006e-07 0.13191 4.19006e-07 0.237438V5.25002C4.19006e-07 5.38193 0.10984 5.46108 0.247139 5.46108H1.0984C1.2357 5.46108 1.34554 5.35555 1.34554 5.25002V2.26885L3.73455 5.38193C3.76201 5.40831 3.76201 5.43469 3.78947 5.43469C3.78947 5.43469 3.78947 5.43469 3.81693 5.43469C3.81693 5.43469 3.81693 5.43469 3.84439 5.43469C3.87185 5.43469 3.87185 5.43469 3.89931 5.43469H4.75057C4.88787 5.43469 4.99771 5.32917 4.99771 5.22364V0.211056C4.91533 0.105528 4.80549 0 4.66819 0Z" transform="translate(17.6819 16.8593)" fill="#38B900" class="color-element"></path>
10
 
11
  public static function get_instance()
12
  {
13
+ // If the single instance hasn't been set, set it now.
14
  if (!self::$instance) {
15
  self::$instance = new CHT_Social_Icons;
16
  }
18
  return self::$instance;
19
  }
20
 
21
+ /* List of colors for widget */
22
  public function get_colors()
23
  {
24
  return array(
32
  );
33
  }
34
 
35
+ /* List of button types for widget */
36
  public function get_widget_types()
37
  {
38
  return [
44
  ];
45
  }
46
 
47
+ /* Social icon list for admin */
48
  public function get_icons_list()
49
  {
50
  return array(
83
  'slug' => 'Instagram',
84
  'title' => 'Instagram',
85
  'color' => '#ffffff',
86
+ 'svg' => '<defs>
87
+ <linearGradient id="linear-gradient" x1="0.892" y1="0.192" x2="0.128" y2="0.85" gradientUnits="objectBoundingBox">
88
+ <stop offset="0" stop-color="#4a64d5"/>
89
+ <stop offset="0.322" stop-color="#9737bd"/>
90
+ <stop offset="0.636" stop-color="#f15540"/>
91
+ <stop offset="1" stop-color="#fecc69"/>
92
+ </linearGradient>
93
+ </defs>
94
+ <circle class="color-element" cx="19.5" cy="19.5" r="19.5" fill="url(#linear-gradient)"/>
95
+ <path id="Path_1923" data-name="Path 1923" d="M13.177,0H5.022A5.028,5.028,0,0,0,0,5.022v8.155A5.028,5.028,0,0,0,5.022,18.2h8.155A5.028,5.028,0,0,0,18.2,13.177V5.022A5.028,5.028,0,0,0,13.177,0Zm3.408,13.177a3.412,3.412,0,0,1-3.408,3.408H5.022a3.411,3.411,0,0,1-3.408-3.408V5.022A3.412,3.412,0,0,1,5.022,1.615h8.155a3.412,3.412,0,0,1,3.408,3.408v8.155Z" transform="translate(10 10.4)" fill="#fff"/>
96
+ <path id="Path_1924" data-name="Path 1924" d="M45.658,40.97a4.689,4.689,0,1,0,4.69,4.69A4.695,4.695,0,0,0,45.658,40.97Zm0,7.764a3.075,3.075,0,1,1,3.075-3.075A3.078,3.078,0,0,1,45.658,48.734Z" transform="translate(-26.558 -26.159)" fill="#fff"/>
97
+ <path id="Path_1925" data-name="Path 1925" d="M120.105,28.251a1.183,1.183,0,1,0,.838.347A1.189,1.189,0,0,0,120.105,28.251Z" transform="translate(-96.119 -14.809)" fill="#fff"/>'
98
  ),
99
  array(
100
  'example' => 'myusername',
116
  'help' => '',
117
  'help_title' => "Find your link",
118
  'help_link' => "https://developers.line.biz/en/docs/messaging-api/sharing-bot/#url-scheme-to-link-to-the-add-friend-screen",
119
+ 'svg' => '<circle class="color-element" cx="19.4395" cy="19.4395" r="19.4395" fill="#38B900"></circle>
 
120
  <path d="M24 9.36561C24 4.19474 18.6178 0 12 0C5.38215 0 0 4.19474 0 9.36561C0 13.9825 4.25629 17.8606 10.0229 18.5993C10.4073 18.6785 10.9565 18.8368 11.0664 19.1797C11.1762 19.4699 11.1487 19.9184 11.0938 20.235C11.0938 20.235 10.9565 21.0528 10.9291 21.2111C10.8741 21.5013 10.6819 22.3456 11.9725 21.8443C13.2632 21.3167 18.8924 17.9398 21.3913 15.1433C23.1487 13.2702 24 11.4234 24 9.36561Z" transform="translate(7 10)" fill="white"></path>
121
  <path d="M1.0984 0H0.24714C0.10984 0 -2.09503e-07 0.105528 -2.09503e-07 0.211056V5.22364C-2.09503e-07 5.35555 0.10984 5.43469 0.24714 5.43469H1.0984C1.2357 5.43469 1.34554 5.32917 1.34554 5.22364V0.211056C1.34554 0.105528 1.2357 0 1.0984 0Z" transform="translate(15.4577 16.8593)" fill="#38B900" class="color-element"></path>
122
  <path d="M4.66819 0H3.81693C3.67963 0 3.56979 0.105528 3.56979 0.211056V3.19222L1.18078 0.0791458C1.18078 0.0791458 1.18078 0.0527642 1.15332 0.0527642C1.15332 0.0527642 1.15332 0.0527641 1.12586 0.0263821C1.12586 0.0263821 1.12586 0.0263821 1.0984 0.0263821H0.247139C0.10984 0.0263821 4.19006e-07 0.13191 4.19006e-07 0.237438V5.25002C4.19006e-07 5.38193 0.10984 5.46108 0.247139 5.46108H1.0984C1.2357 5.46108 1.34554 5.35555 1.34554 5.25002V2.26885L3.73455 5.38193C3.76201 5.40831 3.76201 5.43469 3.78947 5.43469C3.78947 5.43469 3.78947 5.43469 3.81693 5.43469C3.81693 5.43469 3.81693 5.43469 3.84439 5.43469C3.87185 5.43469 3.87185 5.43469 3.89931 5.43469H4.75057C4.88787 5.43469 4.99771 5.32917 4.99771 5.22364V0.211056C4.91533 0.105528 4.80549 0 4.66819 0Z" transform="translate(17.6819 16.8593)" fill="#38B900" class="color-element"></path>
assets/js/cht-front-script.js DELETED
@@ -1,533 +0,0 @@
1
- !function (t) {
2
- var e = {};
3
-
4
- function i(n) {
5
- if (e[n]) { return e[n].exports };
6
- var a = e[n] = {i: n, l: !1, exports: {}};
7
- return t[n].call(a.exports, a, a.exports, i), a.l = !0, a.exports
8
- }
9
-
10
- i.m = t, i.c = e, i.d = function (t, e, n) {
11
- i.o(t, e) || Object.defineProperty(t, e, {configurable: !1, enumerable: !0, get: n})
12
- }, i.n = function (t) {
13
- var e = t && t.__esModule ? function () {
14
- return t.default
15
- } : function () {
16
- return t
17
- };
18
- return i.d(e, "a", e), e
19
- }, i.o = function (t, e) {
20
- return Object.prototype.hasOwnProperty.call(t, e)
21
- }, i.p = "/", i(i.s = 10)
22
- }({
23
- 10: function (t, e, i) {
24
- i(11), t.exports = i(12)
25
- }, 11: function (t, e) {
26
- !function (t) {
27
- var e = chaty_settings;
28
- var isChatyInMobile = false; //initiate as false
29
- if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
30
- || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {
31
- isChatyInMobile = true;
32
- }
33
- if(isChatyInMobile) {
34
- jQuery("body").addClass("chaty-in-mobile");
35
- } else {
36
- jQuery("body").addClass("chaty-in-desktop");
37
- }
38
- function i(t) {
39
- for (var e = t + "=", i = document.cookie.split(";"), n = 0; n < i.length; n++) {
40
- for (var a = i[n]; " " == a.charAt(0);)a = a.substring(1);
41
- if (0 == a.indexOf(e))return a.substring(e.length, a.length)
42
- }
43
- return ""
44
- }
45
-
46
- var n = new Date;
47
-
48
- function a() {
49
- setInterval(function () {
50
- n.setTime(n.getTime() + 1e3), document.cookie = "display_cta=none; expires=" + n.toGMTString() + "; path=/"
51
- }, 500)
52
- }
53
-
54
- var animationTimer;
55
- var isWidgetEnabled = 0;
56
- var e = chaty_settings;
57
- var animationClass = ".i-trigger .chaty-widget-i .svg, .i-trigger .chaty-widget-i .widget-img, .i-trigger .chaty-widget-i .facustom-icon";
58
-
59
- function o(e) {
60
- var i = "", n = 0;
61
- return t.each(e.object_settings.social, function (t, a) {
62
- var mobileTarget = a.mobile_target;
63
- var desktopTarget = a.desktop_target;
64
- var linkVal;
65
- if("link" == t) {
66
- linkVal = a.value;
67
- if(linkVal.indexOf("javascript") != -1) {
68
- mobileTarget = "";
69
- desktopTarget = "";
70
- }
71
- }
72
- if("custom_link" == t) {
73
- linkVal = a.value;
74
- if(linkVal.indexOf("javascript") != -1) {
75
- mobileTarget = "";
76
- desktopTarget = "";
77
- }
78
- }
79
- var currentTarget = (jQuery("body").hasClass("chaty-in-mobile"))?mobileTarget:desktopTarget;
80
-
81
- if (!e.object_settings.isPRO && "3" == ++n)return !1;
82
-
83
- if(t == "whatsapp" && jQuery("body").hasClass("chaty-in-mobile")) {
84
- a.value = a.mobile_url;
85
- }
86
- if(t == "viber") {
87
- if(jQuery("body").hasClass("chaty-in-mobile")) {
88
- var viberVal = a.value;
89
- viberVal = viberVal.replace("+","");
90
- if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
91
- viberVal = "+"+viberVal;
92
- }
93
- a.value = viberVal;
94
- }
95
- }
96
- "linkedin" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
97
- "twitter" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="https://twitter.com/' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
98
- "instagram" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="https://www.instagram.com/' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
99
- "custom_link" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
100
- "facebook_messenger" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
101
- "google_maps" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
102
- "link" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"<p>", i += "</div>", i += "</div>"),
103
- "email" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="mailto:' + a.value + '">', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
104
- "poptin" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '">', i += a.icon, i += '<p><span class="mobile_none">"+a.title+"</p>', i += "</div>", i += "</div>"),
105
- "skype" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="skype:' + a.value + '?chat">', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
106
- "sms" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="sms:' + a.value + '">', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
107
- "snapchat" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="https://www.snapchat.com/add/' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", 1 === Object.keys(e.object_settings.social).length && (i += '<div class="snap-wee-title">', i += "<p>Snapchat</p>", i += "</div>"), i += "</div>"),
108
- "telegram" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="https://telegram.me/' + a.value + ' " target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
109
- "phone" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="tel:' + a.value + '">', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
110
- "viber" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="viber://chat?number=' + a.value+ '">', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
111
- "vkontakte" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="https://vk.me/' + a.value + ' "target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
112
- "waze" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
113
- "whatsapp" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
114
- "line" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += '<a class="chaty-'+a.slug+'" rel="noopener" href="' + a.value + '" target="'+currentTarget+ '" data-mobile-target="'+mobileTarget+'" data-desktop-target="'+desktopTarget+'" >', i += a.icon, i += "</a>", i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+"</p>", i += "</div>", i += "</div>"),
115
- "wechat" == t && (i += '<div class="chaty-widget-i chaty-main-widget '+a.is_mobile+' '+a.is_desktop+' " data-title="' + a.value + '">', i += a.icon, i += '<div class="chaty-widget-i-title">', i += "<p>"+a.title+": " + a.value + "</p>", i += "</div>", 1 === Object.keys(e.object_settings.social).length && (i += '<div class="snap-wee-title">', i += "<p>"+a.title+": " + a.value + "</p>", i += "</div>"), i += "</div>")
116
- }), i
117
- }
118
-
119
- "" != i("display_cta") && a(), token = "", jQuery(document).ready(function () {
120
- "true" == e.object_settings.active && (!function (e, n) {
121
- var a = e.object_settings.device, s = "";
122
- if ("right" == e.object_settings.position)s = "left: auto;bottom: 25px; right: 25px;"; else if ("left" == e.object_settings.position)s = "right: auto; bottom: 25px; left: 25px;"; else if ("custom" == e.object_settings.position) {
123
- var c = e.object_settings.pos_side, l = e.object_settings.bot, r = e.object_settings.side;
124
- s = "right" === c ? "left: auto; bottom: " + l + "px; right: " + r + "px" : "left: " + r + "px; bottom: " + l + "px; right: auto"
125
- }
126
- var d = e.object_settings.cta, g = "", h = e.object_settings.social;
127
- if (Object.keys(h).length >= 1 && (g = '<div class="chaty-widget ' + n + " " + a + ' " style="display:block; ' + s + '" dir="ltr">', g += '<div class="chaty-widget-is" id="transition_disabled">'), g += o(e), h = e.object_settings.social, Object.keys(h).length >= 1) {
128
- g += "</div>", g += '<div class="i-trigger">';
129
- var C = i("display_cta");
130
- var CU = current_url = window.location.origin;
131
- CU = CU.replace("https://","");
132
- CU = CU.replace("http://","");
133
- if ("" != d && "none" != C)var p = "true"; else p = "no-tooltip";
134
- g += '<div class="chaty-widget-i i-trigger-open ' + p + ' ">', g += function (t) {
135
- switch (t.object_settings.widget_type) {
136
- case"chat-image":
137
- if (t.object_settings.widget_img.length > 1)return '<div class="widget-img" style="background-color:' + t.object_settings.color + '"><img src="' + t.object_settings.widget_img + '"/></div>';
138
- case"chat-smile":
139
- return '<svg version="1.1" id="smile" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.8 507.1 54 54" style="enable-background:new -496.8 507.1 54 54;" xml:space="preserve">\n<style type="text/css">.st1{fill:#FFFFFF;} .st2{fill:none;stroke:#808080;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;}</style>\n<g><circle cx="-469.8" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g>\n<path class="st1" d="M-459.5,523.5H-482c-2.1,0-3.7,1.7-3.7,3.7v13.1c0,2.1,1.7,3.7,3.7,3.7h19.3l5.4,5.4c0.2,0.2,0.4,0.2,0.7,0.2c0.2,0,0.2,0,0.4,0c0.4-0.2,0.6-0.6,0.6-0.9v-21.5C-455.8,525.2-457.5,523.5-459.5,523.5z"/>\n<path class="st2" d="M-476.5,537.3c2.5,1.1,8.5,2.1,13-2.7"/>\n<path class="st2" d="M-460.8,534.5c-0.1-1.2-0.8-3.4-3.3-2.8"/>\n</svg>';
140
- case"chat-bubble":
141
- return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve">\n<style type="text/css">.st1{fill:#FFFFFF;}</style>\n<g><circle cx="-469.9" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g>\n<path class="st1" d="M-472.6,522.1h5.3c3,0,6,1.2,8.1,3.4c2.1,2.1,3.4,5.1,3.4,8.1c0,6-4.6,11-10.6,11.5v4.4c0,0.4-0.2,0.7-0.5,0.9\n c-0.2,0-0.2,0-0.4,0c-0.2,0-0.5-0.2-0.7-0.4l-4.6-5c-3,0-6-1.2-8.1-3.4s-3.4-5.1-3.4-8.1C-484.1,527.2-478.9,522.1-472.6,522.1z\n M-462.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-464.6,534.6-463.9,535.3-462.9,535.3z\n M-469.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-471.7,534.6-471,535.3-469.9,535.3z\n M-477,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-478.8,534.6-478.1,535.3-477,535.3z"/>\n</svg>';
142
- case"chat-db":
143
- return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.1 54 54" style="enable-background:new -496 507.1 54 54;" xml:space="preserve">\n<style type="text/css">.st1{fill:#FFFFFF;}</style>\n<g><circle cx="-469" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g>\n<path class="st1" d="M-464.6,527.7h-15.6c-1.9,0-3.5,1.6-3.5,3.5v10.4c0,1.9,1.6,3.5,3.5,3.5h12.6l5,5c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18.2C-461.1,529.3-462.7,527.7-464.6,527.7z"/>\n<path class="st1" d="M-459.4,522.5H-475c-1.9,0-3.5,1.6-3.5,3.5h13.9c2.9,0,5.2,2.3,5.2,5.2v11.6l1.9,1.9c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18C-455.9,524.1-457.5,522.5-459.4,522.5z"/>\n</svg>\n';
144
- default:
145
- return '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n<style type="text/css">.st1 {fill: #FFFFFF;}.st0{fill: #808080;}</style>\n<g><circle cx="-469" cy="534.7" r="27" fill="' + t.object_settings.color + '"/></g>\n<path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n<path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n<path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n</svg>'
146
- }
147
- }(e), C = i("display_cta"), "" != d && "none" != C && (g += ' <div class="chaty-widget-i-title true"> ', g += d, g += "</div>"), g += "</div>", g += '<div class="chaty-widget-i i-trigger-close" data-title="Hide" style="background-color:' + e.object_settings.color + '">', g += '<svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">', g += '<ellipse cx="26" cy="26" rx="26" ry="26" fill="' + e.object_settings.color + '"/>', g += '<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"/>', g += '<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"/>', g += "</svg>", g += '<div class="chaty-widget-i-title">', g += e.object_settings.button_text, g += "</div>", g += "</div>", g += " </div>", 0 === n.length && (g += '<div class="get" style="position: absolute;width: 100%;text-align: center;display: block!important; opacity: 1 !important;visibility: visible !important; top:100%; margin-top:5px;"> <a rel="noopener" href="https://premio.io/downloads/chaty/?utm_source=wpplugin&domain='+CU+'" target="_blank" style=" font-size: 11px !important; top: -5px !important; position: relative !important; color: #222 !important; font-family: Lato, Helvetica, Arial, sans-serif; display: block !important; opacity: 1 !important; visibility: visible !important; " class="chaty-get-btn">Get Chaty</a></div>'), g += "</div>"
148
-
149
- } else {
150
- var w = "";
151
-
152
- }
153
- t("body").append(g)
154
- }(e, token), t("body").append('<style></style>')), function () {
155
- var n = t(".chaty-widget"), o = e.object_settings.widget_size ? e.object_settings.widget_size : 54, s = +e.object_settings.widget_size + 8;
156
-
157
- function c() {
158
- var t = n.position().top, e = n.find(".chaty-widget-is .chaty-widget-i").length;
159
- if(jQuery("body").hasClass("chaty-in-desktop")) {
160
- e = n.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
161
- } else {
162
- e = n.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
163
- }
164
- // if (e * s > (jQuery(window).height() - (chaty_settings.object_settings.widget_size+8))) {
165
- // var i = Math.round(Math.sqrt(e)), a = Math.ceil(Math.sqrt(e));
166
- // n.find(".chaty-widget-is").css({height: a * s, width: i * s}), r(a);
167
- // n.find(".chaty-widget-is").height(e*(parseInt(s)+8));
168
- // n.find(".chaty-widget-is").width(parseInt(s)+8);
169
- // } else
170
- r()
171
- }
172
-
173
- function l() {
174
- "left" === e.object_settings.position && n.addClass("chaty-widget-is-right"), "custom" === e.object_settings.position && "left" === e.object_settings.pos_side && n.addClass("chaty-widget-is-right")
175
- }
176
-
177
- function r(t) {
178
- var e;
179
- if(jQuery("body").hasClass("chaty-in-desktop")) {
180
- e = n.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
181
- } else {
182
- e = n.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
183
- }
184
- n.find(".chaty-widget-i").css({
185
- height: o + "px",
186
- width: o + "px"
187
- }), n.find(".chaty-widget-is").css({top: "-" + 100 * e + "%"});
188
- jQuery(".chaty-widget-is").height(e*(parseInt(o)+8));
189
- jQuery(".chaty-widget-is").width(parseInt(o)+8);
190
- }
191
-
192
- l(), c(), jQuery(window).resize(function () {
193
- c();
194
- if(Object.keys(e.object_settings.social).length == 1) {
195
- jQuery(".chaty-widget").addClass("chaty-widget-show");
196
- jQuery(".chaty-widget-is").css("top", "auto");
197
- }
198
- }), t(".chaty-widget-i.facebook").mouseenter(function () {
199
- t(".facebook_two_mess").css({opacity: "1", "z-index": "1"}), t(this).addClass("before")
200
- }), t(".chaty-widget-i.facebook").mouseleave(function () {
201
- t(".facebook_two_mess").css({opacity: "0", "z-index": "1"}), t(this).removeClass("before")
202
- }), t(".chaty-widget-i.facebook").on("click", function () {
203
- t(this).addClass("active"), t(".facebook_two_mess").hide(), jQuery(".chaty-widget .get a").hide(), t(this).children(".face_title").css({
204
- opacity: "1",
205
- "z-index": "2"
206
- }).show(), t(".chaty-widget").hasClass("one_widget") ? t(".chaty-widget").hasClass("chaty-widget-is-right") ? t(".face_title").css({
207
- top: "calc(100% - 447px)",
208
- left: "20px"
209
- }) : t(".face_title").css({
210
- top: "calc(100% - 447px)",
211
- left: "auto",
212
- right: "20px"
213
- }) : (t(".facebook_two_mess").css({
214
- opacity: "0",
215
- "z-index": "10001"
216
- }), t(".ico_d").hide(), t(".chaty-widget .chaty-widget-i").css({"box-shadow": "0px 3px 6px rgba(0,0,0,0)"}), t(".chaty-widget").hasClass("one_widget") || t(".i-trigger").hide())
217
- }), t(".i-trigger-close").on("click", function (e) {
218
- e.preventDefault(), t(".chaty-widget-i.facebook").hasClass("active") || (n.removeClass("chaty-widget-show"), n.addClass("none-widget-show"))
219
- }), t("body").on("click", ".close_facebook", function () {
220
- t(".facebook_two_mess").show(), jQuery(".chaty-widget .get a").show(), t(".chaty-widget-i.facebook").removeClass("active"), t(this).parent().parent().css({opacity: "1"}).hide(), t(".i-trigger").show(), t(".chaty-widget-is .chaty-widget-i svg").show()
221
- }), t(".i-trigger-close").on("click", function (e) {
222
- t(".i-trigger-open").addClass("active_clos"), e.preventDefault(), t(".chaty-widget-i.facebook").hasClass("active") || (n.removeClass("chaty-widget-show"), n.addClass("none-widget-show"))
223
- });
224
- var d = i("display_cta");
225
- n.find(".i-trigger-open").mouseenter(function () {
226
- a(), t(".chaty-widget-is").removeAttr("id"), t(this).hasClass("active_clos") || t(".chaty-widget-i.facebook").hasClass("active") || n.hasClass("one_widget") || (l(), t(n).hasClass("chaty-widget-show") || (n.addClass("chaty-widget-show"), n.removeClass("none-widget-show")))
227
- }), t(".one_widget").on("click", function () {
228
- t(".chaty-widget-i-title").hasClass("face_title") ? (t(".facebook_two_mess").detach(), t(".chaty-widget-i").addClass("bofore_del")) : (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del"))
229
- }), n.find(".i-trigger-open").on("click", function () {
230
- "none" != d && (t(".chaty-widget").hasClass(".one_widget") || t(".i-trigger-open .chaty-widget-i-title").detach()), t(".i-trigger-open").addClass("no-tooltip"), t(this).hasClass("active_clos") || t(".chaty-widget-i.facebook").hasClass("active") || n.hasClass("one_widget") || (l(), t(n).hasClass("chaty-widget-show") || (n.addClass("chaty-widget-show"), n.removeClass("none-widget-show")))
231
- }), n.find(".i-trigger-open").mouseenter(function () {
232
- t(this).addClass("no-tooltip"), t(".i-trigger-open").removeClass("active_clos")
233
- }), n.find(".chaty-widget-is").mouseleave(function () {
234
- t(".i-trigger-open").removeClass("active_clos"), t(".chaty-widget-i.facebook").hasClass("active")
235
- }), 1 === Object.keys(e.object_settings.social).length && n.find(".i-trigger-open").on("touchstart", function (e) {
236
- "use strict";
237
- t(this).find(".chaty-widget-i").toggleClass("hover")
238
- });
239
- var activeWidget = 0;
240
- if(jQuery("body").hasClass("chaty-in-desktop")) {
241
- activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
242
- } else {
243
- activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
244
- }
245
- if(activeWidget == 0) {
246
- jQuery(".chaty-widget").addClass("hide-widget").removeClass("desktop_active").removeClass("mobile_active");
247
- } else {
248
- jQuery(".chaty-widget").removeClass("hide-widget").addClass("desktop_active").addClass("mobile_active");;
249
- if(activeWidget == 1) {
250
- jQuery(".i-trigger .chaty-widget-i").hide();
251
- if(jQuery("body").hasClass("chaty-in-desktop")) {
252
- htmlToAdd = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop:first").clone();
253
- jQuery(".i-trigger").html(htmlToAdd);
254
- } else {
255
- htmlToAdd = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile:first").clone();
256
- jQuery(".i-trigger").html(htmlToAdd);
257
- }
258
- jQuery(".chaty-widget-i-title p").text(chaty_settings.object_settings.cta);
259
- jQuery(".chaty-widget").addClass("one_widget");
260
- } else {
261
- jQuery(".chaty-widget").removeClass("one_widget");
262
- jQuery(".i-trigger .chaty-main-widget").remove();
263
- jQuery(".i-trigger .chaty-widget-i").show();
264
- }
265
- }
266
-
267
- if(activeWidget == 1) {
268
- jQuery(".chaty-widget").addClass("chaty-widget-show");
269
- jQuery(".chaty-widget-is").css("top", "auto");
270
- jQuery(".chaty-widget-is").css("z-index", "10001");
271
- jQuery(".chaty-widget-i.i-trigger-close, .i-trigger.chaty-widget-i").hide();
272
- // jQuery(".chaty-widget .get a").css("top", "-10px");
273
- jQuery(".chaty-widget").addClass("one_widget");
274
- jQuery(".chaty-widget-i:first .chaty-widget-i-title:last").html("<p>"+e.object_settings.cta+"</p>");
275
-
276
- jQuery(document).on("click", ".chaty-widget-i", function(){
277
- jQuery(".chaty-widget-i:first .chaty-widget-i-title:last").hide();
278
- jQuery("body").addClass("hide-cht-widget");
279
- });
280
- jQuery("body").append("<style>.chaty-widget-is{top:0!important;}</style>");
281
-
282
- jQuery(".chaty-main-widget").addClass("i-trigger-open").addClass("single-button");
283
-
284
- jQuery(".chaty-widget-show .i-trigger-open.single-button svg").css("transform","rotate(0deg)");
285
- }
286
-
287
- var widget_status = get_chaty_cookie("cta_widget_status");
288
- if(widget_status == "yes") {
289
- jQuery(".chaty-widget").removeClass("hide-widget");
290
- show_chaty_widget();
291
- } else {
292
- /* set animation */
293
- if (chaty_settings.object_settings.time_trigger == "no" && chaty_settings.object_settings.exit_intent == "no" && chaty_settings.object_settings.on_page_scroll == "no") {
294
- jQuery(".chaty-widget").removeClass("hide-widget");
295
- if(chaty_settings.object_settings.display_state == "open" && chaty_settings.object_settings.has_close_button == "no") {
296
- chaty_settings.object_settings.has_close_button = "no";
297
- } else {
298
- chaty_settings.object_settings.display_state = "hover";
299
- chaty_settings.object_settings.has_close_button = "yes";
300
- }
301
- show_chaty_widget();
302
- } else {
303
- jQuery(".chaty-widget").addClass("hide-widget");
304
- if (chaty_settings.object_settings.time_trigger == "yes") {
305
- setTimeout(function () {
306
- if (!isWidgetEnabled) {
307
- jQuery(".chaty-widget").removeClass("hide-widget");
308
- show_chaty_widget();
309
- }
310
- }, parseInt(chaty_settings.object_settings.trigger_time) * 1000);
311
- }
312
- if (chaty_settings.object_settings.exit_intent == "yes") {
313
- function addEvent(obj, evt, fn) {
314
- if (obj.addEventListener) {
315
- obj.addEventListener(evt, fn, false);
316
- }
317
- else if (obj.attachEvent) {
318
- obj.attachEvent("on" + evt, fn);
319
- }
320
- }
321
-
322
- addEvent(document, 'mouseout', function(evt) {
323
- if (evt.toElement == null && evt.relatedTarget == null ) {
324
- var widget_status = get_chaty_cookie("cta_exit_intent_shown");
325
- if (widget_status == null) {
326
- set_chaty_cookie("cta_exit_intent_shown","yes",1);
327
- isWidgetEnabled = true;
328
- jQuery(".chaty-widget").removeClass("hide-widget");
329
- jQuery(".chaty-widget").addClass("chaty-animation-widget");
330
- jQuery(".chaty-animation-widget").append("<div class='chaty-nav'></div>");
331
- if(chaty_settings.object_settings.display_state == "open" && chaty_settings.object_settings.has_close_button == "no") {
332
- chaty_settings.object_settings.has_close_button = "no";
333
- } else {
334
- chaty_settings.object_settings.display_state = "open";
335
- chaty_settings.object_settings.has_close_button = "yes";
336
- }
337
- show_chaty_widget();
338
- if (chaty_settings.object_settings.position == "left") {
339
- jQuery(".chaty-widget").addClass("left-position");
340
- } else if (chaty_settings.object_settings.position == "right") {
341
- jQuery(".chaty-widget").addClass("right-position");
342
- } else if (chaty_settings.object_settings.position == "custom") {
343
- if (e.object_settings.pos_side == "left") {
344
- jQuery(".chaty-widget").addClass("left-position");
345
- } else {
346
- jQuery(".chaty-widget").addClass("right-position");
347
- }
348
- }
349
- removeAnimation();
350
- setTimeout(function () {
351
- jQuery(".chaty-animation-widget").addClass("active");
352
- }, 100);
353
- setTimeout(function () {
354
- jQuery(".chaty-nav").remove();
355
- }, 2500);
356
- }
357
- }
358
- });
359
- }
360
- if (chaty_settings.object_settings.on_page_scroll == "yes") {
361
- if (parseInt(chaty_settings.object_settings.page_scroll) > 0) {
362
- jQuery(window).scroll(function () {
363
- if (!isWidgetEnabled) {
364
- var scrollHeight = jQuery(document).height() - jQuery(window).height();
365
- var scrollPos = jQuery(window).scrollTop();
366
- if (scrollPos != 0) {
367
- if (((scrollPos / scrollHeight) * 100) >= parseInt(chaty_settings.object_settings.page_scroll)) {
368
- jQuery(".chaty-widget").removeClass("hide-widget");
369
- show_chaty_widget();
370
- }
371
- }
372
- }
373
- });
374
- }
375
- }
376
- }
377
- }
378
- jQuery(".chaty-widget.one_widget, .i-trigger, .chaty-widget-i").mouseenter(function () {
379
- set_cta_status();
380
- removeAnimation();
381
- if(jQuery(".chaty-widget").hasClass("one_widget")) {
382
- jQuery(".chaty-widget-i-title").remove();
383
- jQuery(".chaty-widget").addClass("hide-cta-arrow");
384
- }
385
- });
386
- if(jQuery(".chaty-widget").hasClass("one_widget")) {
387
- if(get_chaty_cookie("display_cta") == "none") {
388
- set_cta_status();
389
- jQuery(".chaty-widget-i-title").remove();
390
- jQuery(".chaty-widget").addClass("hide-cta-arrow");
391
- }
392
- }
393
- jQuery(".chaty-widget-i-title").each(function(){
394
- if(jQuery(this).text() == "") {
395
- jQuery(this).closest(".chaty-widget-i").addClass("hide-chaty-arrow");
396
- jQuery(this).remove();
397
- }
398
- });
399
- }(), t(document).ready(function () {
400
- (1 !== Object.keys(e.object_settings.social).length || !e.object_settings.social.snapchat && !e.object_settings.social.wechat || e.object_settings.cta || (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del")), t(".chaty-widget-i-title").hasClass("one_go")) && (t(".chaty-widget-i-title p").text(t(".chaty-widget-i-title.one_go").html()), "none" == i("display_cta") && (t(".chaty-widget-i-title").hasClass("face_title") ? (t(".facebook_two_mess").detach(), t(".chaty-widget-i").addClass("bofore_del")) : (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del"))));
401
- window.matchMedia("only screen and (max-width: 760px)").matches && t(".i-trigger-open").addClass("active_clos");
402
- jQuery(".chaty-widget-i-title").each(function(){
403
- if(jQuery(this).text() == "") {
404
- jQuery(this).remove();
405
- }
406
- });
407
- });
408
-
409
-
410
- });
411
- function set_cta_status() {
412
- var n = new Date;
413
- setInterval(function () {
414
- n.setTime(n.getTime() + 1e3), document.cookie = "display_cta=none; expires=" + n.toGMTString() + "; path=/"
415
- }, 500);
416
- }
417
-
418
- function set_chaty_cookie(name,value,days) {
419
- var expires = "";
420
- if (days) {
421
- var date = new Date();
422
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
423
- expires = "; expires=" + date.toUTCString();
424
- }
425
- document.cookie = name + "=" + (value || "") + expires + "; path=/";
426
- }
427
- function get_chaty_cookie(name) {
428
- var nameEQ = name + "=";
429
- var ca = document.cookie.split(';');
430
- for(var i=0;i < ca.length;i++) {
431
- var c = ca[i];
432
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
433
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
434
- }
435
- return null;
436
- }
437
-
438
- function show_chaty_widget() {
439
- set_chaty_cookie("cta_widget_status", "yes", 1);
440
- isWidgetEnabled = 1;
441
- var activeWidget = 0;
442
- if(jQuery("body").hasClass("chaty-in-desktop")) {
443
- activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
444
- } else {
445
- activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
446
- }
447
- var chatyAnimation = get_chaty_cookie("chaty-animation");
448
- if(chatyAnimation != null) {
449
- chaty_settings.object_settings.animation_class = "";
450
- }
451
-
452
- if(chaty_settings.object_settings.animation_class != "") {
453
- if(chaty_settings.object_settings.animation_class != "sheen") {
454
- jQuery(".i-trigger .chaty-widget-i svg").wrap(function() {
455
- return "<div class='svg'></div>";
456
- });
457
- if (activeWidget > 1) {
458
- jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
459
- setTimeout(function () {
460
- jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
461
- }, 1000);
462
- animationTimer = setInterval(function () {
463
- jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
464
- setTimeout(function () {
465
- jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
466
- }, 1000);
467
- }, 5000);
468
- } else if (activeWidget == 1) {
469
- animationClass = ".chaty-main-widget svg, .chaty-main-widget img, .chaty-main-widget .facustom-icon";
470
- jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
471
- setTimeout(function () {
472
- jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
473
- }, 1000);
474
- animationTimer = setInterval(function () {
475
- jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
476
- setTimeout(function () {
477
- jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
478
- }, 1000);
479
- }, 5000);
480
- }
481
- } else {
482
- animationClass = ".i-trigger .chaty-widget-i .wrap-svg";
483
- if(!jQuery(".i-trigger .chaty-widget-i .wrap-svg").length) {
484
- jQuery(".i-trigger .chaty-widget-i svg").wrap(function() {
485
- return "<div class='wrap-svg'></div>";
486
- });
487
- }
488
- jQuery(animationClass).removeClass("chaty-animation-sheen").removeClass("start-now");
489
- setTimeout(function () {
490
- jQuery(animationClass).addClass("chaty-animation-sheen").addClass("start-now");
491
- }, 10);
492
- animationTimer = setInterval(function () {
493
- jQuery(animationClass).removeClass("chaty-animation-sheen").removeClass("start-now");
494
- setTimeout(function () {
495
- jQuery(animationClass).addClass("chaty-animation-sheen").addClass("start-now");
496
- }, 10);
497
- }, 5000);
498
- }
499
- }
500
-
501
- if(chaty_settings.object_settings.display_state == "open") {
502
- if(chaty_settings.object_settings.has_close_button == "no") {
503
- if(activeWidget > 1) {
504
- removeAnimation();
505
- jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos");
506
- jQuery(".chaty-widget").find(".i-trigger-open").trigger("click");
507
- jQuery(".chaty-widget-is").addClass("has-no-close-btn");
508
- jQuery(".i-trigger").remove();
509
- }
510
- } else {
511
- if(activeWidget > 1) {
512
- removeAnimation();
513
- jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos");
514
- jQuery(".chaty-widget").find(".i-trigger-open").trigger("click");
515
- }
516
- }
517
- }
518
- }
519
-
520
- function removeAnimation() {
521
- if(animationTimer) {
522
- clearInterval(animationTimer);
523
- animationTimer = 0;
524
- }
525
- set_chaty_cookie("chaty-animation","stop",1);
526
- jQuery(".chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
527
- jQuery(".start-now").removeClass("start-now");
528
- chaty_settings.object_settings.animation_class = "";
529
- }
530
- }(jQuery)
531
- }, 12: function (t, e) {
532
- }
533
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/cht-scripts.min.js DELETED
@@ -1,646 +0,0 @@
1
- !function (e, t) {
2
- jQuery.fn[t] = function (e) {
3
- return e ? this.bind("resize", (o = e, function () {
4
- var e = this, t = arguments;
5
- a && clearTimeout(a), a = setTimeout(function () {
6
- o.apply(e, t), a = null
7
- }, 100)
8
- })) : this.trigger(t);
9
- var o, a
10
- }
11
- }(jQuery, "smartModalResize"), function (e) {
12
- "use strict";
13
- var t = {
14
- init: function (t) {
15
- var o = {
16
- top: "auto",
17
- left: "auto",
18
- autoOpen: !1,
19
- overlayOpacity: .5,
20
- overlayColor: "#000",
21
- overlayClose: !0,
22
- overlayParent: "body",
23
- closeOnEscape: !0,
24
- closeButtonClass: ".close",
25
- transitionIn: "",
26
- transitionOut: "",
27
- onOpen: !1,
28
- onClose: !1,
29
- zIndex: function () {
30
- return (t = Math.max.apply(Math, e.makeArray(e("*").map(function () {
31
- return e(this).css("z-index")
32
- }).filter(function () {
33
- return e.isNumeric(this)
34
- }).map(function () {
35
- return parseInt(this, 10)
36
- })))) === -1 / 0 ? 0 : t + 1;
37
- var t
38
- },
39
- updateZIndexOnOpen: !0,
40
- hasVariableWidth: !1
41
- };
42
- return t = e.extend(o, t), this.each(function () {
43
- var o = t, a = e('<div class="lean-overlay"></div>'), n = e(this);
44
- a.css({
45
- display: "none",
46
- position: "fixed",
47
- "z-index": o.updateZIndexOnOpen ? 0 : o.zIndex(),
48
- top: 0,
49
- left: 0,
50
- height: "100%",
51
- width: "100%",
52
- background: o.overlayColor,
53
- opacity: o.overlayOpacity,
54
- overflow: "auto"
55
- }).appendTo(o.overlayParent), n.css({
56
- display: "none",
57
- position: "fixed",
58
- "z-index": o.updateZIndexOnOpen ? 0 : o.zIndex() + 1,
59
- left: parseInt(o.left, 10) > -1 ? o.left + "px" : "50%",
60
- top: parseInt(o.top, 10) > -1 ? o.top + "px" : "50%"
61
- }), n.bind("openModal", function () {
62
- var e = o.updateZIndexOnOpen ? o.zIndex() : parseInt(a.css("z-index"), 10), t = e + 1;
63
- "" !== o.transitionIn && "" !== o.transitionOut && n.removeClass(o.transitionOut).addClass(o.transitionIn), n.css({
64
- display: "block",
65
- "margin-left": (parseInt(o.left, 10) > -1 ? 0 : -n.outerWidth() / 2) + "px",
66
- "margin-top": (parseInt(o.top, 10) > -1 ? 0 : -n.outerHeight() / 2) + "px",
67
- "z-index": t
68
- }), a.css({
69
- "z-index": e,
70
- display: "block"
71
- }), o.onOpen && "function" == typeof o.onOpen && o.onOpen(n[0])
72
- }), n.bind("closeModal", function () {
73
- "" !== o.transitionIn && "" !== o.transitionOut ? (n.removeClass(o.transitionIn).addClass(o.transitionOut), n.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
74
- n.css("display", "none"), a.css("display", "none")
75
- })) : (n.css("display", "none"), a.css("display", "none")), o.onClose && "function" == typeof o.onClose && o.onClose(n[0])
76
- }), a.click(function () {
77
- o.overlayClose && n.trigger("closeModal")
78
- }), e(document).keydown(function (e) {
79
- o.closeOnEscape && 27 === e.keyCode && n.trigger("closeModal")
80
- }), e(window).smartModalResize(function () {
81
- o.hasVariableWidth && n.css({
82
- "margin-left": (parseInt(o.left, 10) > -1 ? 0 : -n.outerWidth() / 2) + "px",
83
- "margin-top": (parseInt(o.top, 10) > -1 ? 0 : -n.outerHeight() / 2) + "px"
84
- })
85
- }), n.on("click", o.closeButtonClass, function (e) {
86
- n.trigger("closeModal"), e.preventDefault()
87
- }), o.autoOpen && n.trigger("openModal")
88
- })
89
- }
90
- };
91
- e.fn.easyModal = function (o) {
92
- return t[o] ? t[o].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof o && o ? void e.error("Method " + o + " does not exist on jQuery.easyModal") : t.init.apply(this, arguments)
93
- }
94
- }(jQuery), function (e) {
95
- e(document).ready(function () {
96
- e("input, .icon, textarea, .btn-cancel ").click(function (e) {
97
- window.onbeforeunload = function (e) {
98
- (e = e || window.event).preventDefault = !0, e.cancelBubble = !0, e.returnValue = "Your beautiful goodbye message"
99
- }
100
- }), e(document).on("submit", "form", function (e) {
101
- window.onbeforeunload = null
102
- }), /*e(".preview").stick_in_parent({offset_top: 200}),*/ e(".upg").click(function (t) {
103
- e(".valid_domain_input").val(e(".valid_domain_input").val().replace(" ", "")), /^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(e(".valid_domain_input").val()) || (t.preventDefault(), e(".valid_domain").fadeIn().css({display: "block"}))
104
- }), e(".del_token").click(function (t) {
105
- e.ajax({
106
- type: "POST",
107
- url: ajaxurl,
108
- data: {action: "del_token", nonce_code: cht_nonce_ajax.cht_nonce},
109
- success: function (e) {
110
- location.reload()
111
- },
112
- error: function (e, t, o) {
113
- }
114
- })
115
- }), e(".easy-modal").easyModal({top: 150, overlay: .2}), e(".easy-modal-open").click(function (t) {
116
- var o = e(this).attr("href");
117
- e(o).trigger("openModal"), t.preventDefault()
118
- }), e(".easy-modal-close").click(function (t) {
119
- t.preventDefault(), e(".easy-modal").trigger("closeModal")
120
- });
121
- var t = 1000000003;
122
- e(".show_up").click(function () {
123
- t += 10, e("#upgrade-modal").css({"z-index": t, display: "block", "margin-left": "-258px"})
124
- }), e(".color-picker-btn, .color-picker-btn-close, .color-picker-custom button").on("click", function (t) {
125
- t.preventDefault(), e(".color-picker").toggle(), e(".color-picker-btn").toggle()
126
- }), e(".color-picker-radio input").change(function () {
127
- var t = e(this);
128
- if (e('.color-picker-custom input[name="cht_custom_color"]').val(""), e(".color-picker-custom .circle").html("?").css({"background-color": "#fff"}), t.prop("checked")) {
129
- e(".color-picker-radio input").prop("checked", !1), t.prop("checked", !0);
130
- var o = t.val(), a = t.prop("title")
131
- } else o = e(".color-picker-custom input").val(), a = "Custom";
132
- e(".color-picker-btn .circle").css({backgroundColor: o}), e(".color-picker-btn .text").text(a)
133
- }), e(".color-picker-custom input").change(function () {
134
- e(".color-picker-radio input").prop("checked", !1);
135
- var t = e(this).val();
136
- e(".color-picker-btn .circle").css({backgroundColor: t}), e(".color-picker-btn .text").text("Custom")
137
- }), e('[name="cht_position"]').change(function () {
138
- e("#positionCustom").prop("checked") ? e("#positionPro").show() : e("#positionPro").hide()
139
- }), e(".update_token").on("click", function (t) {
140
- t.preventDefault();
141
- var o = e('input[name="cht_license_key"]').val();
142
- e.ajax({
143
- type: "POST",
144
- url: ajaxurl,
145
- data: {action: "add_token", nonce_code: cht_nonce_ajax.cht_nonce, token: o},
146
- beforeSend: function (e) {
147
- },
148
- success: function (e) {
149
- e ? (alert("Your pro plan is activated"), location.reload()) : alert("You`ve entered a wrong token")
150
- },
151
- error: function (e, t, o) {
152
- }
153
- })
154
- }), e("textarea[name=cht_cta]").keyup(function (t) {
155
- e(".chaty-widget .tooltiptext span").html(e(this).val()), 0 == e(this).val().length ? (e(".cta").hide(200), e(".chaty-widget .tooltiptext span").hide(200)) : (e(".cta").show(300), e(".chaty-widget .tooltiptext span").show(200))
156
- })
157
- })
158
- }(jQuery), function (e) {
159
- e(document).ready(function () {
160
- !function () {
161
- function t() {
162
- var t = e("#positionBottom"), o = e("#positionSide"), a = e(".preview .page .chaty-widget"), n = e('[name="cht_position"]:checked').val();
163
- if ("right" === n)a.css({
164
- right: "7px",
165
- left: "auto",
166
- bottom: "7px"
167
- }); else if ("left" === n)a.css({left: "7px", right: "auto", bottom: "7px"}); else if ("custom" === n) {
168
- if (t.val())var i = t.val() + "px"; else i = "7px";
169
- if (o.val())var c = o.val() + "px"; else c = "7px";
170
- t.change(function () {
171
- i = e("#positionBottom").val() + "px", a.css({bottom: i})
172
- }), o.change(function () {
173
- var t = e('[name="positionSide"]:checked').val();
174
- c = e(this).val() + "px", "right" === t ? (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"), a.css({
175
- right: c,
176
- left: "auto"
177
- })) : "left" === t && (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"), a.css({
178
- left: c,
179
- right: "auto"
180
- }))
181
- }), e('[name="positionSide"]').change(function () {
182
- var t = e('[name="positionSide"]:checked').val();
183
- "right" === t ? (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"), a.css({
184
- right: c,
185
- left: "auto"
186
- })) : "left" === t && (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"), a.css({
187
- left: c,
188
- right: "auto"
189
- }))
190
- })
191
- }
192
- e('[name="cht_position"]').change(function () {
193
- if (e("#positionCustom").prop("checked")) {
194
- e("#positionBottom"), e("#positionSide");
195
- var t = e(".preview .page .chaty-widget");
196
- t.css({bottom: i});
197
- var o = e('[name="positionSide"]:checked').val();
198
- c = e("#positionSide").val() + "px", "right" === o ? (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"), t.css({
199
- right: c,
200
- left: "auto"
201
- })) : "left" === o && (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"), t.css({
202
- left: c,
203
- right: "auto"
204
- }))
205
- }
206
- })
207
- }
208
-
209
- jQuery(".chaty-settings.cls-btn, button.btn-cancel.close-btn-set").click(function(){
210
- jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active");
211
- d();
212
- });
213
-
214
- jQuery(document).on("change", "#chaty_default_state", function(){
215
- d();
216
- });
217
-
218
- jQuery('#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll').click(function () {
219
- d();
220
- });
221
-
222
- jQuery(".chaty-widget").click(function(e){
223
- e.preventDefault();
224
- e.stopPropagation();
225
- e.stopImmediatePropagation();
226
- if(jQuery(this).hasClass("click")) {
227
- jQuery(".chaty-widget").toggleClass("active");
228
- }
229
- return false;
230
- });
231
-
232
- jQuery(document).on("change", "#chaty_attention_effect", function(){
233
- var currentClass = jQuery(this).attr("data-effect");
234
- if(currentClass != "") {
235
- jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
236
- }
237
- jQuery("#iconWidget").removeClass("start-now");
238
- jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now");
239
- jQuery(this).attr("data-effect", jQuery(this).val());
240
-
241
- });
242
-
243
- setInterval(function(){
244
- var currentClass = jQuery("#chaty_attention_effect").attr("data-effect");
245
- if(currentClass != "") {
246
- jQuery("#iconWidget").removeClass("chaty-animation-"+currentClass);
247
- jQuery("#iconWidget").removeClass("start-now");
248
- setTimeout(function(){
249
- jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now");
250
- }, 1000);
251
- } else {
252
- jQuery("#chaty_attention_effect").attr("data-effect", jQuery("#chaty_attention_effect").val());
253
- }
254
- }, 5000);
255
-
256
- e(".color-picker-radio input").change(function () {
257
- var t = e(this);
258
- t.prop("checked") ? t.val() : e(".color-picker-custom input").val(), d()
259
- }), e(".color-picker-custom input").change(function () {
260
- e(this).val(), d()
261
- }), function () {
262
- var t = e("#widgetTooltip"), o = e(".preview .page .icon");
263
-
264
- function a() {
265
- e("[name=cht_cta]").val().length >= 1 ? o.removeClass("no-tooltip") : o.addClass("no-tooltip");
266
- }
267
-
268
- a(), t.change(function () {
269
- a()
270
- })
271
- }(), t(), e('[name="cht_position"]').change(function () {
272
- var o = e('[name="cht_position"]:checked').val();
273
- "right" === o ? (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-right")) : "left" === o && (e(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"), e(".page-body .chaty-widget ").addClass("chaty-widget-icons-left")), t()
274
- })
275
- }(), e(".popover").hide(), a();
276
- var t = e(".channels-icons > .icon-sm"), o = e(".social-inputs");
277
-
278
- function a() {
279
- e("section").is("#pro") || (e(".channels-selected__item").length <= 1 ? (e(".channels-selected__item").hide(), e(".popover").hide()) : e(".channels-selected__item").length >= 2 && e(".channels-selected__item").show())
280
- }
281
-
282
- e("input[name=cht_custom_color]").keyup(function (t) {
283
- var o = e(this).val();
284
- e(".circle").html(""), e(".color-picker-custom .circle").css({"background-color": o}), e(this).val().length < 1 && e(".color-picker-custom .circle").html("?")
285
- }), t.on("click", function () {
286
- a();
287
- var n, i = e(this), c = i.data("social");
288
- if (o.find(".social-form-group"), i.hasClass("active")) {
289
- var s = "," + e(this).attr("data-social");
290
- return n = (n = e(".add_slug").val()).replace(s, ""), e(".add_slug").val(n), n = n.replace(s, ""), e(".add_slug").val(n), n = n.replace(s, ""), e(".add_slug").val(n), n = n.replace(s, ""), e(".add_slug").val(n), void i.toggleClass("active")
291
- }
292
- (t.addClass("disabled"), icon = e(this).data("social"), "1" == e(".add_slug").val().indexOf(icon) && "" != e(".add_slug").val()) ? (s = "," + icon, n = (n = e(".add_slug").val()).replace(s, ""), e(".add_slug").val(n), n = n.replace(s, ""), e(".add_slug").val(n), n = n.replace(s, ""), e(".add_slug").val(n)) : e(".add_slug").val(e(".add_slug").val() + "," + e(this).attr("data-social"));
293
- if (!e("section").is("#pro") && e(".channels-icons > .icon.active").length >= 2)return e(".popover").show().effect("shake", {times: 3}, 600), void t.removeClass("disabled");
294
- if (i.toggleClass("active"), e("section").is("#pro"))var l = "pro"; else l = "free";
295
- e.ajax({
296
- type: "POST",
297
- dataType: "json",
298
- url: ajaxurl,
299
- data: {action: "choose_social", social: c, nonce_code: cht_nonce_ajax.cht_nonce, version: l},
300
- beforeSend: function (e) {
301
- },
302
- success: function (o) {
303
- var n = e(o), i = n.find(".icon").data("title");
304
- e('.channels-selected div[data-title="' + i + '"]').length || e("#chaty-social-close").before(n), t.removeClass("disabled"), d(), a(), check_for_close_btn();
305
-
306
- jQuery('.chaty-color-field').spectrum({
307
- chooseText: "Submit",
308
- preferredFormat: "hex",
309
- showInput: true,
310
- cancelText: "Cancel",
311
- move: function (color) {
312
- jQuery(this).val(color.toHexString());
313
- chaty_set_bg_color();
314
- }
315
- });
316
- },
317
- error: function (e, t, o) {
318
- }
319
- }), a()
320
- }), e("body").on("click", ".icon, .btn-cancel", function (t) {
321
- if (t.preventDefault(), !e(this).hasClass("icon") || !e(this).hasClass("active")) {
322
- if (icon = e(this).data("social"), e(this).hasClass("btn-cancel"), !e(this).hasClass("close-btn-set")) {
323
- if(!e(this).hasClass("close-btn-set")) {
324
- e('.icon.active[data-social^="' + icon + '"]').removeClass("active");
325
- var o = "," + icon, n = e(".add_slug").val();
326
- n = n.replace(o, ""), e(".add_slug").val(n)
327
- }
328
- }
329
- if(!e(this).hasClass("close-btn-set")) {
330
- var i = e('#chaty-social-' + icon);
331
- i.remove();
332
- var c = e(this).parent(".channels-selected__item"), s = e(this).data("social");
333
- check_for_close_btn();
334
- } else {
335
- check_for_close_btn();
336
- }
337
- d();
338
- }
339
- }), e(".btn-help").click(function (e) {
340
- window.open("https://premio.io/help/chaty/", "_blank")
341
- }), e(".free-custom-radio, .free-custom-checkbox").on("click", function (e) {
342
- e.preventDefault()
343
- });
344
- var n = e("[name=cht_cta]"), i = e(".preview .tooltip-show");
345
- n.keyup(function () {
346
- var t = e(".preview .page .icon");
347
- n.val().length >= 1 ? t.removeClass("no-tooltip") : t.addClass("no-tooltip"), i.attr("data-title", n.val())
348
- });
349
- var c, s, l = '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>', r = document.getElementById("iconWidget");
350
-
351
- function d() {
352
- var t, o, a = !1;
353
- h() ? (0 === e(".js-chanel-desktop:checked").length && (t = !1),
354
- 1 === e(".js-chanel-desktop:checked").length && (t = e('.icon[data-title="' + e(".js-chanel-desktop:checked").attr("data-type") + '"]').html()),
355
- e(".js-chanel-desktop:checked").length > 1 && (t = l, a = !0)) : (0 === e(".js-chanel-desktop:checked").length && (o = !1),
356
- 1 === e(".js-chanel-mobile:checked").length && (o = e('.icon[data-title="' + e(".js-chanel-mobile:checked").attr("data-type") + '"]').html()),
357
- e(".js-chanel-mobile:checked").length > 1 && (o = l, a = !0)), c = t, s = o, h() ? p(c, a) : p(s, a)
358
- }
359
-
360
- function p(t, o) {
361
- if(t == undefined || t == "undefined") {
362
- t = jQuery(".icon.icon-sm.active").html();
363
- }
364
- if (t ? (e(".preview .page .chaty-widget").show(), r.innerHTML = t) : (e(".preview .page .chaty-widget").hide(), r.innerHTML = ""), o) {
365
- var a = e(".color-picker-custom input").val() ? e(".color-picker-custom input").val() : e(".color-picker-radio input:checked").val();
366
- e(".preview .page svg circle").css({fill: a})
367
- }
368
- thisVal = jQuery("#chaty_default_state").val();
369
- if(thisVal == "open") {
370
- jQuery(".hide-show-button").addClass("active");
371
- } else {
372
- jQuery(".hide-show-button").removeClass("active");
373
- }
374
- jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click");
375
- if(thisVal == "open") {
376
- jQuery(".chaty-widget").addClass("active");
377
- } else if(thisVal == "hover") {
378
- jQuery(".chaty-widget").addClass("hover");
379
- } else {
380
- jQuery(".chaty-widget").addClass("click");
381
- }
382
-
383
- jQuery(".chaty-channels").html("");
384
- var eClass = ".js-chanel-mobile";
385
- if (h()) {
386
- var eClass = ".js-chanel-desktop";
387
- }
388
-
389
- if(thisVal == "open" && jQuery(eClass+':checked').length > 1) {
390
- jQuery("#chaty_attention_effect").val("");
391
- jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", true);
392
- jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state");
393
- if(jQuery(".test_textarea").val() != "Doesn't apply for the open state") {
394
- jQuery(".test_textarea").attr("data-value", jQuery(".test_textarea").val());
395
- }
396
- jQuery(".test_textarea").val("Doesn't apply for the open state");
397
- } else {
398
- jQuery("#chaty_attention_effect, .test_textarea").attr("disabled", false);
399
- jQuery("#chaty_attention_effect option:first-child").text("None");
400
- jQuery(".test_textarea").attr("placeholder","");
401
- if(jQuery(".test_textarea").val() == "Doesn't apply for the open state") {
402
- jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value"));
403
- }
404
- }
405
-
406
- if (jQuery(eClass+':checked').length > 1) {
407
- jQuery(eClass+':checked').each(function(){
408
- var socialIcon = jQuery(this).closest("li").find(".icon").html();
409
- var socialIcon = jQuery(this).closest("li").find(".icon").html();
410
- var socialIconText = jQuery(this).closest("li").find(".chaty-title").val();
411
- var eClass = jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";
412
- if(socialIconText != "") {
413
- socialIconText = "<span class='social-tooltip'>"+socialIconText+"</span>";
414
- }
415
- jQuery(".chaty-channels").append("<div class='social-item-box "+eClass+"'><span class='tooltip-icon'>"+socialIcon+"</span>"+socialIconText+"</div>");
416
- });
417
-
418
- if(jQuery("#chaty_default_state").val() == "open" && jQuery("#cht_close_button").is(":checked")) {
419
- jQuery("#iconWidget").css("display", "block");
420
- jQuery(".chaty-widget .tooltiptext").css("display","block");
421
- jQuery(".chaty-widget").removeClass("hide-arrow");
422
- } else if(jQuery("#chaty_default_state").val() != "open") {
423
- jQuery("#iconWidget").css("display", "block");
424
- jQuery(".chaty-widget .tooltiptext").css("display","block");
425
- jQuery(".chaty-widget").removeClass("hide-arrow");
426
- } else if(jQuery("#chaty_default_state").val() == "open") {
427
- jQuery("#iconWidget").hide();
428
- jQuery(".chaty-widget .tooltiptext").hide();
429
- jQuery(".chaty-widget").addClass("hide-arrow");
430
- }
431
- jQuery(".chaty-widget").removeClass("has-single");
432
- } else if (jQuery(eClass+':checked').length == 1) {
433
- if(jQuery("#chaty_default_state").val() == "open" && !jQuery("#cht_close_button").is(":checked")) {
434
- jQuery("#iconWidget").css("display","block");
435
- jQuery(".chaty-widget .tooltiptext").css("display","block");
436
- jQuery(".chaty-widget").removeClass("hide-arrow");
437
- } else if(jQuery("#chaty_default_state").val() != "open") {
438
- jQuery("#iconWidget").css("display","block");
439
- jQuery(".chaty-widget .tooltiptext").css("display","block");
440
- jQuery(".chaty-widget").removeClass("hide-arrow");
441
- }
442
- jQuery(".chaty-widget").addClass("has-single");
443
- } else if (jQuery(eClass+':checked').length == 0) {
444
- jQuery("#iconWidget").hide();
445
- jQuery(".chaty-widget .tooltiptext").hide();
446
- jQuery(".chaty-widget").addClass("hide-arrow");
447
- jQuery(".chaty-widget").removeClass("has-single");
448
- }
449
- jQuery(".chaty-channels .remove-icon-img").remove();
450
-
451
- if(jQuery("#trigger_on_time").is(":checked")) {
452
- jQuery("#chaty_trigger_time").attr("readonly", false);
453
- } else {
454
- jQuery("#chaty_trigger_time").attr("readonly", true);
455
- }
456
-
457
- if(jQuery("#chaty_trigger_on_scroll").is(":checked")) {
458
- jQuery("#chaty_trigger_on_page_scroll").attr("readonly", false);
459
- } else {
460
- jQuery("#chaty_trigger_on_page_scroll").attr("readonly", true);
461
- }
462
-
463
-
464
- if(jQuery(".chaty-widget .tooltiptext").text() == "") {
465
- jQuery(".chaty-widget .tooltiptext").hide();
466
- } else {
467
- if(jQuery("#chaty_default_state").val() == "open" && jQuery(eClass+':checked').length > 1) {
468
- jQuery(".chaty-widget .tooltiptext").hide();
469
- } else {
470
- jQuery(".chaty-widget .tooltiptext").css("display", "block");
471
- }
472
- }
473
- }
474
-
475
- function h() {
476
- return "checked" === e("#previewDesktop").attr("checked")
477
- }
478
-
479
- function chaty_set_bg_color() {
480
- jQuery(".chaty-color-field").each(function () {
481
- if (jQuery(this).val() != "" && jQuery(this).val() != "#ffffff") {
482
- if (jQuery(this).closest("li").data("id") != "Linkedin" || (jQuery(this).closest("li").data("id") == "Linkedin" && jQuery(this).val() != "#ffffff")) {
483
- defaultColor = jQuery(this).val();
484
- jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill", defaultColor);
485
- jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background", defaultColor);
486
- jQuery(this).closest(".channels-selected__item").find("span.facustom-icon").css("background", defaultColor);
487
- }
488
- }
489
- });
490
- d();
491
- }
492
-
493
- jQuery(".color-picker-radio input:checked").val(), e("#testUpload").on("change", function () {
494
- this.value.length > 0 ? document.querySelector(".js-upload").disabled = !1 : (document.querySelector(".js-upload").disabled = !0, document.getElementById("uploadInput").checked = !1)
495
- }), e(".js-switch-preview").on("change", function () {
496
- h() ? e(this).closest(".preview").removeClass("mobiel-view") : e(this).closest(".preview").addClass("mobiel-view"), d()
497
- }), e(document).on("change", ".js-chanel-icon", function () {
498
- d()
499
- }), e(document).on("change", ".js-widget-i", function (t) {
500
- l = t.target.classList.contains("js-upload") ? e(".file-preview-image").last().parent().html() : e("i[data-type=" + t.target.dataset.type + "]").html(), d()
501
- }), "chat-image" !== e(".js-widget-i:checked").attr("data-type") && (l = e("i[data-type=" + e(".js-widget-i:checked").attr("data-type") + "]").html(), d());
502
-
503
- jQuery(document).on("keyup", "textarea.test_textarea", function(){
504
- d();
505
- });
506
-
507
- /*font family Privew*/
508
- jQuery('.form-fonts').on( 'change', function() {
509
- var font_val = jQuery(this).val();
510
- jQuery('.chaty-google-font').remove();
511
- if (font_val != "") {
512
- jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
513
- jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
514
- } else {
515
- jQuery('.preview-section-chaty #admin-preview .page-body').attr("style","");
516
- }
517
- });
518
-
519
- function stickyelement_iconformat(icon) {
520
- var originalOption = icon.element;
521
- return jQuery('<span><i class="' + icon.text + '"></i> ' + icon.text + '</span>');
522
- }
523
-
524
- jQuery(document).on("blur", "#channels-selected-list > li:not(#chaty-social-close) .channels__input", function(){
525
- if(jQuery(this).hasClass("border-red") && jQuery(this).val() != "") {
526
- jQuery(this).removeClass("border-red");
527
- }
528
- });
529
-
530
- jQuery(window).load(function(){
531
- var font_val = jQuery('.form-fonts').val();
532
- jQuery('.chaty-google-font').remove();
533
- if (font_val != "") {
534
- jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">');
535
- jQuery('.preview-section-chaty #admin-preview .page-body').css('font-family', font_val);
536
- }
537
- });
538
-
539
- jQuery('.chaty-color-field').spectrum({
540
- chooseText: "Submit",
541
- preferredFormat: "hex",
542
- cancelText: "Cancel",
543
- showInput: true,
544
- move: function (color) {
545
- jQuery(this).val(color.toHexString());
546
- chaty_set_bg_color();
547
- }
548
- });
549
-
550
- jQuery(".chaty-color-field").change(function () {
551
- chaty_set_bg_color();
552
- });
553
-
554
- chaty_set_bg_color();
555
-
556
- //d();
557
- });
558
- }(jQuery);
559
- function toggle_chaty_setting(socId) {
560
- jQuery("#chaty-social-"+socId).find(".chaty-advance-settings").toggle();
561
- }
562
- jQuery(document).ready(function(){
563
-
564
- jQuery("#channels-selected-list").sortable({
565
- placeholder: "ui-chaty-state-hl",
566
- items: "li:not(#chaty-social-close)",
567
- update: function( event, ui ) {
568
- set_social_channel_order();
569
- }
570
- });
571
- check_for_close_btn();
572
- jQuery("#create-rule").click(function(){
573
- jQuery(".page-options").toggle();
574
- // jQuery(".page-options").toggleClass("active");
575
- // if(jQuery(".page-options").hasClass("active")) {
576
- // jQuery(this).text("Remove Rule");
577
- // } else {
578
- // jQuery(this).text("Add Rule");
579
- // }
580
- });
581
- });
582
-
583
- function check_for_close_btn() {
584
- if(jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length >= 2) {
585
- jQuery("#chaty-social-close").show();
586
- } else {
587
- jQuery("#chaty-social-close").hide();
588
- }
589
- var srtString = "";
590
- jQuery("#channels-selected-list > li").each(function(){
591
- if(jQuery(this).attr("data-id") != "undefined" && jQuery(this).attr("data-id") != "") {
592
- srtString += jQuery(this).attr("data-id")+",";
593
- }
594
- srtString = srtString.trimRight(",")
595
- });
596
- jQuery(".add_slug").val(srtString);
597
- }
598
- function set_social_channel_order() {
599
- socialString = [];
600
- jQuery("#channels-selected-list li").each(function(){
601
- socialString.push(jQuery(this).attr("data-id"));
602
- });
603
- socialString = socialString.join(",");
604
- jQuery("#cht_numb_slug").val(socialString);
605
- //check_for_chaty_close_button();
606
- }
607
- jQuery(window).scroll(function(){
608
- check_for_preview_pos();
609
- });
610
- jQuery(document).ready(function(){
611
- check_for_preview_pos();
612
- jQuery(document).on("click", "#create-data-and-time-rule" ,function(){
613
- jQuery(".chaty-data-and-time-rules").toggle();
614
- });
615
- });
616
- function check_for_preview_pos() {
617
- if(jQuery(".chaty-setting-form").length) {
618
- if(jQuery(window).width() > 1179) {
619
- var topPos = parseInt(jQuery(".chaty-setting-form").offset().top);
620
- jQuery(".btn-save-sticky").css("top", (topPos+58));
621
- jQuery(".preview").css("top", (topPos+18));
622
- jQuery(".btn-help").css("top", (topPos+58+145));
623
- jQuery("a.remove-chaty-widget-sticky").css("top", (topPos+58+145+119));
624
- } else {
625
- jQuery(".btn-save-sticky").attr("style", "");
626
- jQuery(".preview").attr("style", "");
627
- jQuery(".btn-help").attr("style", "");
628
- jQuery("a.remove-chaty-widget-sticky").attr("style", "");
629
- }
630
- }
631
-
632
- if (jQuery("#scroll-to-item").length && jQuery("#admin-preview").length) {
633
- if(jQuery("body").hasClass("has-premio-box")) {
634
- topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 625;
635
- } else {
636
- topPos = jQuery("#scroll-to-item").offset().top - jQuery(window).scrollTop() - 485;
637
- }
638
-
639
- if (topPos < 0) {
640
- topPos = Math.abs(topPos);
641
- jQuery("#admin-preview").css("margin-top", ((-1) * topPos) + "px");
642
- } else {
643
- jQuery("#admin-preview").css("margin-top", "0");
644
- }
645
- }
646
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cht-icons.php CHANGED
@@ -7,7 +7,7 @@
7
  Author URI: https://premio.io/downloads/chaty/
8
  Text Domain: chaty
9
  Domain Path: /languages
10
- Version: 2.4.6
11
  License: GPL2
12
  */
13
 
@@ -17,7 +17,9 @@ if (!defined('ABSPATH')) {
17
 
18
 
19
  define('CHT_FILE', __FILE__); // this file
20
- define('CHT_OPT', 'chaty');
 
 
21
  define('CHT_DIR', dirname(CHT_FILE)); // our directory
22
  define('CHT_ADMIN_INC', CHT_DIR . '/admin');
23
  define('CHT_FRONT_INC', CHT_DIR . '/frontend');
@@ -25,7 +27,7 @@ define('CHT_INC', CHT_DIR . '/includes');
25
  define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
26
  define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
27
  define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
28
- define('CHT_VERSION', "2.4.6");
29
 
30
  if (!function_exists('wp_doing_ajax')) {
31
  function wp_doing_ajax()
@@ -106,12 +108,10 @@ if(is_admin()) {
106
  }
107
 
108
  require_once CHT_INC . '/class-cht-icons.php';
109
- require_once CHT_FRONT_INC . '/class-frontend.php';
110
-
111
  require_once CHT_INC . '/class-affiliate.php';
112
 
113
 
114
-
115
  add_action('activated_plugin', 'cht_activation_redirect');
116
 
117
  register_activation_hook(CHT_FILE, 'cht_install', 10);
7
  Author URI: https://premio.io/downloads/chaty/
8
  Text Domain: chaty
9
  Domain Path: /languages
10
+ Version: 2.4.7
11
  License: GPL2
12
  */
13
 
17
 
18
 
19
  define('CHT_FILE', __FILE__); // this file
20
+ if(!defined('CHT_OPT')) {
21
+ define('CHT_OPT', 'chaty');
22
+ }
23
  define('CHT_DIR', dirname(CHT_FILE)); // our directory
24
  define('CHT_ADMIN_INC', CHT_DIR . '/admin');
25
  define('CHT_FRONT_INC', CHT_DIR . '/frontend');
27
  define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
28
  define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
29
  define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
30
+ define('CHT_VERSION', "2.4.7");
31
 
32
  if (!function_exists('wp_doing_ajax')) {
33
  function wp_doing_ajax()
108
  }
109
 
110
  require_once CHT_INC . '/class-cht-icons.php';
111
+ require_once CHT_INC . '/class-frontend.php';
 
112
  require_once CHT_INC . '/class-affiliate.php';
113
 
114
 
 
115
  add_action('activated_plugin', 'cht_activation_redirect');
116
 
117
  register_activation_hook(CHT_FILE, 'cht_install', 10);
{assets/css → css}/chaty-front.css RENAMED
@@ -1,6 +1,93 @@
1
  body.hide-cht-widget .chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before {
2
  display: none
3
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  .widget-img {
5
  display: flex;
6
  align-items: center;
@@ -9,14 +96,11 @@ body.hide-cht-widget .chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):b
9
  border-radius: 100%;
10
  }
11
  .get {
12
- opacity: 0;
13
  }
14
  .chaty-widget-show .get {
15
  opacity: 1;
16
  }
17
- .none-widget-show .get {
18
- opacity: 0;
19
- }
20
  .get a {
21
  color: #222 !important;
22
  text-decoration: none !important;
@@ -24,13 +108,11 @@ body.hide-cht-widget .chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):b
24
  body .one_widget .bofore_del:before {
25
  opacity: 0 !important;
26
  display: none;
27
- )
28
  }
29
-
30
  /*.one_widget .chaty-widget-i.i-trigger-open:before {
31
  display: none;
32
- }*/
33
- /*.one_widget.chaty-widget .chaty-widget-i {
34
  }*/
35
  .one_widget.chaty-widget:not(.chaty-widget-is-right) .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title {
36
  font-size: 17px;
@@ -134,7 +216,6 @@ body .one_widget .bofore_del:before {
134
  left: auto;
135
  transform: translate(calc(100% + 13px), -50%);
136
  }
137
-
138
  .chaty-widget-is-right.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before {
139
  left: auto;
140
  right: -18px;
@@ -180,9 +261,6 @@ body .chaty-widget-i-title.true {
180
  align-items: center;
181
  justify-content: space-between;
182
  }
183
- .facebook .chaty-widget-i-title {
184
- padding: 0 !important
185
- }
186
  body .chaty-widget-i .facebook_header p {
187
  font-family: Lato, Helvetica, Arial, sans-serif;
188
  font-size: 13px;
@@ -225,6 +303,7 @@ body .chaty-widget-i .facebook_header p {
225
  }
226
  .chaty-widget .chaty-widget-is {
227
  display: flex;
 
228
  flex-wrap: wrap;
229
  overflow: hidden;
230
  height: 0;
@@ -277,6 +356,7 @@ body .chaty-widget-i .facebook_header p {
277
  .chaty-widget .chaty-widget-is .chaty-widget-i {
278
  }
279
  .chaty-widget .i-trigger {
 
280
  position: relative;
281
  }
282
  .chaty-widget .i-trigger .i-trigger-open, .chaty-widget .i-trigger .i-trigger-close {
@@ -367,7 +447,7 @@ body .chaty-widget-i .facebook_header p {
367
  width: 54px;
368
  height: 54px;
369
  position: relative;
370
- margin: 4px
371
  }
372
  .chaty-widget .chaty-widget-i svg, .chaty-widget .chaty-widget-i .wrap-svg {
373
  cursor: pointer;
@@ -376,6 +456,7 @@ body .chaty-widget-i .facebook_header p {
376
  display: block;
377
  position: relative;
378
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);
 
379
  border-radius: 50%;
380
  -wekit-border-radius: 50%;
381
  -moz-border-radius: 50%;
@@ -384,7 +465,7 @@ body .i-trigger-open .chaty-widget-i-title {
384
  padding: 5px 16px 5px 17px !important;
385
  }
386
  .chaty-widget:not(.chaty-widget-is-right) .i-trigger-open:before {
387
- left: -17px !important
388
  }
389
  .chaty-widget:not(.chaty-widget-is-right) .i-trigger-open:before {
390
  }
@@ -460,7 +541,7 @@ body .one_widget .i-trigger-open .chaty-widget-i-title.face_title {
460
  border-width: 5px 10px 5px 0;
461
  border-color: transparent #fff transparent transparent
462
  }
463
- .chaty-widget.chaty-widget-is-right .chaty-widget-i.facebook.active .chaty-widget-i-title {
464
  position: fixed;
465
  transform: initial !important;
466
  right: auto;
@@ -626,17 +707,12 @@ body .one_widget .i-trigger-open .chaty-widget-i-title.face_title {
626
  bottom: 0 !important;
627
  top: auto !important;
628
  }
629
-
630
  .chaty-widget.hide-tooltip-arrow .chaty-widget-i:before {
631
  display: none !important;
632
  }
633
  body .no-tooltip .chaty-widget-i-title.true {
634
  display: none;
635
  }
636
- .chaty-widget.hide-cta-arrow .chaty-widget-i:after, .chaty-widget.hide-cta-arrow .chaty-widget-i:before {
637
- content: "";
638
- display: none;
639
- }
640
  .chaty-widget-i.hide-chaty-arrow:before {
641
  display: none;
642
  }
@@ -651,5 +727,5 @@ body .no-tooltip .chaty-widget-i-title.true {
651
  -webkit-border-radius: 50%;
652
  text-align: center;
653
  color: #ffffff;
654
- box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);
655
  }
1
  body.hide-cht-widget .chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before {
2
  display: none
3
  }
4
+ .facebook .chaty-widget-i-title {
5
+ padding: 0 !important;
6
+ }
7
+ .widget-img img {
8
+ max-height: 100%;
9
+ max-width: 100%;
10
+ height: auto;
11
+ margin: 0 auto;
12
+ }
13
+ /*.chaty-widget .chaty-widget-i svg, .chaty-widget .chaty-widget-i .wrap-svg {
14
+ border-radius: 50%;
15
+ }*/
16
+ .widget-img {
17
+ text-align: center;
18
+ }
19
+ .widget-img img {
20
+ object-fit: cover
21
+ }
22
+ .chaty-widget .chaty-widget-i.facebook.active.before .chaty-widget-i-title.fb-title {
23
+ display: none !important;
24
+ }
25
+ .wechat-box img {
26
+ object-fit: cover;
27
+ max-width: 220px;
28
+ height: auto;
29
+ width: 100%;
30
+ }
31
+ .wechat-box-head svg {
32
+ cursor: pointer;
33
+ width: 30px;
34
+ height: 30px;
35
+ }
36
+ .wechat-box-head SVG {
37
+ cursor: pointer;
38
+ width: 30PX;
39
+ height: 30px;
40
+ fill: #fff;
41
+ font-weight: bold;
42
+ }
43
+ .wechat-box-head {
44
+ width: 100%;
45
+ display: inline-block;
46
+ vertical-align: bottom;
47
+ color: #fff;
48
+ padding: 0 0 0 10px;
49
+ line-height: 34px;
50
+ background: #34a700;
51
+ height: 34px;
52
+ }
53
+ .wechat-box {
54
+ display: inline-block;
55
+ vertical-align: bottom;
56
+ position: relative;
57
+ padding: 10px
58
+ }
59
+ .wechat-qr-code {
60
+ display: inline-block;
61
+ vertical-align: bottom;
62
+ background: #fff;
63
+ border-radius: 5px;
64
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(204, 204, 204, 1);
65
+ -moz-box-shadow: 0px 0px 5px 0px rgba(204, 204, 204, 1);
66
+ box-shadow: 0px 0px 5px 0px rgba(204, 204, 204, 1);
67
+ -webkit-border-radius: 5px;
68
+ -moz-border-radius: 5px;
69
+ border-radius: 5px;
70
+ max-width: 250px;
71
+ height: auto;
72
+ overflow: hidden;
73
+ position: fixed;
74
+ bottom: 30px;
75
+ left: 100px;
76
+ padding: 0px;
77
+ z-index: 100001;
78
+ }
79
+ .chaty-social-img {
80
+ display: block;
81
+ -webkit-border-radius: 50%;
82
+ -moz-border-radius: 50%;
83
+ border-radius: 50%;
84
+ }
85
+ .chaty-social-img img {
86
+ object-fit: cover;
87
+ -webkit-border-radius: 50%;
88
+ -moz-border-radius: 50%;
89
+ border-radius: 50%;
90
+ }
91
  .widget-img {
92
  display: flex;
93
  align-items: center;
96
  border-radius: 100%;
97
  }
98
  .get {
99
+ opacity: 1;
100
  }
101
  .chaty-widget-show .get {
102
  opacity: 1;
103
  }
 
 
 
104
  .get a {
105
  color: #222 !important;
106
  text-decoration: none !important;
108
  body .one_widget .bofore_del:before {
109
  opacity: 0 !important;
110
  display: none;
 
111
  }
 
112
  /*.one_widget .chaty-widget-i.i-trigger-open:before {
113
  display: none;
114
+ }
115
+ .one_widget.chaty-widget .chaty-widget-i {
116
  }*/
117
  .one_widget.chaty-widget:not(.chaty-widget-is-right) .chaty-widget-i:not(.no-tooltip) .chaty-widget-i-title {
118
  font-size: 17px;
216
  left: auto;
217
  transform: translate(calc(100% + 13px), -50%);
218
  }
 
219
  .chaty-widget-is-right.chaty-widget.one_widget .chaty-widget-i:not(.no-tooltip):before {
220
  left: auto;
221
  right: -18px;
261
  align-items: center;
262
  justify-content: space-between;
263
  }
 
 
 
264
  body .chaty-widget-i .facebook_header p {
265
  font-family: Lato, Helvetica, Arial, sans-serif;
266
  font-size: 13px;
303
  }
304
  .chaty-widget .chaty-widget-is {
305
  display: flex;
306
+ z-index: 1111;
307
  flex-wrap: wrap;
308
  overflow: hidden;
309
  height: 0;
356
  .chaty-widget .chaty-widget-is .chaty-widget-i {
357
  }
358
  .chaty-widget .i-trigger {
359
+ cursor: pointer;
360
  position: relative;
361
  }
362
  .chaty-widget .i-trigger .i-trigger-open, .chaty-widget .i-trigger .i-trigger-close {
447
  width: 54px;
448
  height: 54px;
449
  position: relative;
450
+ margin: 4px;
451
  }
452
  .chaty-widget .chaty-widget-i svg, .chaty-widget .chaty-widget-i .wrap-svg {
453
  cursor: pointer;
456
  display: block;
457
  position: relative;
458
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);
459
+ box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);
460
  border-radius: 50%;
461
  -wekit-border-radius: 50%;
462
  -moz-border-radius: 50%;
465
  padding: 5px 16px 5px 17px !important;
466
  }
467
  .chaty-widget:not(.chaty-widget-is-right) .i-trigger-open:before {
468
+ left: -18px !important
469
  }
470
  .chaty-widget:not(.chaty-widget-is-right) .i-trigger-open:before {
471
  }
541
  border-width: 5px 10px 5px 0;
542
  border-color: transparent #fff transparent transparent
543
  }
544
+ .chaty-widget.chaty-widget-is-right .chaty-widget-i.facebook.active .chaty-widget-i-title.face_title {
545
  position: fixed;
546
  transform: initial !important;
547
  right: auto;
707
  bottom: 0 !important;
708
  top: auto !important;
709
  }
 
710
  .chaty-widget.hide-tooltip-arrow .chaty-widget-i:before {
711
  display: none !important;
712
  }
713
  body .no-tooltip .chaty-widget-i-title.true {
714
  display: none;
715
  }
 
 
 
 
716
  .chaty-widget-i.hide-chaty-arrow:before {
717
  display: none;
718
  }
727
  -webkit-border-radius: 50%;
728
  text-align: center;
729
  color: #ffffff;
730
+ /*box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.25);*/
731
  }
frontend/class-frontend.php DELETED
@@ -1,466 +0,0 @@
1
- <?php
2
-
3
- namespace CHT\frontend;
4
-
5
- use CHT\admin\CHT_Admin_Base;
6
- use CHT\admin\CHT_Social_Icons;
7
-
8
- $admin_base = CHT_ADMIN_INC . '/class-admin-base.php';
9
- require_once($admin_base);
10
-
11
- $social_icons = CHT_ADMIN_INC . '/class-social-icons.php';
12
- require_once($social_icons);
13
-
14
- class CHT_Frontend extends CHT_Admin_Base
15
- {
16
- /**
17
- * CHT_Frontend constructor.
18
- */
19
- public function __construct()
20
- {
21
- $this->socials = CHT_Social_Icons::get_instance()->get_icons_list();
22
- if (wp_doing_ajax()) {
23
- add_action('wp_ajax_choose_social', array($this, 'choose_social_handler'));
24
- add_action('wp_ajax_add_token', array($this, 'add_token'));
25
- add_action('wp_ajax_del_token', array($this, 'del_token'));
26
- }
27
- add_action('wp_head', array($this, 'insert_widget'));
28
-
29
- add_action('wp_ajax_chaty_check_for_mobile', array($this, 'chaty_check_for_mobile')); // initialize widget in footer
30
- add_action('wp_ajax_nopriv_chaty_check_for_mobile', array($this, 'chaty_check_for_mobile'));
31
- }
32
-
33
- public function chaty_check_for_mobile() {
34
- if(wp_is_mobile()) {
35
- echo "yes";
36
- } else {
37
- echo "no";
38
- }
39
- wp_die();
40
- }
41
-
42
- /**
43
- * Function add token
44
- */
45
- public function add_token()
46
- {
47
- check_ajax_referer('cht_nonce_ajax', 'nonce_code');
48
- $token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
49
-
50
- if ($token !== null) {
51
- if ($this->is_pro($token)) {
52
- update_option('cht_license_key', $token, 'no');
53
- esc_html_e('true');
54
- wp_die();
55
- }
56
- }
57
- esc_html_e('');
58
- wp_die();
59
- }
60
-
61
- /**
62
- * Function add token
63
- */
64
- public function del_token()
65
- {
66
- check_ajax_referer('cht_nonce_ajax', 'nonce_code');
67
- if (!$this->is_pro()) {
68
- update_option('cht_license_key', '', '');
69
- }
70
- esc_html_e('');
71
- wp_die();
72
- }
73
-
74
- /**
75
- *
76
- */
77
- public function choose_social_handler()
78
- {
79
- check_ajax_referer('cht_nonce_ajax', 'nonce_code');
80
- $social = filter_input(INPUT_POST, 'social', FILTER_SANITIZE_STRING);
81
-
82
- if (!is_null($social) && !empty($social)) {
83
- foreach ($this->socials as $item) {
84
- if ($item['slug'] == $social) {
85
- break;
86
- }
87
- }
88
- if (!$item) {
89
- return;
90
- }
91
- $social_opt = get_option('cht_social_' . $social);
92
- if (empty($social_opt)) {
93
- $social_opt = [
94
- 'value' => '',
95
- 'is_mobile' => 'checked',
96
- 'is_desktop' => 'checked'
97
- ];
98
- }
99
- if(!isset($social_opt['bg_color']) || empty($social_opt['bg_color'])) {
100
- $social_opt['bg_color'] = $item['color']; // Initialize background color value if not exists. 2.1.0 change
101
- }
102
- if(!isset($social_opt['image_id'])) {
103
- $social_opt['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change
104
- }
105
- if(!isset($social_opt['title']) || $social_opt['title'] == "") {
106
- $social_opt['title'] = $item['title']; // Initialize title if not exists. 2.1.0 change
107
- }
108
-
109
- $social_opt['is_desktop'] = isset($social_opt['is_desktop']) ? $social_opt['is_desktop'] : '';
110
- $social_opt['is_mobile'] = isset($social_opt['is_mobile']) ? $social_opt['is_mobile'] : '';
111
-
112
- $social_opt['title'] = $item['title'];
113
- ob_start();
114
- $status = 0;
115
- $is_pro = $this->is_pro();
116
- $class_name = $is_pro?"pro":"free";
117
- ?>
118
- <li data-id="<?php echo esc_attr($item['slug']) ?>" id="chaty-social-<?php echo esc_attr($item['slug']) ?>">
119
- <div class="channels-selected__item <?php esc_attr_e(($status)?"img-active":"") ?> <?php esc_attr_e($class_name) ?> 1 available">
120
- <div class="chaty-default-settings">
121
- <div class="move-icon">
122
- <?php $image_url = plugin_dir_url("")."/chaty/assets/images/move-icon.png"; ?>
123
- <img src="<?php echo esc_url($image_url) ?>" />
124
- </div>
125
- <div class="icon icon-md active" data-label="<?php esc_attr_e($item['title']); ?>" data-title="<?php esc_attr_e($item['slug']); ?>">
126
- <span class="default-chaty-icon custom-icon-<?php echo esc_attr($item['slug']) ?> default_image_<?php echo esc_attr($item['slug']) ?>" >
127
- <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
128
- <?php echo $item['svg']; ?>
129
- </svg>
130
- </span>
131
- </div>
132
- <div class="channels__input-box">
133
- <input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($item['slug']); ?>[value]" value="<?php esc_attr_e($social_opt['value']); ?>" data-gramm_editor="false" id="<?php echo esc_attr($item['slug']); ?>" />
134
- </div>
135
- <div>
136
- <?php
137
- $channel_id = $this->del_space($item['slug']);
138
- $channel_id = str_replace(' ', '_', $channel_id);
139
- ?>
140
- <label class="channels__view" for="<?php echo esc_attr($channel_id); ?>Desktop">
141
- <input type="checkbox" id="<?php echo esc_attr($channel_id); ?>Desktop" class="channels__view-check js-chanel-icon js-chanel-desktop" data-type="<?php echo esc_attr($item['title']); ?>"
142
- name="cht_social_<?php echo esc_attr($item['slug']); ?>[is_desktop]" value="checked" data-gramm_editor="false" <?php esc_attr_e($social_opt['is_desktop']) ?> >
143
- <span class="channels__view-txt">Desktop</label>
144
- </label>
145
- <label class="channels__view"
146
- for="<?php echo esc_attr($channel_id); ?>Mobile">
147
- <input type="checkbox" id="<?php echo esc_attr($channel_id); ?>Mobile" class="channels__view-check js-chanel-icon js-chanel-mobile"
148
- data-type="<?php echo esc_attr($item['title']); ?>" name="cht_social_<?php echo esc_attr($item['slug']); ?>[is_mobile]" value="checked" data-gramm_editor="false" <?php esc_attr_e($social_opt['is_mobile']) ?> >
149
- <span class="channels__view-txt">Mobile</span>
150
- </label>
151
- </div>
152
- <div class="chaty-settings" onclick="toggle_chaty_setting('<?php echo esc_attr($item['slug']); ?>')">
153
- <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
154
- </div>
155
- <div class="input-example">
156
- <?php esc_attr_e('For example', CHT_OPT); ?>: <?php esc_attr_e($item['example']); ?>
157
- </div>
158
- <!-- checking for extra help message for social media -->
159
- <?php if((isset($item['help']) && !empty($item['help'])) || isset($item['help_link'])) { ?>
160
- <div class="viber-help">
161
- <?php if(isset($item['help_link'])) { ?>
162
- <?php $help_text = isset($item['help_title'])?$item['help_title']:"Doesn't work?"; ?>
163
- <a href="<?php echo esc_url($item['help_link']) ?>" target="_blank"><?php esc_attr_e($help_text); ?></a>
164
- <?php } else { ?>
165
- <?php $help_title = isset($item['help_title'])?$item['help_title']:"Doesn't work?" ?>
166
- <span><?php echo $item['help']; ?></span>
167
- <?php esc_attr_e($help_title) ?>
168
- <?php } ?>
169
- </div>
170
- <?php } ?>
171
- </div>
172
- <div class="chaty-advance-settings">
173
- <div class="chaty-setting-col">
174
- <label>Icon Appearance</label>
175
- <div>
176
- <input type="text" name="cht_social_<?php echo esc_attr($item['slug']); ?>[bg_color]" class="chaty-color-field" value="<?php esc_attr_e($social_opt['bg_color']) ?>" />
177
- <div class="pro-features">
178
- <div class="pro-item">
179
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
180
- </div>
181
- <div class="pro-button">
182
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
183
- </div>
184
- </div>
185
- </div>
186
- </div>
187
- <div class="clear clearfix"></div>
188
- <div class="chaty-setting-col">
189
- <label>On Hover Text</label>
190
- <div>
191
- <input type="text" class="chaty-title" name="cht_social_<?php echo esc_attr($item['slug']); ?>[title]" value="<?php esc_attr_e($social_opt['title']) ?>">
192
- </div>
193
- </div>
194
- <div class="clear clearfix"></div>
195
- <?php if($item['slug'] == "Whatsapp") { ?>
196
- <div class="clear clearfix"></div>
197
- <div class="chaty-setting-col">
198
- <label>Pre Set Message</label>
199
- <div>
200
- <div class="pro-features">
201
- <div class="pro-item">
202
- <input disabled id="cht_social_message_<?php echo esc_attr($item['slug']); ?>" type="text" name="" value="" >
203
- </div>
204
- <div class="pro-button">
205
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
206
- </div>
207
- </div>
208
- </div>
209
- </div>
210
- <?php } else if($item['slug'] == "Email") { ?>
211
- <div class="clear clearfix"></div>
212
- <div class="chaty-setting-col">
213
- <label>Mail Subject</label>
214
- <div>
215
- <div class="pro-features">
216
- <div class="pro-item">
217
- <input disabled id="cht_social_message_<?php echo esc_attr($item['slug']); ?>" type="text" name="" value="" >
218
- </div>
219
- <div class="pro-button">
220
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
221
- </div>
222
- </div>
223
- </div>
224
- </div>
225
- <?php } else if($item['slug'] == "WeChat") { ?>
226
- <div class="clear clearfix"></div>
227
- <div class="chaty-setting-col">
228
- <label>Upload QR Code</label>
229
- <div>
230
- <a class="cht-upload-image" id="upload_qr_code" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" >
231
- <span class="dashicons dashicons-upload"></span>
232
- </a>
233
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
234
- </div>
235
- </div>
236
- <?php } else if($item['slug'] == "Link" || $item['slug'] == "Custom_Link") {
237
- $is_checked = (!isset($social_opt['new_window']) || $social_opt['new_window'] == 1)?1:0;
238
- ?>
239
- <div class="clear clearfix"></div>
240
- <div class="chaty-setting-col">
241
- <label >Open In a New Tab</label>
242
- <div>
243
- <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
244
- <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
245
- <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" <?php checked($is_checked, 1) ?> >
246
- <span class="channels__view-txt">&nbsp;</span>
247
- </label>
248
- </div>
249
- </div>
250
- <?php } else if($item['slug'] == "Linkedin") {
251
- $is_checked = "personal";
252
- ?>
253
- <!-- Advance setting for Custom Link -->
254
- <div class="clear clearfix"></div>
255
- <div class="chaty-setting-col">
256
- <label >LinkedIn</label>
257
- <div>
258
- <label>
259
- <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
260
- Personal
261
- </label>
262
- <label>
263
- <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
264
- Company
265
- </label>
266
- </div>
267
- </div>
268
- <?php } ?>
269
- <!--<div class="chaty-pro-feature">
270
- <a target="_blank" href="<?php /*echo esc_url($this->getUpgradeMenuItemUrl());*/?>">
271
- <?php /*esc_attr_e('Upgrade to Pro', CHT_OPT);*/?>
272
- </a>
273
- </div>-->
274
- </div>
275
- <button class="btn-cancel" data-social="<?php echo esc_attr($item['slug']); ?>">
276
- <svg width="14" height="13" viewBox="0 0 14 13" fill="none"
277
- xmlns="http://www.w3.org/2000/svg">
278
- <rect width="15.6301" height="2.24494" rx="1.12247"
279
- transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
280
- <rect width="15.6301" height="2.24494" rx="1.12247"
281
- transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
282
- </svg>
283
- </button>
284
- </div>
285
- </li>
286
- <?php
287
- $html = ob_get_clean();
288
- echo json_encode($html);
289
- }
290
- wp_die();
291
- }
292
-
293
- public function int_arr()
294
- {
295
- $social = get_option('cht_numb_slug');
296
- $social = explode(",", $social);
297
-
298
- $arr = array();
299
- $output = array();
300
- foreach ($social as $key_soc):
301
- foreach ($this->socials as $social) :
302
- if ($social['slug'] != $key_soc) {
303
- continue;
304
- }
305
- if ($value = get_option('cht_social_' . $social['slug'])) {
306
- if ($value) {
307
- $desktop_target = "";
308
- $mobile_target = "";
309
- $mobile_url = "";
310
- $title = isset($value['title'])?$value['title']:$social['title'];
311
- if(!isset($value['bg_color']) || empty($value['bg_color'])) {
312
- $value['bg_color'] = $social['color']; // Initialize background color value if not exists. 2.1.0 change
313
- }
314
- if(!isset($value['image_id'])) {
315
- $value['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change
316
- }
317
- if(!isset($value['fa_icon'])) {
318
- $value['fa_icon'] = ""; // Initialize title if not exists. 2.1.0 change
319
- }
320
- $arr[strtolower($social['slug'])] = $value['value'];
321
- if($social['slug'] == "Viber") {
322
- $val = $value['value'];
323
- $fc = substr($val, 0, 1);
324
- if ($fc == "+") {
325
- $length = -1 * (strlen($val) - 1);
326
- $val = substr($val, $length);
327
- }
328
- if (!wp_is_mobile()) {
329
- $val = "+" . $val;
330
- }
331
- $arr[strtolower($social['slug'])] = $val;
332
- } else if($social['slug'] == "Whatsapp") {
333
- $val = $value['value'];
334
- $number = str_replace("+","", $val);
335
- $val = "https://web.whatsapp.com/send?phone=".$number;
336
- $arr[strtolower($social['slug'])] = $val;
337
- $mobile_url = "https://wa.me/".$number;
338
- if(wp_is_mobile()) {
339
- $mobile_target = "";
340
- } else {
341
- $desktop_target = "_blank";
342
- }
343
- $value['value'] = $val;
344
- } else if($social['slug'] == "Facebook_Messenger") {
345
- $val = $value['value'];
346
- $val = str_replace("facebook.com","m.me", $val);
347
- $val = str_replace("www.","", $val);
348
- $val = esc_url($val);
349
- $val = str_replace("http:", "https:", $val);
350
- $value['value'] = $val;
351
- $arr[strtolower($social['slug'])] = $value['value'];
352
-
353
- $val = trim($val, "/");
354
- $val_array = explode("/", $val);
355
- $total = count($val_array)-1;
356
- $last_value = $val_array[$total];
357
- $last_value = explode("-", $last_value);
358
- $total_text = count($last_value)-1;
359
- $total_text = $last_value[$total_text];
360
-
361
- if(is_numeric($total_text)) {
362
- $val_array[$total] = $total_text;
363
- $val = implode("/", $val_array);
364
- $value['value'] = $val;
365
- }
366
- } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
367
- echo $is_exist = strpos($value['value'], "javascript");
368
- if(strpos($value['value'], "javascript") === false) {
369
- $value['value'] = esc_url($value['value']);
370
- }
371
- $arr[strtolower($social['slug'])] = $value['value'];
372
- }
373
-
374
- $slug = strtolower($social['slug']);
375
- if(in_array($slug, array("telegram", "line", "link", "custom_link", "google_maps", "waze", "poptin", "snapchat", "vkontakte", "twitter", "instagram", "linkedin", "facebook_messenger", "whatsapp"))) {
376
- $desktop_target = "_blank";
377
- $mobile_target = "_blank";
378
- }
379
-
380
- if($slug == "link" || $slug == "custom_link") {
381
- $is_exist = strpos($value['value'], "javascript");
382
- if ($is_exist != "") {
383
- $value['value'] = esc_url($value['value']);
384
- } else {
385
- if ($slug == "custom_link" || $slug == "link") {
386
- $desktop_target = (isset($value['new_window']) && $value['new_window'] == 0) ? "" : "_blank";
387
- $mobile_target = (isset($value['new_window']) && $value['new_window'] == 0) ? "" : "_blank";
388
- }
389
- }
390
- }
391
-
392
- if(in_array(strtolower($social['slug']), array("facebook_messenger", "whatsapp"))) {
393
- $mobile_target = "";
394
- }
395
-
396
- $is_mobile = isset($value['is_mobile']) ? "is-in-mobile" : 0;
397
- $is_desktop = isset($value['is_desktop']) ? "is-in-desktop" : 0;
398
-
399
- if($slug == "linkedin") {
400
- /* setting for Linkedin */
401
- $link_type = !isset($value['link_type']) || $value['link_type'] == "company"?"company":"personal";
402
- if($link_type == "personal") {
403
- $value['value'] = "https://www.linkedin.com/in/".$value['value'];
404
- } else {
405
- $value['value'] = "https://www.linkedin.com/company/".$value['value'];
406
- }
407
- $desktop_target = "_blank";
408
- $mobile_target = "_blank";
409
- }
410
-
411
- if(empty($mobile_url)) {
412
- $mobile_url = $value['value'];
413
- }
414
-
415
- $icon = $social['svg'];
416
- $icon = '<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">'.$icon.'</svg>';
417
-
418
- if(!empty($value['value'])) {
419
- $data = array(
420
- "value" => $value['value'],
421
- "is_mobile" => $is_mobile,
422
- "is_desktop" => $is_desktop,
423
- "desktop_target" => $desktop_target,
424
- "mobile_target" => $mobile_target,
425
- "mobile_url" => $mobile_url,
426
- "title" => $title,
427
- "icon" => $icon,
428
- "color" => $value['bg_color'],
429
- "slug" => strtolower($social['slug']),
430
- "has_font" => 0
431
- );
432
- $output[strtolower($social['slug'])] = $data;
433
- }
434
- }
435
- };
436
- endforeach;
437
- endforeach;
438
- // echo "<pre>"; print_r($output); die;
439
- return $output;
440
- }
441
-
442
- public function insert_widget()
443
- {
444
- if ($this->canInsertWidget()):
445
- include_once CHT_DIR . '/views/widget.php';
446
- endif;
447
- }
448
-
449
- private function canInsertWidget()
450
- {
451
- return get_option('cht_active') && $this->checkChannels();
452
- }
453
-
454
- private function checkChannels()
455
- {
456
- $social = explode(",", get_option('cht_numb_slug'));
457
- $res = false;
458
- foreach ($social as $name) {
459
- $value = get_option('cht_social_' . strtolower($name));
460
- $res = $res || !empty($value['value']);
461
- }
462
- return $res;
463
- }
464
- }
465
-
466
- return new CHT_Frontend();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-frontend.php ADDED
@@ -0,0 +1,647 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace CHT\frontend;
4
+
5
+ use CHT\admin\CHT_Admin_Base;
6
+ use CHT\admin\CHT_Social_Icons;
7
+
8
+ $admin_base = CHT_ADMIN_INC . '/class-admin-base.php';
9
+ require_once($admin_base);
10
+
11
+ $social_icons = CHT_ADMIN_INC . '/class-social-icons.php';
12
+ require_once($social_icons);
13
+
14
+ class CHT_Frontend extends CHT_Admin_Base
15
+ {
16
+ public $widget_number;
17
+ /**
18
+ * CHT_Frontend constructor.
19
+ */
20
+ public function __construct()
21
+ {
22
+ $this->socials = CHT_Social_Icons::get_instance()->get_icons_list();
23
+ if (wp_doing_ajax()) {
24
+ add_action('wp_ajax_choose_social', array($this, 'choose_social_handler'));
25
+ }
26
+ add_action('wp_head', array($this, 'insert_widget'));
27
+ }
28
+
29
+ /* function choose_social_handler start */
30
+ public function choose_social_handler()
31
+ {
32
+ check_ajax_referer('cht_nonce_ajax', 'nonce_code');
33
+ $slug = filter_input(INPUT_POST, 'social', FILTER_SANITIZE_STRING);
34
+
35
+ if (!is_null($slug) && !empty($slug)) {
36
+ foreach ($this->socials as $social) {
37
+ if ($social['slug'] == $slug) {
38
+ break;
39
+ }
40
+ }
41
+ if (!$social) {
42
+ return; // return if social media setting not found
43
+ }
44
+
45
+ $widget_index = filter_input(INPUT_POST, 'widget_index', FILTER_SANITIZE_STRING);
46
+
47
+ $value = get_option('cht_social'.$widget_index.'_' . $slug); // get setting for media if already saved
48
+
49
+ if (empty($value)) {
50
+ $value = [
51
+ 'value' => '',
52
+ 'is_mobile' => 'checked',
53
+ 'is_desktop' => 'checked',
54
+ 'fa_icon' => '',
55
+ ]; // Initialize default values if not found
56
+ } else {
57
+ $value['is_desktop'] = isset($value['is_desktop']) ? $value['is_desktop'] : ''; // checking for desktop flag
58
+ $value['is_mobile'] = isset($value['is_mobile']) ? $value['is_mobile'] : ''; // checking for mobile flag
59
+ }
60
+
61
+ if(!isset($value['bg_color']) || empty($value['bg_color'])) {
62
+ $value['bg_color'] = $social['color']; // Initialize background color value if not exists. 2.1.0 change
63
+ }
64
+ if(!isset($value['image_id'])) {
65
+ $value['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change
66
+ }
67
+ if(!isset($value['title']) || $value['title'] == "") {
68
+ $value['title'] = $social['title']; // Initialize title if not exists. 2.1.0 change
69
+ }
70
+ if(!isset($value['fa_icon'])) {
71
+ $value['fa_icon'] = ""; // Initialize title if not exists. 2.1.0 change
72
+ }
73
+
74
+ $imageId = $value['image_id'];
75
+ $imageUrl = "";
76
+ $status = 0;
77
+ if(!empty($imageId)) {
78
+ $imageUrl = wp_get_attachment_image_src($imageId, "full")[0]; // get custom image URL if exists
79
+ $status = 1;
80
+ }
81
+ if($imageUrl == "") {
82
+ $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; // Initialize with default image if custom image is not exists
83
+ $status = 0;
84
+ $imageId = "";
85
+ }
86
+ if(isset($value['value'])) {
87
+ $value['value'] = esc_attr__(wp_unslash($value['value']));
88
+ }
89
+ if(isset($value['title'])) {
90
+ $value['title'] = esc_attr__(wp_unslash($value['title']));
91
+ }
92
+ ob_start();
93
+ $is_pro = $this->is_pro();
94
+ $class_name = $is_pro?"pro":"free";
95
+ ?>
96
+ <!-- Social media setting box: start -->
97
+ <li data-id="<?php echo esc_attr($social['slug']) ?>" id="chaty-social-<?php echo esc_attr($social['slug']) ?>">
98
+ <div class="channels-selected__item <?php esc_attr_e(($status)?"img-active":"") ?> <?php esc_attr_e($class_name) ?> 1 available">
99
+ <div class="chaty-default-settings">
100
+ <div class="move-icon">
101
+ <?php $image_url = plugin_dir_url("")."/chaty/admin/assets/images/move-icon.png"; ?>
102
+ <img src="<?php echo esc_url($image_url) ?>" />
103
+ </div>
104
+ <div class="icon icon-md active" data-label="<?php esc_attr_e($social['title']); ?>" data-title="<?php esc_attr_e($social['title']); ?>">
105
+ <span style="" class="custom-chaty-image custom-image-<?php echo esc_attr($social['slug']) ?>" id="image_data_<?php echo esc_attr($social['slug']) ?>">
106
+ <img src="<?php echo esc_url($imageUrl) ?>" />
107
+ <span onclick="remove_chaty_image('<?php echo esc_attr($social['slug']) ?>')" class="remove-icon-img"></span>
108
+ </span>
109
+ <span class="default-chaty-icon custom-icon-<?php echo esc_attr($social['slug']) ?> default_image_<?php echo esc_attr($social['slug']) ?>" >
110
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
111
+ <?php echo $social['svg']; ?>
112
+ </svg>
113
+ <span class="facustom-icon" style="background-color: <?php echo esc_attr($value['bg_color']) ?>"></span>
114
+ </span>
115
+ </div>
116
+ <!-- Social Media input -->
117
+ <div class="channels__input-box">
118
+ <input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e($value['value']); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
119
+ </div>
120
+ <?php
121
+ $channel_id = $this->del_space($social['slug']);
122
+ $channel_id = str_replace(' ', '_', $channel_id);
123
+ $channel_slug = strtolower($channel_id);
124
+ ?>
125
+ <div>
126
+ <!-- setting for desktop -->
127
+ <label class="channels__view" for="<?php echo esc_attr($channel_id); ?>Desktop">
128
+ <input type="checkbox" id="<?php echo esc_attr($channel_id); ?>Desktop" class="channels__view-check js-chanel-icon js-chanel-desktop" data-type="<?php esc_attr_e($channel_slug) ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_desktop]" value="checked" data-gramm_editor="false" <?php esc_attr_e($value['is_desktop']) ?> >
129
+ <span class="channels__view-txt">Desktop</label>
130
+ </label>
131
+
132
+ <!-- setting for mobile -->
133
+ <label class="channels__view" for="<?php echo esc_attr($channel_id); ?>Mobile" >
134
+ <input type="checkbox" id="<?php echo esc_attr($channel_id); ?>Mobile" class="channels__view-check js-chanel-icon js-chanel-mobile" data-type="<?php esc_attr_e($channel_slug); ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_mobile]" value="checked" data-gramm_editor="false" <?php esc_attr_e($value['is_mobile']) ?> />
135
+ <span class="channels__view-txt">Mobile</span>
136
+ </label>
137
+ </div>
138
+
139
+ <!-- button for advance setting -->
140
+ <div class="chaty-settings" onclick="toggle_chaty_setting('<?php echo esc_attr($social['slug']); ?>')">
141
+ <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
142
+ </div>
143
+
144
+ <!-- example for social media -->
145
+ <div class="input-example">
146
+ <?php esc_attr_e('For example', CHT_OPT); ?>: <?php echo esc_attr($social['example']); ?>
147
+ </div>
148
+
149
+ <!-- checking for extra help message for social media -->
150
+ <?php if((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) { ?>
151
+ <div class="viber-help">
152
+ <?php if(isset($social['help_link'])) { ?>
153
+ <?php $help_text = isset($social['help_title'])?$social['help_title']:"Doesn't work?"; ?>
154
+ <a href="<?php echo esc_url($social['help_link']) ?>" target="_blank"><?php esc_attr_e($help_text); ?></a>
155
+ <?php } else { ?>
156
+ <?php $help_title = isset($social['help_title'])?$social['help_title']:"Doesn't work?" ?>
157
+ <span><?php echo $social['help']; ?></span>
158
+ <?php esc_attr_e($help_title) ?>
159
+ <?php } ?>
160
+ </div>
161
+ <?php } ?>
162
+ </div>
163
+ <!-- advance setting fields: start -->
164
+ <div class="chaty-advance-settings">
165
+ <!-- Settings for custom icon and color -->
166
+ <div class="chaty-setting-col">
167
+ <label>Icon Appearance</label>
168
+ <div>
169
+ <!-- input for custom color -->
170
+ <input type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[bg_color]" class="chaty-color-field" value="<?php esc_attr_e($value['bg_color']) ?>" />
171
+ <?php if($this->is_pro()) { ?>
172
+ <!-- button to upload custom image -->
173
+ <a onclick="upload_chaty_image('<?php echo esc_attr($social['slug']); ?>')" href="javascript:;" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
174
+
175
+ <!-- hidden input value for image -->
176
+ <input id="cht_social_image_<?php echo esc_attr($social['slug']); ?>" type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[image_id]" value="<?php esc_attr_e($imageId) ?>" />
177
+ <?php } else { ?>
178
+ <div class="pro-features">
179
+ <div class="pro-item">
180
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
181
+ </div>
182
+ <div class="pro-button">
183
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
184
+ </div>
185
+ </div>
186
+ <?php } ?>
187
+ </div>
188
+ </div>
189
+ <div class="clear clearfix"></div>
190
+
191
+ <!-- Settings for custom title -->
192
+ <div class="chaty-setting-col">
193
+ <label>On Hover Text</label>
194
+ <div>
195
+ <!-- input for custom title -->
196
+ <input type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[title]" value="<?php esc_attr_e($value['title']) ?>">
197
+ </div>
198
+ </div>
199
+ <div class="clear clearfix"></div>
200
+
201
+ <?php if($this->is_pro()) { ?>
202
+ <?php if($social['slug'] == "Whatsapp") { ?>
203
+ <!-- advance setting for Whatsapp -->
204
+ <div class="clear clearfix"></div>
205
+ <div class="chaty-setting-col">
206
+ <label>Pre Set Message</label>
207
+ <div>
208
+ <?php $pre_set_message = isset($value['pre_set_message'])?$value['pre_set_message']:""; ?>
209
+ <input id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[pre_set_message]" value="<?php esc_attr_e($pre_set_message) ?>" >
210
+ </div>
211
+ </div>
212
+ <?php } else if($social['slug'] == "Email") { ?>
213
+ <!-- advance setting for Email -->
214
+ <div class="clear clearfix"></div>
215
+ <div class="chaty-setting-col">
216
+ <label>Mail Subject</label>
217
+ <div>
218
+ <?php $mail_subject = isset($value['mail_subject'])?$value['mail_subject']:"" ?>
219
+ <input id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[mail_subject]" value="<?php esc_attr_e($mail_subject) ?>" >
220
+ </div>
221
+ </div>
222
+ <?php } else if($social['slug'] == "WeChat") { ?>
223
+ <!-- advance setting for WeChat -->
224
+ <?php
225
+ $qr_code = isset($value['qr_code'])?$value['qr_code']:""; // Initialize QR code value if not exists. 2.1.0 change
226
+ $imageUrl = "";
227
+ $status = 0;
228
+ if($qr_code != "") {
229
+ $imageUrl = wp_get_attachment_image_src($qr_code, "full")[0]; // get custom Image URL if exists
230
+ }
231
+ if($imageUrl == "") {
232
+ $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; // Initialize with default image URL if URL is not exists
233
+ } else {
234
+ $status = 1;
235
+ }
236
+ ?>
237
+ <div class="clear clearfix"></div>
238
+ <div class="chaty-setting-col">
239
+ <label>Upload QR Code</label>
240
+ <div>
241
+ <!-- Button to upload QR Code image -->
242
+ <a class="cht-upload-image <?php esc_attr_e(($status)?"active":"") ?>" id="upload_qr_code" href="javascript:;" onclick="upload_qr_code()">
243
+ <img id="cht_social_image_src_<?php echo esc_attr($social['slug']); ?>" src="<?php echo esc_url($imageUrl) ?>" alt="<?php esc_attr_e($value['title']) ?>">
244
+ <span class="dashicons dashicons-upload"></span>
245
+ </a>
246
+
247
+ <!-- Button to remove QR Code image -->
248
+ <a href="javascript:;" class="remove-qr-code <?php esc_attr_e(($status)?"active":"") ?>" onclick="remove_qr_code()"><span class="dashicons dashicons-no-alt"></span></a>
249
+
250
+ <!-- input hidden field for QR Code -->
251
+ <input id="upload_qr_code_val" type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[qr_code]" value="<?php esc_attr_e($qr_code) ?>" >
252
+ </div>
253
+ </div>
254
+ <?php } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
255
+ $is_checked = (!isset($value['new_window']) || $value['new_window'] == 1)?1:0;
256
+ ?>
257
+ <!-- Advance setting for Custom Link -->
258
+ <div class="clear clearfix"></div>
259
+ <div class="chaty-setting-col">
260
+ <label >Open In a New Tab</label>
261
+ <div>
262
+ <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
263
+ <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
264
+ <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" <?php checked($is_checked, "checked"); ?> >
265
+ <span class="channels__view-txt">&nbsp;</span>
266
+ </label>
267
+ </div>
268
+ </div>
269
+ <?php } else if($social['slug'] == "Linkedin") {
270
+ $is_checked = isset($value['link_type'])?$value['link_type']:"personal";
271
+ ?>
272
+ <!-- Advance setting for Custom Link -->
273
+ <div class="clear clearfix"></div>
274
+ <div class="chaty-setting-col">
275
+ <label >LinkedIn</label>
276
+ <div>
277
+ <label>
278
+ <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
279
+ Personal
280
+ </label>
281
+ <label>
282
+ <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
283
+ Company
284
+ </label>
285
+ </div>
286
+ </div>
287
+ <?php } ?>
288
+ <?php } else { ?>
289
+ <div class="clear clearfix"></div>
290
+ <?php if($social['slug'] == "Whatsapp") {
291
+ $pre_set_message = isset($value['pre_set_message'])?$value['pre_set_message']:"";
292
+ ?>
293
+ <div class="clear clearfix"></div>
294
+ <div class="chaty-setting-col">
295
+ <label>Pre Set Message</label>
296
+ <div>
297
+ <div class="pro-features">
298
+ <div class="pro-item">
299
+ <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="<?php esc_attr_e($pre_set_message) ?>" >
300
+ </div>
301
+ <div class="pro-button">
302
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
303
+ </div>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ <?php } else if($social['slug'] == "Email") { ?>
308
+ <div class="clear clearfix"></div>
309
+ <div class="chaty-setting-col">
310
+ <label>Mail Subject</label>
311
+ <div>
312
+ <div class="pro-features">
313
+ <div class="pro-item">
314
+ <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="" >
315
+ </div>
316
+ <div class="pro-button">
317
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
318
+ </div>
319
+ </div>
320
+ </div>
321
+ </div>
322
+ <?php } else if($social['slug'] == "WeChat") { ?>
323
+ <div class="clear clearfix"></div>
324
+ <div class="chaty-setting-col">
325
+ <label>Upload QR Code</label>
326
+ <div>
327
+ <a target="_blank" class="cht-upload-image-pro" id="upload_qr_code" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" >
328
+ <span class="dashicons dashicons-upload"></span>
329
+ </a>
330
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
331
+ </div>
332
+ </div>
333
+ <?php } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
334
+ $is_checked = (!isset($value['new_window']) || $value['new_window'] == 1)?1:0;
335
+ ?>
336
+ <!-- Advance setting for Custom Link -->
337
+ <div class="clear clearfix"></div>
338
+ <div class="chaty-setting-col">
339
+ <label >Open In a New Tab</label>
340
+ <div>
341
+ <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
342
+ <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
343
+ <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" <?php checked($is_checked, "checked"); ?> >
344
+ <span class="channels__view-txt">&nbsp;</span>
345
+ </label>
346
+ </div>
347
+ </div>
348
+ <?php } else if($social['slug'] == "Linkedin") {
349
+ $is_checked = isset($value['link_type'])?$value['link_type']:"personal";
350
+ ?>
351
+ <!-- Advance setting for Custom Link -->
352
+ <div class="clear clearfix"></div>
353
+ <div class="chaty-setting-col">
354
+ <label >LinkedIn</label>
355
+ <div>
356
+ <label>
357
+ <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
358
+ Personal
359
+ </label>
360
+ <label>
361
+ <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
362
+ Company
363
+ </label>
364
+ </div>
365
+ </div>
366
+ <?php } ?>
367
+ <?php } ?>
368
+ </div>
369
+ <!-- advance setting fields: end -->
370
+
371
+ <!-- remove social media setting button: start -->
372
+ <button class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
373
+ <svg width="14" height="13" viewBox="0 0 14 13" fill="none"
374
+ xmlns="http://www.w3.org/2000/svg">
375
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
376
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
377
+ </svg>
378
+ </button>
379
+ <!-- remove social media setting button: end -->
380
+ </div>
381
+ </li>
382
+ <!-- Social media setting box: end -->
383
+ <?php
384
+ $html = ob_get_clean();
385
+ echo json_encode($html);
386
+ }
387
+ wp_die();
388
+ }
389
+ /* function choose_social_handler end */
390
+
391
+ /* get social media list for front end widget */
392
+ public function get_social_icon_list()
393
+ {
394
+ $social = get_option('cht_numb_slug'.$this->widget_number); // get saved social media list
395
+ $social = explode(",", $social);
396
+
397
+ $arr = array();
398
+ foreach ($social as $key_soc):
399
+ foreach ($this->socials as $key => $social) : // compare with Default Social media list
400
+ if ($social['slug'] != $key_soc) {
401
+ continue; // return if slug is not equal
402
+ }
403
+ $value = get_option('cht_social'.$this->widget_number.'_' . $social['slug']); // get saved settings for button
404
+ if ($value) {
405
+ if (!empty($value['value'])) {
406
+ $slug = strtolower($social['slug']);
407
+ $url = "";
408
+ $mobile_url = "";
409
+ $desktop_target = "";
410
+ $mobile_target = "";
411
+ $qr_code_image = "";
412
+
413
+ if($social['slug'] == "Viber") {
414
+ /* Viber change to exclude + from number for desktop */
415
+ $val = $value['value'];
416
+ $fc = substr($val, 0, 1);
417
+ if($fc == "+") {
418
+ $length = -1*(strlen($val)-1);
419
+ $val = substr($val, $length);
420
+ }
421
+ if(!wp_is_mobile()) {
422
+ /* Viber change to include + from number for mobile */
423
+ $val = "+".$val;
424
+ }
425
+ } else if($social['slug'] == "Whatsapp") {
426
+ /* Whatspp change to exclude + from phone number */
427
+ $val = $value['value'];
428
+ $val = str_replace("+","", $val);
429
+ } else if($social['slug'] == "Facebook_Messenger") {
430
+ /* Facebook change to change URL from facebook.com to m.me version 2.1.0 change */
431
+ $val = $value['value'];
432
+ $val = str_replace("facebook.com","m.me", $val);
433
+ /* Facebook change to remove www. from URL. version 2.1.0 change */
434
+ $val = str_replace("www.","", $val);
435
+
436
+ $val = trim($val, "/");
437
+ $val_array = explode("/", $val);
438
+ $total = count($val_array)-1;
439
+ $last_value = $val_array[$total];
440
+ $last_value = explode("-", $last_value);
441
+ $total_text = count($last_value)-1;
442
+ $total_text = $last_value[$total_text];
443
+
444
+ if(is_numeric($total_text)) {
445
+ $val_array[$total] = $total_text;
446
+ $val = implode("/", $val_array);
447
+ }
448
+ } else {
449
+ $val = $value['value'];
450
+ }
451
+ if(!isset($value['title']) || empty($value['title'])) {
452
+ $value['title'] = $social['title']; // Initialize title with default title if not exists. version 2.1.0 change
453
+ }
454
+ $image_url = "";
455
+
456
+ /* get custom image URL if uploaded. version 2.1.0 change */
457
+ if(isset($value['image_id']) && !empty($value['image_id'])) {
458
+ $image_id = $value['image_id'];
459
+ if(!empty($image_id)) {
460
+ $image_data = wp_get_attachment_image_src($image_id, "full");
461
+ if(!empty($image_data) && is_array($image_data)) {
462
+ $image_url = $image_data[0];
463
+ }
464
+ }
465
+ }
466
+
467
+ /* get custom icon background color if exists. version 2.1.0 change */
468
+ if(!isset($value['bg_color']) || empty($value['bg_color'])) {
469
+ $value['bg_color'] = '';
470
+ }
471
+ if($slug == "whatsapp") {
472
+ /* setting for Whatsapp URL */
473
+ $val = str_replace("+","",$val);
474
+ $url = "https://web.whatsapp.com/send?phone=".$val;
475
+ $mobile_url = "https://wa.me/".$val;
476
+ // https://wa.me/$number?text=$test
477
+ if(isset($value['pre_set_message']) && !empty($value['pre_set_message'])) {
478
+ $url .= "&text=".urlencode($value['pre_set_message']);
479
+ $mobile_url .= "?text=".urlencode($value['pre_set_message']);
480
+ }
481
+ if(wp_is_mobile()) {
482
+ $mobile_target = "";
483
+ } else {
484
+ $desktop_target = "_blank";
485
+ }
486
+ } else if($slug == "phone") {
487
+ /* setting for Phone */
488
+ $url = "tel: ".$val;
489
+ } else if($slug == "sms") {
490
+ /* setting for SMS */
491
+ $url = "sms:".$val;
492
+ } else if($slug == "telegram") {
493
+ /* setting for Telegram */
494
+ $url = "https://telegram.me/".$val;
495
+ $desktop_target = "_blank";
496
+ $mobile_target = "_blank";
497
+ } else if($slug == "line" || $slug == "google_maps" || $slug == "poptin" || $slug == "waze" ) {
498
+ /* setting for Line, Google Map, Link, Poptin, Waze, Custom Link */
499
+ $url = esc_url($val);
500
+ $desktop_target = "_blank";
501
+ $mobile_target = "_blank";
502
+ } else if($slug == "link" || $slug == "custom_link") {
503
+ $url = $val;
504
+ $is_exist = strpos($val, "javascript");
505
+ if($is_exist != "") {
506
+ $url = esc_url($val);
507
+ } else {
508
+ if($slug == "custom_link" || $slug == "link") {
509
+ $desktop_target = (isset($value['new_window']) && $value['new_window'] == 0)?"":"_blank";
510
+ $mobile_target = (isset($value['new_window']) && $value['new_window'] == 0)?"":"_blank";
511
+ }
512
+ }
513
+ }else if($slug == "wechat") {
514
+ /* setting for WeChat */
515
+ $url = "javascript:;";
516
+ $value['title'] .= ": ".$val;
517
+ $qr_code = isset($value['qr_code'])?$value['qr_code']:"";
518
+ if(!empty($qr_code)) {
519
+ $image_data = wp_get_attachment_image_src($qr_code, "full");
520
+ if(!empty($image_data) && is_array($image_data)) {
521
+ $qr_code_image = $image_data[0];
522
+ }
523
+ }
524
+ } else if($slug == "viber") {
525
+ /* setting for Viber */
526
+ $url = $val;
527
+ } else if($slug == "snapchat") {
528
+ /* setting for SnapChat */
529
+ $url = "https://www.snapchat.com/add/".$val;
530
+ $desktop_target = "_blank";
531
+ $mobile_target = "_blank";
532
+ } else if($slug == "waze") {
533
+ /* setting for Waze */
534
+ $url = "javascript:;";
535
+ $value['title'] .= ": ".$val;
536
+ } else if($slug == "vkontakte") {
537
+ /* setting for vkontakte */
538
+ $url = "https://vk.me/".$val;
539
+ $desktop_target = "_blank";
540
+ $mobile_target = "_blank";
541
+ } else if($slug == "skype") {
542
+ /* setting for Skype */
543
+ $url = "skype:".$val."?chat";
544
+ } else if($slug == "email") {
545
+ /* setting for Email */
546
+ $url = "mailto:".$val;
547
+ $mail_subject = (isset($value['mail_subject']) && !empty($value['mail_subject']))?$value['mail_subject']:"";
548
+ if($mail_subject != "") {
549
+ $url .= "?subject=".urlencode($mail_subject);
550
+ }
551
+ } else if($slug == "facebook_messenger") {
552
+ /* setting for facebook URL */
553
+ $url = esc_url($val);
554
+ $url = str_replace("http:", "https:", $url);
555
+ if(wp_is_mobile()) {
556
+ $mobile_target = "";
557
+ } else {
558
+ $desktop_target = "_blank";
559
+ }
560
+ } else if($slug == "twitter") {
561
+ /* setting for Twitter */
562
+ $url = "https://twitter.com/".$val;
563
+ $desktop_target = "_blank";
564
+ $mobile_target = "_blank";
565
+ } else if($slug == "instagram") {
566
+ /* setting for Instagram */
567
+ $url = "https://www.instagram.com/".$val;
568
+ $desktop_target = "_blank";
569
+ $mobile_target = "_blank";
570
+ } else if($slug == "linkedin") {
571
+ /* setting for Linkedin */
572
+ $link_type = !isset($value['link_type']) || $value['link_type'] == "company"?"company":"personal";
573
+ if($link_type == "personal") {
574
+ $url = "https://www.linkedin.com/in/".$val;
575
+ } else {
576
+ $url = "https://www.linkedin.com/company/".$val;
577
+ }
578
+ $desktop_target = "_blank";
579
+ $mobile_target = "_blank";
580
+ }
581
+
582
+ /* Instagram checking for custom color */
583
+ if($slug == "instagram" && $value['bg_color'] == "#ffffff") {
584
+ $value['bg_color'] = "";
585
+ }
586
+
587
+ $svg = trim(preg_replace('/\s\s+/', '', $social['svg']));
588
+
589
+ $is_mobile = isset($value['is_mobile']) ? 1 : 0;
590
+ $is_desktop = isset($value['is_desktop']) ? 1 : 0;
591
+
592
+ if(empty($mobile_url)) {
593
+ $mobile_url = $url;
594
+ }
595
+
596
+ $svg = '<svg class="ico_d" width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg" style="transform: rotate(0deg);">'.$svg.'</svg>';
597
+
598
+ $data = array(
599
+ 'val' => esc_attr__(wp_unslash($val)),
600
+ 'default_icon' => $svg,
601
+ 'bg_color' => $value['bg_color'],
602
+ 'title' => esc_attr__(wp_unslash($value['title'])),
603
+ 'img_url' => esc_url($image_url),
604
+ 'social_channel' => $slug,
605
+ 'href_url' => $url,
606
+ 'desktop_target' => $desktop_target,
607
+ 'mobile_target' => $mobile_target,
608
+ 'qr_code_image' => esc_url($qr_code_image),
609
+ 'channel' => $social['slug'],
610
+ 'is_mobile' => $is_mobile,
611
+ 'is_desktop' => $is_desktop,
612
+ 'mobile_url' => $mobile_url,
613
+ "has_font" => 0
614
+ );
615
+ $arr[] = $data;
616
+ }
617
+ }
618
+ endforeach;
619
+ endforeach;
620
+ return $arr;
621
+ }
622
+
623
+ public function insert_widget()
624
+ {
625
+ if ($this->canInsertWidget()):
626
+ include_once CHT_DIR . '/views/widget.php';
627
+ endif;
628
+ }
629
+
630
+ private function canInsertWidget()
631
+ {
632
+ return get_option('cht_active') && $this->checkChannels();
633
+ }
634
+
635
+ private function checkChannels()
636
+ {
637
+ $social = explode(",", get_option('cht_numb_slug'));
638
+ $res = false;
639
+ foreach ($social as $name) {
640
+ $value = get_option('cht_social_' . strtolower($name));
641
+ $res = $res || !empty($value['value']);
642
+ }
643
+ return $res;
644
+ }
645
+ }
646
+
647
+ return new CHT_Frontend();
js/cht-front-script.js ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !function (t) {
2
+ var e = {};
3
+
4
+ function i(n) {
5
+ if (e[n]) return e[n].exports;
6
+ var o = e[n] = {i: n, l: !1, exports: {}};
7
+ return t[n].call(o.exports, o, o.exports, i), o.l = !0, o.exports
8
+ }
9
+
10
+ i.m = t, i.c = e, i.d = function (t, e, n) {
11
+ i.o(t, e) || Object.defineProperty(t, e, {configurable: !1, enumerable: !0, get: n})
12
+ }, i.n = function (t) {
13
+ var e = t && t.__esModule ? function () {
14
+ return t.default
15
+ } : function () {
16
+ return t
17
+ };
18
+ return i.d(e, "a", e), e
19
+ }, i.o = function (t, e) {
20
+ return Object.prototype.hasOwnProperty.call(t, e)
21
+ }, i.p = "/", i(i.s = 10)
22
+ }({
23
+ 10: function (t, e, i) {
24
+ i(11), t.exports = i(12)
25
+ }, 11: function (t, e) {
26
+ !function (t) {
27
+ var animationTimer;
28
+ var isWidgetEnabled = 0;
29
+ var e = chaty_settings;
30
+ var animationClass = ".i-trigger .chaty-widget-i .svg, .i-trigger .chaty-widget-i .widget-img, .i-trigger .chaty-widget-i .facustom-icon";
31
+
32
+ function i(t) {
33
+ for (var e = t + "=", i = document.cookie.split(";"), n = 0; n < i.length; n++) {
34
+ for (var o = i[n]; " " == o.charAt(0);) o = o.substring(1);
35
+ if (0 == o.indexOf(e)) return o.substring(e.length, o.length)
36
+ }
37
+ return ""
38
+ }
39
+
40
+ var n = new Date;
41
+
42
+ function o() {
43
+
44
+ }
45
+
46
+ "" != i("display_cta"), token = "", jQuery(document).ready(function () {
47
+ "true" == e.object_settings.active && (function (e, n) {
48
+ var o = e.object_settings.device, a = "";
49
+ if ("right" == e.object_settings.position) a = "left: auto;bottom: 25px; right: 25px;"; else if ("left" == e.object_settings.position) a = "right: auto; bottom: 25px; left: 25px;"; else if ("custom" == e.object_settings.position) {
50
+ var c = e.object_settings.pos_side, s = e.object_settings.bot, r = e.object_settings.side;
51
+ a = "right" === c ? "left: auto; bottom: " + s + "px; right: " + r + "px" : "left: " + r + "px; bottom: " + s + "px; right: auto"
52
+ }
53
+ var g = e.object_settings.cta, d = "", l = e.object_settings.social;
54
+ var isChatyInMobile = false; //initiate as false
55
+ if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
56
+ || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {
57
+ isChatyInMobile = true;
58
+ }
59
+ if(isChatyInMobile) {
60
+ jQuery("body").addClass("chaty-in-mobile");
61
+ } else {
62
+ jQuery("body").addClass("chaty-in-desktop");
63
+ }
64
+ if (Object.keys(l).length >= 1 && (d = '<div class="chaty-widget hide-widget ' + n + " " + o + ' " style="display:block; ' + a + '" dir="ltr">', d += '<div class="chaty-widget-is" id="transition_disabled">'), d += function (e) {
65
+ var i = "", n = 0;
66
+ return t.each(e.object_settings.social, function (t, o) {
67
+ if (e.object_settings.isPRO && jQuery("body").addClass("has-pro-version"), !e.object_settings.isPRO && "3" == ++n) return !1;
68
+ extra_class = "", "1" != e.object_settings.analytics && 1 != e.object_settings.analytics || (extra_class += " update-analytics ");
69
+ var desktopClass = (e.object_settings.social[t].is_desktop == 1)?"is-in-desktop":"";
70
+ var mobileClass = (e.object_settings.social[t].is_mobile == 1)?"is-in-mobile":"";
71
+ var targetAction = (e.object_settings.is_mobile == 1)?e.object_settings.social[t].mobile_target:e.object_settings.social[t].desktop_target;
72
+ if(jQuery("body").hasClass("chaty-in-mobile")) {
73
+ e.object_settings.social[t].href_url = e.object_settings.social[t].mobile_url;
74
+ }
75
+
76
+ if(e.object_settings.social[t].social_channel == "viber") {
77
+ if(jQuery("body").hasClass("chaty-in-mobile")) {
78
+ var viberVal = e.object_settings.social[t].href_url;
79
+ viberVal = viberVal.replace("+","");
80
+ if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
81
+ viberVal = "+"+viberVal;
82
+ }
83
+ e.object_settings.social[t].href_url = viberVal;
84
+ }
85
+ e.object_settings.social[t].href_url = "viber://chat?number="+e.object_settings.social[t].href_url;
86
+ }
87
+ console.log(e.object_settings.social[t].href_url);
88
+ socialString = '<div class="chaty-widget-i chaty-main-widget ' + desktopClass + " " + mobileClass + " " + extra_class + " " + e.object_settings.social[t].social_channel + '" data-title="' + e.object_settings.social[t].val + '" id="chaty-channel-' + e.object_settings.social[t].social_channel + '" data-channel="' + e.object_settings.social[t].social_channel + '" data-code="' + e.object_settings.social[t].qr_code_image + '">', bgColor = "", "" != e.object_settings.social[t].bg_color && (socialString += "<style>#chaty-channel-" + e.object_settings.social[t].social_channel + " .color-element {fill: " + e.object_settings.social[t].bg_color + "}</style>", bgColor = "style='background-color: " + e.object_settings.social[t].bg_color + ";'"), socialString += "<a class='set-url-target' rel='noopener' data-mobile-target='"+e.object_settings.social[t].mobile_target+"' data-desktop-target='"+e.object_settings.social[t].desktop_target+"' target='" + targetAction + "' href='" + e.object_settings.social[t].href_url + "' >", "" != e.object_settings.social[t].img_url ? socialString += "<span " + bgColor + " class='chaty-social-img'><img src='" + e.object_settings.social[t].img_url + "' alt='" + e.object_settings.social[t].title + "' /></span>" : socialString += e.object_settings.social[t].default_icon, socialString += "</a>", socialString += "<div class='chaty-widget-i-title'><p>" + e.object_settings.social[t].title + "</p></div>", socialString += "</div>";
89
+ i += socialString;
90
+ }), i
91
+ }(e), l = e.object_settings.social, Object.keys(l).length >= 1) {
92
+ d += "</div>", d += '<div class="i-trigger">';
93
+ var h = i("display_cta");
94
+ var CU = current_url = window.location.origin;
95
+ CU = CU.replace("https://","");
96
+ CU = CU.replace("http://","");
97
+ if ("" != g && "none" != h) var p = "true"; else p = "no-tooltip";
98
+ d += '<div class="chaty-widget-i chaty-close-settings i-trigger-open ' + p + ' ">', d += function (t) {
99
+ switch (t.object_settings.widget_type) {
100
+ case"chat-image":
101
+ if (t.object_settings.widget_img.length > 1) return '<div class="widget-img" style="background-color:' + t.object_settings.color + '"><img src="' + t.object_settings.widget_img + '"/></div>';
102
+ case"chat-smile":
103
+ return '<svg version="1.1" id="smile" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.8 507.1 54 54" style="enable-background:new -496.8 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;} .st2{fill:none;stroke:#808080;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;}</style><g><circle cx="-469.8" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g><path class="st1" d="M-459.5,523.5H-482c-2.1,0-3.7,1.7-3.7,3.7v13.1c0,2.1,1.7,3.7,3.7,3.7h19.3l5.4,5.4c0.2,0.2,0.4,0.2,0.7,0.2c0.2,0,0.2,0,0.4,0c0.4-0.2,0.6-0.6,0.6-0.9v-21.5C-455.8,525.2-457.5,523.5-459.5,523.5z"/><path class="st2" d="M-476.5,537.3c2.5,1.1,8.5,2.1,13-2.7"/><path class="st2" d="M-460.8,534.5c-0.1-1.2-0.8-3.4-3.3-2.8"/></svg>';
104
+ case"chat-bubble":
105
+ return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;}</style><g><circle cx="-469.9" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g><path class="st1" d="M-472.6,522.1h5.3c3,0,6,1.2,8.1,3.4c2.1,2.1,3.4,5.1,3.4,8.1c0,6-4.6,11-10.6,11.5v4.4c0,0.4-0.2,0.7-0.5,0.9 c-0.2,0-0.2,0-0.4,0c-0.2,0-0.5-0.2-0.7-0.4l-4.6-5c-3,0-6-1.2-8.1-3.4s-3.4-5.1-3.4-8.1C-484.1,527.2-478.9,522.1-472.6,522.1z M-462.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-464.6,534.6-463.9,535.3-462.9,535.3z M-469.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-471.7,534.6-471,535.3-469.9,535.3z M-477,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-478.8,534.6-478.1,535.3-477,535.3z"/></svg>';
106
+ case"chat-db":
107
+ return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.1 54 54" style="enable-background:new -496 507.1 54 54;" xml:space="preserve"><style type="text/css">.st1{fill:#FFFFFF;}</style><g><circle cx="-469" cy="534.1" r="27" fill="' + t.object_settings.color + '"/></g><path class="st1" d="M-464.6,527.7h-15.6c-1.9,0-3.5,1.6-3.5,3.5v10.4c0,1.9,1.6,3.5,3.5,3.5h12.6l5,5c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18.2C-461.1,529.3-462.7,527.7-464.6,527.7z"/><path class="st1" d="M-459.4,522.5H-475c-1.9,0-3.5,1.6-3.5,3.5h13.9c2.9,0,5.2,2.3,5.2,5.2v11.6l1.9,1.9c0.2,0.2,0.3,0.2,0.7,0.2c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18C-455.9,524.1-457.5,522.5-459.4,522.5z"/></svg>';
108
+ default:
109
+ return '<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve"><style type="text/css">.st1 {fill: #FFFFFF;}.st0{fill: #808080;}</style><g><circle cx="-469" cy="534.7" r="27" fill="' + t.object_settings.color + '"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/><path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/><path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/></svg>'
110
+ }
111
+ }(e), h = i("display_cta"), "" != g && "none" != h && (d += ' <div class="chaty-widget-i-title true"> ', d += g, d += "</div>"), d += "</div>", d += '<div class="chaty-widget-i chaty-close-settings i-trigger-close" data-title="' + e.object_settings.close_text + '" style="background-color:' + e.object_settings.color + '">', "" == e.object_settings.close_img ? (d += '<svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">', d += '<ellipse cx="26" cy="26" rx="26" ry="26" fill="' + e.object_settings.color + '"/>', d += '<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"/>', d += '<rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"/>', d += "</svg>") : d += "<span class='chaty-social-img'><img alt='" + e.object_settings.close_text + "' src='" + e.object_settings.close_img + "' /></span>", d += '<div class="chaty-widget-i-title">', d += e.object_settings.close_text, d += "</div>", d += "</div>", d += " </div>", 0 === n.length && !e.object_settings.isPRO && (d += '<div class="get" style="position: absolute;width: 100%;text-align: center;"> <a href="https://premio.io/downloads/chaty/?utm_source=wpplugin&domain='+CU+'" target="_blank" style=" font-size: 11px; top: -10px; font-family: Lato, Helvetica, Arial, sans-serif; position: relative; color: #8c8585; ">Get Chaty</a></div>'), d += "</div>"
112
+ } else ;
113
+ t("body").append(d)
114
+ }(e, token)), function () {
115
+ var n = t(".chaty-widget"), a = e.object_settings.widget_size ? e.object_settings.widget_size : 54,
116
+ c = +e.object_settings.widget_size + 8;
117
+
118
+ function s() {
119
+ var t = n.position().top, e = n.find(".chaty-widget-is .chaty-widget-i").length;
120
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
121
+ e = n.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
122
+ } else {
123
+ e = n.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
124
+ }
125
+ if (e * c > (jQuery(window).height() - (chaty_settings.object_settings.widget_size+8))) {
126
+ var i = Math.round(Math.sqrt(e)), o = Math.ceil(Math.sqrt(e));
127
+ n.find(".chaty-widget-is").css({
128
+ height: o * c,
129
+ width: i * c
130
+ }), g(o), n.find("span").css({
131
+ height: o * c,
132
+ width: i * c
133
+ }), g(o), n.find("img").css({height: o * c, width: i * c}), g(o)
134
+ } else g()
135
+ }
136
+
137
+ function r() {
138
+ "left" === e.object_settings.position && n.addClass("chaty-widget-is-right"), "custom" === e.object_settings.position && "left" === e.object_settings.pos_side && n.addClass("chaty-widget-is-right")
139
+ }
140
+ function g(t) {
141
+ var e;
142
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
143
+ e = n.find(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
144
+ } else {
145
+ e = n.find(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
146
+ }
147
+ n.find(".chaty-widget-i").css({
148
+ height: a + "px",
149
+ width: a + "px"
150
+ }), n.find("img").css({
151
+ height: a + "px",
152
+ width: a + "px"
153
+ }), n.find("span").css({
154
+ height: a + "px",
155
+ width: a + "px"
156
+ }), n.find(".chaty-widget-is").css({top: "-" + 100 * e + "%"});
157
+ n.find(".chaty-widget-is").height(e*(parseInt(a)+8));
158
+ n.find(".chaty-widget-is").width(parseInt(a)+8);
159
+ }
160
+
161
+ r(), s(), jQuery(window).resize(function () {
162
+ s(), 1 == Object.keys(e.object_settings.social).length && (jQuery(".chaty-widget").addClass("chaty-widget-show"), jQuery(".chaty-widget-is").css("top", "auto"))
163
+ }), t(".chaty-widget-i.facebook").mouseenter(function () {
164
+ t(".facebook_two_mess").css({opacity: "1", "z-index": "1"}), t(this).addClass("before")
165
+ }), t(".chaty-widget-i.facebook").mouseleave(function () {
166
+ t(".facebook_two_mess").css({opacity: "0", "z-index": "1"}), t(this).removeClass("before")
167
+ }), t(".chaty-widget-i.facebook").on("click", function () {
168
+ t(this).addClass("active"), t(".facebook_two_mess").hide(), jQuery(".chaty-widget .get a").hide(), t(this).children(".face_title").css({
169
+ opacity: "1",
170
+ "z-index": "2"
171
+ }).show(), t(".chaty-widget").hasClass("one_widget") ? t(".chaty-widget").hasClass("chaty-widget-is-right") ? t(".face_title").css({
172
+ top: "calc(100% - 447px)",
173
+ left: "20px"
174
+ }) : t(".face_title").css({
175
+ top: "calc(100% - 447px)",
176
+ left: "auto",
177
+ right: "20px"
178
+ }) : (t(".facebook_two_mess").css({
179
+ opacity: "0",
180
+ "z-index": "10001"
181
+ }), t(".ico_d").hide(), t(".chaty-widget .chaty-widget-i").css({"box-shadow": "0px 3px 6px rgba(0,0,0,0)"}), t(".chaty-widget").hasClass("one_widget") || t(".i-trigger").hide())
182
+ }), t(".i-trigger-close").on("click", function (e) {
183
+ e.preventDefault(), t(".chaty-widget-i.facebook").hasClass("active") || (n.removeClass("chaty-widget-show"), n.addClass("none-widget-show"))
184
+ }), t("body").on("click", ".close_facebook", function () {
185
+ t(".facebook_two_mess").show(), jQuery(".chaty-widget .get a").show(), t(".chaty-widget-i.facebook").removeClass("active"), t(this).parent().parent().css({opacity: "1"}).hide(), t(".i-trigger").show(), t(".chaty-widget-is .chaty-widget-i svg").show()
186
+ }), t(".i-trigger-close").on("click", function (e) {
187
+ t(".i-trigger-open").addClass("active_clos"), e.preventDefault(), t(".chaty-widget-i.facebook").hasClass("active") || (n.removeClass("chaty-widget-show"), n.addClass("none-widget-show"))
188
+ }), t("body").on("click", ".update-analytics", function (t) {
189
+ if (channelName = jQuery(this).attr("data-channel"), null != channelName && "" != channelName) if (window.hasOwnProperty("gtag")) gtag("event", "chaty_" + channelName, {
190
+ eventCategory: "chaty_" + channelName,
191
+ event_action: "chaty_" + channelName
192
+ }); else if (window.hasOwnProperty("ga")) {
193
+ var e = window.ga.getAll()[0];
194
+ e && e.send("event", "click", {
195
+ eventCategory: "chaty_" + channelName,
196
+ eventAction: "chaty_" + channelName
197
+ })
198
+ }
199
+ }), t("body").on("click", ".wechat", function () {
200
+ var t = jQuery(".chaty-widget .chaty-widget-i.wechat").attr("data-code");
201
+ null != t && "" != t && (jQuery("#wechat-qr-code").length || (htmlString = "<div id='wechat-qr-code' class='wechat-qr-code'>", htmlString += '<div class="wechat-box-head">WeChat<svg xmlns="http://www.w3.org/2000/svg" class="close_facebook" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="612px" height="612px" viewBox="0 0 612 612" style="fill: #fff; float: right; margin-top: 4px;" xml:space="preserve"><path xmlns="http://www.w3.org/2000/svg" d="M268.064,256.75l138.593-138.593c3.124-3.124,3.124-8.189,0-11.313c-3.125-3.124-8.189-3.124-11.314,0L256.75,245.436 L118.157,106.843c-3.124-3.124-8.189-3.124-11.313,0c-3.125,3.124-3.125,8.189,0,11.313L245.436,256.75L106.843,395.343 c-3.125,3.125-3.125,8.189,0,11.314c1.562,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343L256.75,268.064l138.593,138.593 c1.563,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343c3.124-3.125,3.124-8.189,0-11.314L268.064,256.75z"></path></svg></div>', htmlString += "<div class='wechat-box'><img src='" + t + "' alt='QR Code' /><a href='javascript:;'>", htmlString += "</a></div></div>", jQuery("body").append(htmlString)), jQuery("#wechat-qr-code").show())
202
+ });
203
+ var d = i("display_cta");
204
+ if(chaty_settings.object_settings.display_state == "hover") {
205
+ n.find(".i-trigger-open").mouseenter(function (e) {
206
+ e.stopPropagation();
207
+ removeAnimation();
208
+ //t(this).removeClass("active_clos");
209
+ o(), t(".chaty-widget-is").removeAttr("id"), t(this).hasClass("active_clos") || t(".chaty-widget-i.facebook").hasClass("active") || n.hasClass("one_widget") || (r(), t(n).hasClass("chaty-widget-show") || (n.addClass("chaty-widget-show"), n.removeClass("none-widget-show")));
210
+ //o();
211
+ jQuery("body .chaty-widget-i-title.true").remove();
212
+ });
213
+ } else {
214
+ n.find(".i-trigger-open").click(function (e) {
215
+ e.stopPropagation();
216
+ removeAnimation();
217
+ o(), t(".chaty-widget-is").removeAttr("id"), t(this).hasClass("active_clos") || t(".chaty-widget-i.facebook").hasClass("active") || n.hasClass("one_widget") || (r(), t(n).hasClass("chaty-widget-show") || (n.addClass("chaty-widget-show"), n.removeClass("none-widget-show")));
218
+ o();
219
+ jQuery("body .chaty-widget-i-title.true").remove();
220
+ });
221
+ }
222
+ t(".one_widget").on("click", function () {
223
+ t(".chaty-widget-i-title").hasClass("face_title") ? (t(".facebook_two_mess").detach(), t(".chaty-widget-i").addClass("bofore_del")) : (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del"));
224
+ removeAnimation();
225
+ }), n.find(".i-trigger-open").on("click", function () {
226
+ "none" != d && (t(".chaty-widget").hasClass(".one_widget") || t(".i-trigger-open .chaty-widget-i-title").detach()), t(".i-trigger-open").addClass("no-tooltip"), t(this).hasClass("active_clos") || t(".chaty-widget-i.facebook").hasClass("active") || n.hasClass("one_widget") || (r(), t(n).hasClass("chaty-widget-show") || (n.addClass("chaty-widget-show"), n.removeClass("none-widget-show")));
227
+ removeAnimation();
228
+ }), n.find(".i-trigger-open").mouseenter(function () {
229
+ t(this).addClass("no-tooltip"), t(".i-trigger-open").removeClass("active_clos");
230
+ s();
231
+ }), n.find(".chaty-widget-is").mouseleave(function () {
232
+ t(".i-trigger-open").removeClass("active_clos"), t(".chaty-widget-i.facebook").hasClass("active")
233
+ }), 1 === Object.keys(e.object_settings.social).length && n.find(".i-trigger-open").on("touchstart", function (e) {
234
+ "use strict";
235
+ t(this).find(".chaty-widget-i").toggleClass("hover")
236
+ }), 1 == Object.keys(e.object_settings.social).length && (jQuery(".chaty-widget").addClass("chaty-widget-show"), jQuery(".chaty-widget-is").css("top", "auto"), jQuery(".chaty-widget-is").css("z-index", "10001"), jQuery(".chaty-widget-i.i-trigger-close, .i-trigger.chaty-widget-i").remove(), jQuery(".chaty-widget .get a").css("top", "-10px"), jQuery(".chaty-widget").addClass("one_widget"), jQuery(".chaty-widget-i:first .chaty-widget-i-title:last p").text(e.object_settings.cta), jQuery(document).on("click", ".chaty-widget-i", function () {
237
+ jQuery(".chaty-widget-i:first .chaty-widget-i-title:last").hide(), jQuery("body").addClass("hide-cht-widget")
238
+ }), jQuery("body").append("<style>.chaty-widget-is{top:0!important;}</style>"))
239
+ }(), t(document).ready(function () {
240
+ 1 !== Object.keys(e.object_settings.social).length || !e.object_settings.social.snapchat && !e.object_settings.social.wechat || e.object_settings.cta || (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del")), t(".chaty-widget-i-title").hasClass("one_go") && (t(".chaty-widget-i-title p").text(t(".chaty-widget-i-title.one_go").html()), "none" == i("display_cta") && (t(".chaty-widget-i-title").hasClass("face_title") ? (t(".facebook_two_mess").detach(), t(".chaty-widget-i").addClass("bofore_del")) : (t(".chaty-widget-i-title").detach(), t(".chaty-widget-i").addClass("bofore_del")))), window.matchMedia("only screen and (max-width: 760px)").matches && t(".i-trigger-open").addClass("active_clos"), jQuery(".chaty-widget-i-title").each(function () {
241
+ "" == jQuery(this).text() && jQuery(this).remove()
242
+ })
243
+ }), t(document).ready(function () {
244
+ var activeWidget = 0;
245
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
246
+ activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
247
+ } else {
248
+ activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
249
+ }
250
+ if(activeWidget == 0) {
251
+ jQuery(".chaty-widget").addClass("hide-widget").removeClass("desktop_active").removeClass("mobile_active");
252
+ } else {
253
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
254
+ jQuery(".chaty-widget").removeClass("hide-widget").addClass("desktop_active");
255
+ } else {
256
+ jQuery(".chaty-widget").removeClass("hide-widget").addClass("mobile_active");
257
+ }
258
+ if(activeWidget == 1) {
259
+ jQuery(".chaty-close-settings").hide();
260
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
261
+ htmlToAdd = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop:first").clone();
262
+ jQuery(".i-trigger").html(htmlToAdd);
263
+ } else {
264
+ htmlToAdd = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile:first").clone();
265
+ jQuery(".i-trigger").html(htmlToAdd);
266
+ }
267
+ jQuery(".i-trigger .chaty-widget-i-title p").text(chaty_settings.object_settings.cta);
268
+ jQuery(".chaty-widget").addClass("one_widget");
269
+
270
+ jQuery(".chaty-widget.one_widget, .i-trigger, .chaty-widget-i").mouseenter(function () {
271
+ o();
272
+ jQuery(".chaty-widget-i-title").remove();
273
+ jQuery(".chaty-widget").addClass("hide-tooltip-arrow");
274
+ set_cta_status();
275
+ removeAnimation();
276
+ });
277
+ } else {
278
+ jQuery(".chaty-widget").removeClass("one_widget");
279
+ jQuery(".i-trigger .chaty-main-widget").remove();
280
+ jQuery(".chaty-close-settings").show();
281
+ jQuery(".chaty-widget-i-title").removeClass("hide-it");
282
+ jQuery(".chaty-widget.one_widget, .i-trigger, .chaty-widget-i").mouseenter(function () {
283
+ o();
284
+ set_cta_status();
285
+ jQuery(".i-trigger .chaty-widget-i-title").addClass("hide-it");
286
+ // jQuery(".chaty-widget").addClass("hide-tooltip-arrow");
287
+ removeAnimation();
288
+ });
289
+ }
290
+ }
291
+
292
+ /* check for display rules */
293
+ var displayStatus = 0;
294
+ if(parseInt(chaty_settings.object_settings.display_conditions) == 1) {
295
+ var displayRules = chaty_settings.object_settings.display_rules;
296
+
297
+ if(displayRules.length > 0) {
298
+ var localDate = new Date();
299
+ localDate.setHours(localDate.getHours() + (chaty_settings.object_settings.gmt));
300
+ var utcHours = localDate.getUTCHours();
301
+ var utcMin = localDate.getUTCMinutes();
302
+ var utcDay = localDate.getUTCDay();
303
+ // console.log("utcHours: "+utcHours+" utcMin:"+utcMin+" utcDay:"+utcDay);
304
+ for(var rule = 0; rule < displayRules.length; rule++) {
305
+ // console.log("displayRules[rule].days: "+displayRules[rule].days);
306
+ var hourStatus = 0;
307
+ var minStatus = 0;
308
+ var checkForTime = 0;
309
+ if(displayRules[rule].days == -1) {
310
+ checkForTime = 1;
311
+ } else if(displayRules[rule].days >= 0 && displayRules[rule].days <= 6) {
312
+ if(displayRules[rule].days == utcDay) {
313
+ checkForTime = 1;
314
+ }
315
+ } else if(displayRules[rule].days == 7) {
316
+ if(utcDay >= 0 && utcDay <= 4) {
317
+ checkForTime = 1;
318
+ }
319
+ } else if(displayRules[rule].days == 8) {
320
+ if(utcDay >= 1 && utcDay <= 5) {
321
+ checkForTime = 1;
322
+ }
323
+ } else if(displayRules[rule].days == 9) {
324
+ if(utcDay == 5 || utcDay == 6) {
325
+ checkForTime = 1;
326
+ }
327
+ }
328
+ // console.log("end_hours: "+displayRules[rule].end_hours);
329
+ // console.log("end_min: "+displayRules[rule].end_min);
330
+ if(checkForTime == 1) {
331
+ if(utcHours > displayRules[rule].start_hours && utcHours < displayRules[rule].end_hours) {
332
+ hourStatus = 1;
333
+ } else if(utcHours == displayRules[rule].start_hours && utcHours < displayRules[rule].end_hours) {
334
+ if(utcMin >= displayRules[rule].start_min) {
335
+ hourStatus = 1;
336
+ }
337
+ } else if(utcHours > displayRules[rule].start_hours && utcHours == displayRules[rule].end_hours) {
338
+ if(utcMin <= displayRules[rule].end_min) {
339
+ hourStatus = 1;
340
+ }
341
+ } else if(utcHours == displayRules[rule].start_hours && utcHours == displayRules[rule].end_hours) {
342
+ if(utcMin >= displayRules[rule].start_min && utcMin <= displayRules[rule].end_min) {
343
+ hourStatus = 1;
344
+ }
345
+ }
346
+
347
+ if(hourStatus == 1) {
348
+ if(utcMin >= displayRules[rule].start_min && utcMin <= displayRules[rule].end_min) {
349
+ minStatus = 1;
350
+ }
351
+ }
352
+ }
353
+ // console.log("minStatus: "+minStatus);
354
+
355
+ if(hourStatus == 1 && checkForTime == 1) {
356
+ displayStatus = 1;
357
+ }
358
+ if(displayStatus == 1) {
359
+ rule = displayRules.length+1;
360
+ }
361
+ }
362
+ } else {
363
+ displayStatus = 1;
364
+ }
365
+ } else {
366
+ displayStatus = 1;
367
+ }
368
+
369
+ if(activeWidget == 1) {
370
+ if(i("display_cta") != "") {
371
+ jQuery(".chaty-widget-i-title").remove();
372
+ jQuery(".chaty-widget").addClass("hide-tooltip-arrow");
373
+ setInterval(function(){
374
+ set_cta_status();
375
+ }, 900);
376
+ }
377
+
378
+ jQuery(".chaty-main-widget").addClass("i-trigger-open").addClass("single-button");
379
+
380
+ jQuery(".chaty-widget-show .i-trigger-open svg").css("transform","rotate(0deg)");
381
+ }
382
+
383
+ jQuery("chaty-main-widget").mouseenter(function(){
384
+ set_cta_status();
385
+ });
386
+
387
+ // console.log("display_state: "+chaty_settings.object_settings.display_state);
388
+ // console.log("has_close_button: "+chaty_settings.object_settings.has_close_button);
389
+ // console.log("exit_intent: "+chaty_settings.object_settings.exit_intent);
390
+ // console.log("time_trigger: "+chaty_settings.object_settings.time_trigger);
391
+ // console.log("on_page_scroll: "+chaty_settings.object_settings.on_page_scroll);
392
+ if(displayStatus == 1) {
393
+ var widget_status = get_chaty_cookie("cta_widget_status");
394
+ if(widget_status == "yes") {
395
+ jQuery(".chaty-widget").removeClass("hide-widget");
396
+ show_chaty_widget();
397
+ } else {
398
+ /* set animation */
399
+ if (chaty_settings.object_settings.time_trigger == "no" && chaty_settings.object_settings.exit_intent == "no" && chaty_settings.object_settings.on_page_scroll == "no") {
400
+ jQuery(".chaty-widget").removeClass("hide-widget");
401
+ if(chaty_settings.object_settings.display_state == "open" && chaty_settings.object_settings.has_close_button == "no") {
402
+ chaty_settings.object_settings.has_close_button = "no";
403
+ } else {
404
+ chaty_settings.object_settings.display_state = "hover";
405
+ chaty_settings.object_settings.has_close_button = "yes";
406
+ }
407
+ show_chaty_widget();
408
+ } else {
409
+ jQuery(".chaty-widget").addClass("hide-widget");
410
+ if (chaty_settings.object_settings.time_trigger == "yes") {
411
+ setTimeout(function () {
412
+ if (!isWidgetEnabled) {
413
+ jQuery(".chaty-widget").removeClass("hide-widget");
414
+ show_chaty_widget();
415
+ }
416
+ }, parseInt(chaty_settings.object_settings.trigger_time) * 1000);
417
+ }
418
+ if (chaty_settings.object_settings.exit_intent == "yes") {
419
+ function addEvent(obj, evt, fn) {
420
+ if (obj.addEventListener) {
421
+ obj.addEventListener(evt, fn, false);
422
+ }
423
+ else if (obj.attachEvent) {
424
+ obj.attachEvent("on" + evt, fn);
425
+ }
426
+ }
427
+
428
+ addEvent(document, 'mouseout', function(evt) {
429
+ if (evt.toElement == null && evt.relatedTarget == null ) {
430
+ var widget_status = get_chaty_cookie("cta_exit_intent_shown");
431
+ if (widget_status == null) {
432
+ set_chaty_cookie("cta_exit_intent_shown","yes",1);
433
+ isWidgetEnabled = true;
434
+ jQuery(".chaty-widget").removeClass("hide-widget");
435
+ jQuery(".chaty-widget").addClass("chaty-animation-widget");
436
+ jQuery(".chaty-animation-widget").append("<div class='chaty-nav'></div>");
437
+ if(chaty_settings.object_settings.display_state == "open" && chaty_settings.object_settings.has_close_button == "no") {
438
+ chaty_settings.object_settings.has_close_button = "no";
439
+ } else {
440
+ chaty_settings.object_settings.display_state = "open";
441
+ chaty_settings.object_settings.has_close_button = "yes";
442
+ }
443
+ show_chaty_widget();
444
+ if (chaty_settings.object_settings.position == "left") {
445
+ jQuery(".chaty-widget").addClass("left-position");
446
+ } else if (chaty_settings.object_settings.position == "right") {
447
+ jQuery(".chaty-widget").addClass("right-position");
448
+ } else if (chaty_settings.object_settings.position == "custom") {
449
+ if (e.object_settings.pos_side == "left") {
450
+ jQuery(".chaty-widget").addClass("left-position");
451
+ } else {
452
+ jQuery(".chaty-widget").addClass("right-position");
453
+ }
454
+ }
455
+ removeAnimation();
456
+ setTimeout(function () {
457
+ jQuery(".chaty-animation-widget").addClass("active");
458
+ }, 100);
459
+ setTimeout(function () {
460
+ jQuery(".chaty-nav").remove();
461
+ }, 2500);
462
+ }
463
+ }
464
+ });
465
+ }
466
+ if (chaty_settings.object_settings.on_page_scroll == "yes") {
467
+ if (parseInt(chaty_settings.object_settings.page_scroll) > 0) {
468
+ jQuery(window).scroll(function () {
469
+ if (!isWidgetEnabled) {
470
+ var scrollHeight = jQuery(document).height() - jQuery(window).height();
471
+ var scrollPos = jQuery(window).scrollTop();
472
+ if (scrollPos != 0) {
473
+ if (((scrollPos / scrollHeight) * 100) >= parseInt(chaty_settings.object_settings.page_scroll)) {
474
+ jQuery(".chaty-widget").removeClass("hide-widget");
475
+ show_chaty_widget();
476
+ }
477
+ }
478
+ }
479
+ });
480
+ }
481
+ }
482
+ }
483
+ }
484
+ } else {
485
+ jQuery(".chaty-widget").addClass("hide-widget");
486
+ }
487
+ });
488
+ jQuery(".chaty-widget-i-title").each(function(){
489
+ if(jQuery(this).text() == "") {
490
+ jQuery(this).closest(".chaty-widget-i").addClass("hide-chaty-arrow");
491
+ jQuery(this).remove();
492
+ }
493
+ });
494
+ });
495
+
496
+ function set_cta_status() {
497
+ var n = new Date;
498
+ setInterval(function () {
499
+ n.setTime(n.getTime() + 1e3), document.cookie = "display_cta=none; expires=" + n.toGMTString() + "; path=/"
500
+ }, 500);
501
+ }
502
+
503
+ function set_chaty_cookie(name,value,days) {
504
+ var expires = "";
505
+ if (days) {
506
+ var date = new Date();
507
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
508
+ expires = "; expires=" + date.toUTCString();
509
+ }
510
+ document.cookie = name + "=" + (value || "") + expires + "; path=/";
511
+ }
512
+ function get_chaty_cookie(name) {
513
+ var nameEQ = name + "=";
514
+ var ca = document.cookie.split(';');
515
+ for(var i=0;i < ca.length;i++) {
516
+ var c = ca[i];
517
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
518
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
519
+ }
520
+ return null;
521
+ }
522
+
523
+ function show_chaty_widget() {
524
+ set_chaty_cookie("cta_widget_status", "yes", 1);
525
+ isWidgetEnabled = 1;
526
+ var activeWidget = 0;
527
+ if(jQuery("body").hasClass("chaty-in-desktop")) {
528
+ activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-desktop").length;
529
+ } else {
530
+ activeWidget = jQuery(".chaty-widget-is .chaty-widget-i.is-in-mobile").length;
531
+ }
532
+ var chatyAnimation = get_chaty_cookie("chaty-animation");
533
+ if(chatyAnimation != null) {
534
+ chaty_settings.object_settings.animation_class = "";
535
+ }
536
+
537
+ if(chaty_settings.object_settings.animation_class != "") {
538
+ jQuery(".i-trigger .chaty-widget-i svg").wrap(function() {
539
+ return "<div class='svg'></div>";
540
+ });
541
+ if(chaty_settings.object_settings.animation_class != "sheen") {
542
+ if (activeWidget > 1) {
543
+ jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
544
+ setTimeout(function () {
545
+ jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
546
+ }, 1000);
547
+ animationTimer = setInterval(function () {
548
+ jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
549
+ setTimeout(function () {
550
+ jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
551
+ }, 1000);
552
+ }, 5000);
553
+ } else if (activeWidget == 1) {
554
+ animationClass = ".chaty-main-widget svg, .chaty-main-widget img, .chaty-main-widget .facustom-icon";
555
+ // console.log("animationClass:" + animationClass);
556
+ jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
557
+ setTimeout(function () {
558
+ jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
559
+ }, 1000);
560
+ animationTimer = setInterval(function () {
561
+ jQuery(animationClass).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
562
+ setTimeout(function () {
563
+ jQuery(animationClass).addClass("chaty-animation-" + chaty_settings.object_settings.animation_class).addClass("start-now");
564
+ }, 1000);
565
+ }, 5000);
566
+ }
567
+ } else {
568
+ animationClass = ".i-trigger .chaty-widget-i .wrap-svg";
569
+ if(!jQuery(".i-trigger .chaty-widget-i .wrap-svg").length) {
570
+ jQuery(".i-trigger .chaty-widget-i svg").wrap(function() {
571
+ return "<div class='wrap-svg'></div>";
572
+ });
573
+ }
574
+ jQuery(animationClass).removeClass("chaty-animation-sheen").removeClass("start-now");
575
+ setTimeout(function () {
576
+ jQuery(animationClass).addClass("chaty-animation-sheen").addClass("start-now");
577
+ }, 10);
578
+ animationTimer = setInterval(function () {
579
+ jQuery(animationClass).removeClass("chaty-animation-sheen").removeClass("start-now");
580
+ setTimeout(function () {
581
+ jQuery(animationClass).addClass("chaty-animation-sheen").addClass("start-now");
582
+ }, 10);
583
+ }, 5000);
584
+ }
585
+ }
586
+
587
+ if(chaty_settings.object_settings.display_state == "open") {
588
+ if(chaty_settings.object_settings.has_close_button == "no") {
589
+ if(activeWidget > 1) {
590
+ removeAnimation();
591
+ jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos");
592
+ jQuery(".chaty-widget").find(".i-trigger-open").trigger("click");
593
+ jQuery(".chaty-widget-is").addClass("has-no-close-btn");
594
+ jQuery(".i-trigger").remove();
595
+ }
596
+ } else {
597
+ if(activeWidget > 1) {
598
+ removeAnimation();
599
+ jQuery(".chaty-widget").find(".i-trigger-open").removeClass("active_clos");
600
+ jQuery(".chaty-widget").find(".i-trigger-open").trigger("click");
601
+ }
602
+ }
603
+ }
604
+ }
605
+
606
+ function removeAnimation() {
607
+ if(animationTimer) {
608
+ clearInterval(animationTimer);
609
+ animationTimer = 0;
610
+ }
611
+ set_chaty_cookie("chaty-animation","stop",1);
612
+ jQuery(".chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("chaty-animation-" + chaty_settings.object_settings.animation_class).removeClass("start-now");
613
+ jQuery(".start-now").removeClass("start-now");
614
+ chaty_settings.object_settings.animation_class = "";
615
+ }
616
+ }(jQuery)
617
+ }, 12: function (t, e) {
618
+ }
619
+ });
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: galdub, tomeraharon, premio
3
  Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, messenger chat icon, contact button, click to call
4
  Requires at least: 3.1
5
  Tested up to: 5.3
6
- Stable tag: 2.4.6
7
  Plugin URI: https://premio.io/downloads/chaty/
8
 
9
  Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons
@@ -196,6 +196,9 @@ Yes! You can even decide what chat buttons will show up on each device (desktop/
196
 
197
  == Changelog ==
198
 
 
 
 
199
  = 2.4.6 =
200
  Added an option to change the Hide text
201
 
3
  Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, messenger chat icon, contact button, click to call
4
  Requires at least: 3.1
5
  Tested up to: 5.3
6
+ Stable tag: 2.4.7
7
  Plugin URI: https://premio.io/downloads/chaty/
8
 
9
  Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons
196
 
197
  == Changelog ==
198
 
199
+ = 2.4.7 =
200
+ Infrastructure improvements
201
+
202
  = 2.4.6 =
203
  Added an option to change the Hide text
204
 
views/admin.php DELETED
@@ -1,173 +0,0 @@
1
- <?php
2
- $is_pro = $this->is_pro();
3
- if (!$is_pro) {
4
- if (get_option('cht_position') == 'custom') {
5
- update_option('cht_position', 'right');
6
- }
7
- $social = get_option('cht_numb_slug');
8
- $social = explode(",", $social);
9
- $social = array_splice($social, 0, 3);
10
- $social = implode(',', $social);
11
- update_option('cht_numb_slug', $social);
12
- if (get_option('cht_custom_color') != '') {
13
- update_option('cht_custom_color', '');
14
- update_option('cht_color', '#A886CD');
15
- }
16
- }
17
- $cht_license_key = get_option('cht_license_key');
18
- $pro_class = (!$is_pro && $cht_license_key !== "")?"none_pro":"";
19
- ?>
20
- <h2></h2>
21
- <div class="container <?php esc_attr_e($pro_class) ?>" dir="ltr">
22
- <?php require_once 'parts/custom-styles.php'; ?>
23
- <header class="header">
24
- <img src="<?php echo esc_url(plugins_url('../assets/images/logo.svg', __FILE__)); ?>" alt="Chaty" class="logo">
25
- <?php settings_errors(); ?>
26
- <div class="ml-auto">
27
- <?php if (!$is_pro && get_option('cht_license_key') == ''): ?>
28
- <button class="btn-white easy-modal-open" href="#token-modal">
29
- <?php esc_attr_e('Enter Token', CHT_OPT); ?>
30
- </button>
31
- <?php endif ?>
32
-
33
- <?php require_once 'modals/token.php'; ?>
34
-
35
- <?php if ($this->data_check() && $is_pro): ?>
36
-
37
- <a target="_blank" class="btn-red" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
38
- <?php esc_attr_e('Renew now', CHT_OPT); ?>
39
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
40
- <path d="M3.0746 9.2C2.5746 7 4.2746 5 6.4746 5H6.9746V6.5C6.9746 6.7 7.0746 6.9 7.2746 7C7.4746 7 7.6746 7 7.7746 6.9L10.7746 3.9C10.9746 3.7 10.9746 3.4 10.7746 3.2L7.7746 0.2C7.6746 0 7.4746 0 7.2746 0C7.0746 0.1 6.9746 0.3 6.9746 0.5V2H6.4746C2.5746 2 -0.525402 5.4 0.0745975 9.4C0.274598 10.9 1.0746 12.3 2.1746 13.3C2.3746 13.5 2.6746 13.5 2.8746 13.3L4.2746 11.9C4.4746 11.7 4.4746 11.4 4.2746 11.2C3.5746 10.6 3.1746 10 3.0746 9.2Z" fill="white"/>
41
- <path d="M8.95 0.15C8.75 -0.0500001 8.45 -0.0500001 8.25 0.15L6.85 1.55C6.65 1.75 6.65 2.05 6.85 2.25C7.35 2.75 7.75 3.35 7.95 4.15C8.45 6.35 6.75 8.35 4.55 8.35H4.05V6.85C4.05 6.65 3.95 6.45 3.75 6.35C3.55 6.25 3.35 6.35 3.15 6.55L0.15 9.55C-0.0500001 9.75 -0.0500001 10.05 0.15 10.25L3.15 13.25C3.35 13.35 3.55 13.35 3.75 13.35C3.95 13.25 4.05 13.05 4.05 12.85V11.35H4.55C8.45 11.35 11.55 7.95 10.95 3.95C10.75 2.45 10.05 1.15 8.95 0.15Z" transform="translate(4.92456 2.64999)" fill="white"/>
42
- </svg>
43
- </a>
44
- <?php if ($is_pro) { ?>
45
- <?php $date = $this->data_activ(); ?>
46
- <p class="text_update" style="color:#fff; left: 0px;"><?php esc_attr_e('Your Pro plan expires on', CHT_OPT); ?> <?php esc_attr_e(date('F jS, Y', strtotime($date))); ?></p>
47
- <?php } ?>
48
- <?php elseif (!$this->data_check() && !$is_pro): ?>
49
- <a target="_blank" class="btn-red" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
50
- <?php esc_attr_e('Upgrade Now', CHT_OPT); ?>
51
- <svg width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg">
52
- <path d="M17.4674 7.42523L11.8646 0.128021C11.7548 0.128021 11.6449 0 11.4252 0C11.3154 0 11.0956 0 10.9858 0.128021L9.44777 1.92032C9.22806 2.17636 9.22806 2.56042 9.33791 2.81647L11.7548 6.017H0.549289C0.219716 6.017 0 6.27304 0 6.6571V9.21753C0 9.60159 0.219716 9.85763 0.549289 9.85763H11.8646L9.44777 13.0582C9.22806 13.3142 9.22806 13.6983 9.44777 13.9543L11.0956 15.6186C11.2055 15.7466 11.3154 15.7466 11.4252 15.7466C11.5351 15.7466 11.7548 15.6186 11.8646 15.4906L17.4674 8.19336C17.5772 8.06534 17.5772 7.68127 17.4674 7.42523Z" transform="translate(0.701416 18.3653) rotate(-90)" fill="white"/>
53
- </svg>
54
- </a>
55
- <?php endif ?>
56
- </div>
57
- </header>
58
-
59
- <main class="main">
60
- <form id="cht-form" action="options.php" method="POST" enctype="multipart/form-data" data-auto="false">
61
- <?php settings_fields($this->plugin_slug); ?>
62
- <?php require_once 'parts/section1.php'; ?>
63
- <?php require_once 'parts/section2.php'; ?>
64
- <?php require_once 'parts/trigger-and-target.php'; ?>
65
- <?php require_once 'parts/section3.php'; ?>
66
- <input type="text" name="cht_license_key" value="<?php esc_attr_e($this->token) ?>" hidden />
67
- <?php submit_button(null, null, null, false); ?>
68
- </form>
69
- </main>
70
-
71
- <?php require_once 'parts/help.php'; ?>
72
- </div>
73
-
74
- <script>
75
- jQuery(document).ready(function(){
76
- var inputError = 0;
77
- jQuery("#cht-form").submit(function () {
78
- errorCount = 0;
79
- phoneNumberReg = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/;
80
- if (jQuery("#cht-form #Whatsapp").length && jQuery("#cht-form #Whatsapp").val() != "") {
81
- InputVal = jQuery.trim(jQuery("#cht-form #Whatsapp").val());
82
- chatyError = check_for_number_chaty(InputVal, "Whatsapp");
83
- if(chatyError) {
84
- if(!confirm("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
85
- jQuery("#cht-form #Whatsapp").focus();
86
- return false;
87
- }
88
- }
89
- }
90
- if (jQuery("#cht-form #Phone").length && jQuery("#cht-form #Phone").val() != "") {
91
- InputVal = jQuery.trim(jQuery("#cht-form #Phone").val());
92
- chatyError = check_for_number_chaty(InputVal, "Phone");
93
- if(chatyError) {
94
- if(!confirm("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
95
- jQuery("#cht-form #Phone").focus();
96
- return false;
97
- }
98
- }
99
- }
100
- if (jQuery("#cht-form #Facebook_Messenger").length && jQuery("#cht-form #Facebook_Messenger").val() != "") {
101
- faceBookMeReg = /(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
102
- faceBookReg = /(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/;
103
- InputVal = jQuery.trim(jQuery("#Facebook_Messenger").val());
104
- jQuery("#cht-form #Facebook_Messenger").val(InputVal);
105
- if (!faceBookReg.test(InputVal) && !faceBookMeReg.test(InputVal)) {
106
- alert("Please make sure your Facebook page's URL looks like, \nhttps://m.me/YOURPAGE");
107
- jQuery("#cht-form #Facebook_Messenger").focus();
108
- return false;
109
- }
110
- }
111
- if (jQuery("#cht-form #SMS").length && jQuery("#cht-form #SMS").val() != "") {
112
- InputVal = jQuery.trim(jQuery("#cht-form #SMS").val());
113
- chatyError = check_for_number_chaty(InputVal, "SMS");
114
- if(chatyError) {
115
- if(!confirm("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
116
- jQuery("#cht-form #SMS").focus();
117
- return false;
118
- }
119
- }
120
- }
121
- if (jQuery("#cht-form #Viber").length && jQuery("#cht-form #Viber").val() != "") {
122
- InputVal = jQuery.trim(jQuery("#cht-form #Viber").val());
123
- chatyError = check_for_number_chaty(InputVal, "Viber");
124
- if(chatyError) {
125
- if(!confirm("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?")) {
126
- jQuery("#cht-form #Viber").focus();
127
- return false;
128
- }
129
- }
130
- }
131
-
132
- inputError = 0;
133
- if(jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
134
- jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
135
- if(jQuery.trim(jQuery(this).val()) == "") {
136
- inputError++;
137
- }
138
- });
139
- if(inputError == jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
140
- if(confirm("You need to fill out at least one channel details for Chaty to show up on your website. Click cancel to keep editing.")) {
141
- return true;
142
- } else {
143
- jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
144
- if(jQuery.trim(jQuery(this).val()) == "") {
145
- inputError = 1;
146
- }
147
- });
148
- jQuery("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").addClass("border-red");
149
- jQuery("#channels-selected-list > li:not(#chaty-social-close) .channels__input:first").focus();
150
- return false;
151
- }
152
- }
153
- }
154
- });
155
- });
156
-
157
- function check_for_number_chaty(phoneNumber, validationFor) {
158
- if (phoneNumber != "") {
159
- if (phoneNumber[0] == "+") {
160
- phoneNumber = phoneNumber.substr(1, phoneNumber.length)
161
- }
162
- if (validationFor == "Phone") {
163
- if (phoneNumber[0] == "*") {
164
- phoneNumber = phoneNumber.substr(1, phoneNumber.length)
165
- }
166
- }
167
- if (isNaN(phoneNumber)) {
168
- return true;
169
- }
170
- }
171
- return false;
172
- }
173
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/admin/admin.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_pro = $this->is_pro();
3
+ if (!$is_pro) {
4
+ if (get_option('cht_position') == 'custom') {
5
+ update_option('cht_position', 'right');
6
+ }
7
+ $social = get_option('cht_numb_slug');
8
+ $social = explode(",", $social);
9
+ $social = array_splice($social, 0, 3);
10
+ $social = implode(',', $social);
11
+ update_option('cht_numb_slug', $social);
12
+ if (get_option('cht_custom_color') != '') {
13
+ update_option('cht_custom_color', '');
14
+ update_option('cht_color', '#A886CD');
15
+ }
16
+ }
17
+ $cht_license_key = get_option('cht_license_key');
18
+ $pro_class = (!$is_pro && $cht_license_key !== "")?"none_pro":"";
19
+ ?>
20
+ <h2></h2>
21
+ <div class="container <?php esc_attr_e($pro_class) ?>" dir="ltr">
22
+ <header class="header">
23
+ <img src="<?php echo esc_url(CHT_PLUGIN_URL.'admin/assets/images/logo.svg'); ?>" alt="Chaty" class="logo">
24
+ <?php settings_errors(); ?>
25
+ <div class="ml-auto">
26
+ <a target="_blank" class="btn-red" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
27
+ <?php esc_attr_e('Upgrade Now', CHT_OPT); ?>
28
+ <svg width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg">
29
+ <path d="M17.4674 7.42523L11.8646 0.128021C11.7548 0.128021 11.6449 0 11.4252 0C11.3154 0 11.0956 0 10.9858 0.128021L9.44777 1.92032C9.22806 2.17636 9.22806 2.56042 9.33791 2.81647L11.7548 6.017H0.549289C0.219716 6.017 0 6.27304 0 6.6571V9.21753C0 9.60159 0.219716 9.85763 0.549289 9.85763H11.8646L9.44777 13.0582C9.22806 13.3142 9.22806 13.6983 9.44777 13.9543L11.0956 15.6186C11.2055 15.7466 11.3154 15.7466 11.4252 15.7466C11.5351 15.7466 11.7548 15.6186 11.8646 15.4906L17.4674 8.19336C17.5772 8.06534 17.5772 7.68127 17.4674 7.42523Z" transform="translate(0.701416 18.3653) rotate(-90)" fill="white"/>
30
+ </svg>
31
+ </a>
32
+ </div>
33
+ </header>
34
+
35
+ <main class="main">
36
+ <form id="cht-form" action="options.php" method="POST" enctype="multipart/form-data">
37
+ <?php
38
+ settings_fields($this->plugin_slug);
39
+
40
+ /* Social channel list section */
41
+ require_once 'channels-section.php';
42
+
43
+ /* Customize widget section */
44
+ require_once 'customize-widget-section.php';
45
+
46
+ /* Customize widget section */
47
+ require_once 'trigger-and-target.php';
48
+
49
+ /* Widget launch section */
50
+ require_once 'launch-section.php';
51
+
52
+ /* form submit button */
53
+ submit_button(null, null, null, false);
54
+ ?>
55
+ </form>
56
+ </main>
57
+
58
+ <?php require_once 'help.php'; ?>
59
+ </div>
views/admin/channels-section.php ADDED
@@ -0,0 +1,658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="preview-section-chaty wrap">
2
+ <svg class="read-only" aria-hidden="true" width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <defs>
4
+ <linearGradient id="linear-gradient" x1="0.892" y1="0.192" x2="0.128" y2="0.85" gradientUnits="objectBoundingBox">
5
+ <stop offset="0" stop-color="#4a64d5"></stop>
6
+ <stop offset="0.322" stop-color="#9737bd"></stop>
7
+ <stop offset="0.636" stop-color="#f15540"></stop>
8
+ <stop offset="1" stop-color="#fecc69"></stop>
9
+ </linearGradient>
10
+ </defs>
11
+ <circle class="color-element" cx="19.5" cy="19.5" r="19.5" fill="url(#linear-gradient)"></circle>
12
+ <path id="Path_1923" data-name="Path 1923" d="M13.177,0H5.022A5.028,5.028,0,0,0,0,5.022v8.155A5.028,5.028,0,0,0,5.022,18.2h8.155A5.028,5.028,0,0,0,18.2,13.177V5.022A5.028,5.028,0,0,0,13.177,0Zm3.408,13.177a3.412,3.412,0,0,1-3.408,3.408H5.022a3.411,3.411,0,0,1-3.408-3.408V5.022A3.412,3.412,0,0,1,5.022,1.615h8.155a3.412,3.412,0,0,1,3.408,3.408v8.155Z" transform="translate(10 10.4)" fill="#fff"></path>
13
+ <path id="Path_1924" data-name="Path 1924" d="M45.658,40.97a4.689,4.689,0,1,0,4.69,4.69A4.695,4.695,0,0,0,45.658,40.97Zm0,7.764a3.075,3.075,0,1,1,3.075-3.075A3.078,3.078,0,0,1,45.658,48.734Z" transform="translate(-26.558 -26.159)" fill="#fff"></path>
14
+ <path id="Path_1925" data-name="Path 1925" d="M120.105,28.251a1.183,1.183,0,1,0,.838.347A1.189,1.189,0,0,0,120.105,28.251Z" transform="translate(-96.119 -14.809)" fill="#fff"></path>
15
+ </svg>
16
+ <div class="preview" id="admin-preview">
17
+ <div class="h2"><span class="header-tooltip"><span class="header-tooltip-text">Please make all your live tests in <a href="https://www.computerworld.com/article/3356840/how-to-go-incognito-in-chrome-firefox-safari-and-edge.html" target="_blank">incognito mode</a>. Some of the features like call to action, attention effect, and trigger will appear for your website visitors just once until they engage with the chat widget, so to emulate it you'll need to use incognito mode</span> <span class="dashicons dashicons-editor-help"></span></span><?php esc_attr_e('Preview', CHT_OPT); ?>:</div>
18
+
19
+ <div class="page">
20
+ <div class="page-header">
21
+ <div class="circle"></div>
22
+ <div class="circle"></div>
23
+ <div class="circle"></div>
24
+ <svg width="33" height="38" viewBox="0 0 33 38" fill="none" xmlns="http://www.w3.org/2000/svg">
25
+ <g filter="url(#filter0_d)">
26
+ <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 13.0053) scale(1 -1)" fill="#828282"/>
27
+ </g>
28
+ <g filter="url(#filter1_d)">
29
+ <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 15.6891) scale(1 -1)" fill="#828282"/>
30
+ </g>
31
+ <g filter="url(#filter2_d)">
32
+ <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 18.373) scale(1 -1)" fill="#828282"/>
33
+ </g>
34
+ <defs>
35
+ <filter id="filter0_d" x="0.64917" y="0.514328" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
36
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
37
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
38
+ <feOffset dy="4"/>
39
+ <feGaussianBlur stdDeviation="7.5"/>
40
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
41
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
42
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
43
+ </filter>
44
+ <filter id="filter1_d" x="0.64917" y="3.1981" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
45
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
46
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
47
+ <feOffset dy="4"/>
48
+ <feGaussianBlur stdDeviation="7.5"/>
49
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
50
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
51
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
52
+ </filter>
53
+ <filter id="filter2_d" x="0.64917" y="5.88202" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
54
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
55
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
56
+ <feOffset dy="4"/>
57
+ <feGaussianBlur stdDeviation="7.5"/>
58
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
59
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
60
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
61
+ </filter>
62
+ </defs>
63
+ </svg>
64
+ </div>
65
+
66
+
67
+ <?php $position = $this->get_position_style(); ?>
68
+ <div class="page-body">
69
+ <?php
70
+ $cht_position = get_option("cht_position");
71
+ $cht_position = ($cht_position == "custom")?"positionSide":"cht_position";
72
+ $cht_position = get_option($cht_position);
73
+ $cht_cta = get_option("cht_cta");
74
+ $cht_cta = ($cht_cta)?$cht_cta:"Contact Us";
75
+ $widget_icon = get_option('widget_icon');
76
+ ?>
77
+ <div class="chaty-widget chaty-widget-icons-<?php esc_attr_e($cht_position) ?>" style="<?php esc_attr_e($position); ?>">
78
+ <div class="icon icon-xs active tooltip-show tooltip" data-title="<?php echo esc_attr($cht_cta) ?>" data-label="<?php echo esc_attr($cht_cta) ?>">
79
+ <div class="chaty-channels"></div>
80
+ <i id="iconWidget">
81
+ <?php $bg_color = $this->get_current_color(); ?>
82
+ <?php $fill = ($bg_color) ? $bg_color : '#A886CD'; ?>
83
+ <?php if ($widget_icon == 'chat-base'): ?>
84
+ <svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">
85
+ <style type="text/css">
86
+ .st1 { fill: #FFFFFF; }
87
+ .st0 { fill: #808080; }
88
+ </style>
89
+ <g><circle cx="-469" cy="534.7" r="27" fill="<?php esc_attr_e($fill) ?>"/></g>
90
+ <path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>
91
+ <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/>
92
+ <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/>
93
+ </svg>
94
+ <?php endif; ?>
95
+ <?php if ($widget_icon == 'chat-smile'): ?>
96
+ <svg version="1.1" id="smile" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.8 507.1 54 54" style="enable-background:new -496.8 507.1 54 54;" xml:space="preserve" >
97
+ <style type="text/css">
98
+ .st1 { fill: #FFFFFF; }
99
+ .st2 { fill: none; stroke: #808080; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
100
+ </style>
101
+ <g>
102
+ <circle cx="-469.8" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
103
+ </g>
104
+ <path class="st1" d="M-459.5,523.5H-482c-2.1,0-3.7,1.7-3.7,3.7v13.1c0,2.1,1.7,3.7,3.7,3.7h19.3l5.4,5.4c0.2,0.2,0.4,0.2,0.7,0.2 c0.2,0,0.2,0,0.4,0c0.4-0.2,0.6-0.6,0.6-0.9v-21.5C-455.8,525.2-457.5,523.5-459.5,523.5z"/>
105
+ <path class="st2" d="M-476.5,537.3c2.5,1.1,8.5,2.1,13-2.7"/>
106
+ <path class="st2" d="M-460.8,534.5c-0.1-1.2-0.8-3.4-3.3-2.8"/>
107
+ </svg>
108
+ <?php endif; ?>
109
+ <?php if ($widget_icon == 'chat-bubble'): ?>
110
+ <?php $fill = ($bg_color) ? $bg_color : '#A886CD'; ?>
111
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve">
112
+ <style type="text/css">.st1 {
113
+ fill: #FFFFFF;
114
+ }</style>
115
+ <g>
116
+ <circle cx="-469.9" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
117
+ </g>
118
+ <path class="st1" d="M-472.6,522.1h5.3c3,0,6,1.2,8.1,3.4c2.1,2.1,3.4,5.1,3.4,8.1c0,6-4.6,11-10.6,11.5v4.4c0,0.4-0.2,0.7-0.5,0.9 c-0.2,0-0.2,0-0.4,0c-0.2,0-0.5-0.2-0.7-0.4l-4.6-5c-3,0-6-1.2-8.1-3.4s-3.4-5.1-3.4-8.1C-484.1,527.2-478.9,522.1-472.6,522.1z M-462.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-464.6,534.6-463.9,535.3-462.9,535.3z M-469.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-471.7,534.6-471,535.3-469.9,535.3z M-477,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-478.8,534.6-478.1,535.3-477,535.3z"/>
119
+ </svg>
120
+ <?php endif; ?>
121
+ <?php if ($widget_icon == 'chat-db'): ?>
122
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.1 54 54" style="enable-background:new -496 507.1 54 54;" xml:space="preserve">
123
+ <style type="text/css">.st1 {
124
+ fill: #FFFFFF;
125
+ }</style>
126
+ <g>
127
+ <circle cx="-469" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
128
+ </g>
129
+ <path class="st1" d="M-464.6,527.7h-15.6c-1.9,0-3.5,1.6-3.5,3.5v10.4c0,1.9,1.6,3.5,3.5,3.5h12.6l5,5c0.2,0.2,0.3,0.2,0.7,0.2 c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18.2C-461.1,529.3-462.7,527.7-464.6,527.7z"/>
130
+ <path class="st1" d="M-459.4,522.5H-475c-1.9,0-3.5,1.6-3.5,3.5h13.9c2.9,0,5.2,2.3,5.2,5.2v11.6l1.9,1.9c0.2,0.2,0.3,0.2,0.7,0.2 c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18C-455.9,524.1-457.5,522.5-459.4,522.5z"/>
131
+ </svg>
132
+ <?php endif; ?>
133
+ <?php if ($widget_icon == 'chat-image'): ?>
134
+ <img src="<?php echo esc_url($this->getCustomWidgetImg()); ?>"/>
135
+ <?php else: ?>
136
+ <style type="text/css">.st1 {fill: #FFFFFF;}.st0{fill: #a886cd;}</style>
137
+ <g><circle cx="-469" cy="534.7" r="27" fill="<?php esc_attr_e($fill) ?>"/></g>
138
+ <path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>
139
+ <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/>
140
+ <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/>
141
+ </svg>
142
+ <?php endif; ?>
143
+ </i>
144
+ <i class="chaty-close-icon">
145
+ <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
146
+ </i>
147
+ <?php
148
+ $display_status = get_option("cht_cta");
149
+ $display_status = ($display_status)?"block":"none";
150
+ $cta = nl2br(get_option('cht_cta'));
151
+ $cta = str_replace(array("\r", "\n"), "", $cta);
152
+ ?>
153
+ <span class="tooltiptext" style='display:<?php esc_attr_e($display_status) ?>'><span><?php esc_attr_e($cta); ?></span></span>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ <div class="switch-preview">
159
+ <input data-gramm_editor="false" type="radio" id="previewDesktop" name="switchPreview" class="js-switch-preview switch-preview__input" checked="checked">
160
+ <label for="previewDesktop" class="switch-preview__label switch-preview__desktop">
161
+ <?php esc_attr_e('Desktop', CHT_OPT); ?>
162
+ </label>
163
+ <input data-gramm_editor="false" type="radio" id="previewMobile" name="switchPreview" class="js-switch-preview switch-preview__input">
164
+ <label for="previewMobile" class="switch-preview__label switch-preview__mobile">
165
+ <?php esc_attr_e('Mobile', CHT_OPT); ?>
166
+ </label>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ <?php $pro_id = $this->is_pro()?"pro":""; ?>
171
+ <section class="section one chaty-setting-form" id="<?php esc_attr_e($pro_id) ?>" xmlns="http://www.w3.org/1999/html">
172
+ <h1 class="section-title">
173
+ <strong><?php esc_attr_e('Step', CHT_OPT); ?> 1:</strong> <?php esc_attr_e('Choose your channels', CHT_OPT); ?>
174
+ </h1>
175
+ <?php
176
+ $social_app = get_option('cht_numb_slug');
177
+ $social_app = trim($social_app, ",");
178
+ $social_app = explode(",", $social_app);
179
+ $social_app = array_unique($social_app);
180
+ ?>
181
+ <input type="hidden" id="default_image" value="<?php echo esc_url($imageUrl) ?>" />
182
+ <div class="channels-icons">
183
+ <?php if ($this->socials) :
184
+ foreach ($this->socials as $key => $social) :
185
+ $value = get_option('cht_social'.'_' . $social['slug']);
186
+ $active_class = '';
187
+ foreach ($social_app as $key_soc):
188
+ if ($key_soc == $social['slug']) {
189
+ $active_class = 'active';
190
+ }
191
+ endforeach; ?>
192
+ <div class="icon icon-sm <?php echo esc_attr($active_class) ?>" data-social="<?php echo esc_attr($social['slug']); ?>" data-title="<?php esc_attr_e($social['title']); ?>" data-label="<?php esc_attr_e($social['title']); ?>">
193
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
194
+ <?php echo $social['svg']; ?>
195
+ </svg>
196
+ </div>
197
+ <?php endforeach; ?>
198
+ <?php endif; ?>
199
+ </div>
200
+ <?php if (!$this->is_pro()) : ?>
201
+ <div class="popover" style="">
202
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
203
+ <?php esc_attr_e('Get unlimited channels in the Pro plan', CHT_OPT); ?>
204
+ <strong><?php esc_attr_e('Upgrade Now', CHT_OPT); ?></strong>
205
+ </a>
206
+ </div>
207
+ <?php endif; ?>
208
+ <input type="hidden" class="add_slug" name="cht_numb_slug" placeholder="test" value="<?php esc_attr_e(get_option('cht_numb_slug')); ?>" id="cht_numb_slug" >
209
+
210
+ <div class="channels-selected" id="channels-selected-list">
211
+ <ul id="channels-selected-list" class="channels-selected-list channels-selected">
212
+ <?php if ($this->socials) :
213
+ $social = get_option('cht_numb_slug');
214
+ $social = explode(",", $social);
215
+ $social = array_unique($social);
216
+ foreach ($social as $key_soc):
217
+ foreach ($this->socials as $key => $social) :
218
+ if ($social['slug'] != $key_soc) { // compare social media slug
219
+ continue;
220
+ }
221
+ $value = get_option('cht_social_' . $social['slug']); // get setting for media if already saved
222
+ $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png";
223
+ if (empty($value)) { // Initialize default values if not found
224
+ $value = [
225
+ 'value' => '',
226
+ 'is_mobile' => 'checked',
227
+ 'is_desktop' => 'checked',
228
+ 'image_id' => '',
229
+ 'title' => $social['title'],
230
+ 'bg_color' => "",
231
+ ];
232
+ }
233
+ if(!isset($value['bg_color']) || empty($value['bg_color'])) {
234
+ $value['bg_color'] = $social['color']; // Initialize background color value if not exists. 2.1.0 change
235
+ }
236
+ if(!isset($value['image_id'])) {
237
+ $value['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change
238
+ }
239
+ if(!isset($value['title']) || $value['title'] == "") {
240
+ $value['title'] = $social['title']; // Initialize title if not exists. 2.1.0 change
241
+ }
242
+ if(!isset($value['fa_icon'])) {
243
+ $value['fa_icon'] = ""; // Initialize title if not exists. 2.1.0 change
244
+ }
245
+ $imageId = $value['image_id'];
246
+ $imageUrl = "";
247
+ $status = 0;
248
+ if(!empty($imageId)) {
249
+ $imageUrl = wp_get_attachment_image_src($imageId, "full")[0]; // get custom image URL if exists
250
+ $status = 1;
251
+ }
252
+ if($imageUrl == "") {
253
+ $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; // Initialize with default image if custom image is not exists
254
+ $status = 0;
255
+ $imageId = "";
256
+ }
257
+ $color = "";
258
+ if(!empty($value['bg_color'])) {
259
+ $color = "background-color: ".$value['bg_color']; // set background color of icon it it is exists
260
+ }
261
+ if($social['slug'] == "Whatsapp"){
262
+ $val = $value['value'];
263
+ $val = str_replace("+","", $val);
264
+ $value['value'] = $val;
265
+ } else if($social['slug'] == "Facebook_Messenger"){
266
+ $val = $value['value'];
267
+ $val = str_replace("facebook.com","m.me", $val); // Replace facebook.com with m.me version 2.0.1 change
268
+ $val = str_replace("www.","", $val); // Replace www. with blank version 2.0.1 change
269
+ $value['value'] = $val;
270
+
271
+ $val = trim($val, "/");
272
+ $val_array = explode("/", $val);
273
+ $total = count($val_array)-1;
274
+ $last_value = $val_array[$total];
275
+ $last_value = explode("-", $last_value);
276
+ $total_text = count($last_value)-1;
277
+ $total_text = $last_value[$total_text];
278
+
279
+ if(is_numeric($total_text)) {
280
+ $val_array[$total] = $total_text;
281
+ $value['value'] = implode("/", $val_array);
282
+ }
283
+ }
284
+ $value['value'] = esc_attr__(wp_unslash($value['value']));
285
+ $value['title'] = esc_attr__(wp_unslash($value['title']));
286
+ ?>
287
+ <!-- Social media setting box: start -->
288
+ <li data-id="<?php echo esc_attr($social['slug']) ?>" id="chaty-social-<?php echo esc_attr($social['slug']) ?>">
289
+ <div class="channels-selected__item <?php esc_attr_e(($status)?"img-active":"") ?> <?php esc_attr_e(($this->is_pro()) ? 'pro' : 'free'); ?> 1 available">
290
+ <div class="chaty-default-settings">
291
+ <div class="move-icon">
292
+ <img src="<?php echo esc_url(plugin_dir_url("")."/chaty/admin/assets/images/move-icon.png") ?>">
293
+ </div>
294
+ <div class="icon icon-md active" data-title="<?php esc_attr_e($value['title']); ?>" data-label="<?php esc_attr_e($value['title']); ?>">
295
+ <span style="" class="custom-chaty-image custom-image-<?php echo esc_attr($social['slug']) ?>" id="image_data_<?php echo esc_attr($social['slug']) ?>">
296
+ <img src="<?php echo esc_url($imageUrl) ?>" />
297
+ <span onclick="remove_chaty_image('<?php echo esc_attr($social['slug']) ?>')" class="remove-icon-img"></span>
298
+ </span>
299
+ <span class="default-chaty-icon <?php echo (isset($value['fa_icon'])&&!empty($value['fa_icon']))?"has-fa-icon":"" ?> custom-icon-<?php echo esc_attr($social['slug']) ?> default_image_<?php echo esc_attr($social['slug']) ?>" >
300
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
301
+ <?php echo $social['svg']; ?>
302
+ </svg>
303
+ <span class="facustom-icon" style="background-color: <?php echo esc_attr($value['bg_color']) ?>"><i class="<?php echo esc_attr($value['fa_icon']) ?>"></i></span>
304
+ </span>
305
+ </div>
306
+
307
+ <!-- Social Media input -->
308
+ <div class="channels__input-box">
309
+ <input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e(wp_unslash($value['value'])); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" />
310
+ </div>
311
+ <div>
312
+ <?php
313
+ $slug = esc_attr__($this->del_space($social['slug']));
314
+ $slug = str_replace(' ', '_', $slug);
315
+ $is_desktop = isset($value['is_desktop']) ? $value['is_desktop'] : '';
316
+ $is_mobile = isset($value['is_mobile']) ? $value['is_mobile'] : '';
317
+ ?>
318
+ <!-- setting for desktop -->
319
+ <label class="channels__view" for="<?php echo esc_attr($slug); ?>Desktop">
320
+ <input type="checkbox" id="<?php echo esc_attr($slug); ?>Desktop" class="channels__view-check js-chanel-icon js-chanel-desktop" data-type="<?php echo str_replace(' ', '_', strtolower(esc_attr__($this->del_space($social['slug'])))); ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_desktop]" value="checked" data-gramm_editor="false" <?php esc_attr_e($is_desktop) ?> />
321
+ <span class="channels__view-txt">Desktop</label>
322
+ </label>
323
+
324
+ <!-- setting for mobile -->
325
+ <label class="channels__view" for="<?php echo esc_attr($slug); ?>Mobile">
326
+ <input type="checkbox" id="<?php echo esc_attr($slug); ?>Mobile" class="channels__view-check js-chanel-icon js-chanel-mobile" data-type="<?php echo str_replace(' ', '_', strtolower(esc_attr__($this->del_space($social['slug'])))); ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_mobile]" value="checked" data-gramm_editor="false" <?php esc_attr_e($is_mobile) ?> >
327
+ <span class="channels__view-txt">Mobile</span>
328
+ </label>
329
+ </div>
330
+
331
+ <!-- button for advance setting -->
332
+ <div class="chaty-settings" onclick="toggle_chaty_setting('<?php echo esc_attr($social['slug']); ?>')">
333
+ <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
334
+ </div>
335
+
336
+ <!-- example for social media -->
337
+ <div class="input-example">
338
+ <?php esc_attr_e('For example', CHT_OPT); ?>: <?php esc_attr_e($social['example']); ?>
339
+ </div>
340
+
341
+ <!-- checking for extra help message for social media -->
342
+ <?php if((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) { ?>
343
+ <div class="viber-help">
344
+ <?php if(isset($social['help_link'])) { ?>
345
+ <?php $help_text = isset($social['help_title'])?$social['help_title']:"Doesn't work?"; ?>
346
+ <a href="<?php echo esc_url($social['help_link']) ?>" target="_blank"><?php esc_attr_e($help_text); ?></a>
347
+ <?php } else { ?>
348
+ <?php $help_text = isset($social['help_title'])?$social['help_title']:"Doesn't work?"; ?>
349
+ <span><?php echo $social['help']; ?></span>
350
+ <?php esc_attr_e($help_text); ?>
351
+ <?php } ?>
352
+ </div>
353
+ <?php } ?>
354
+ </div>
355
+ <!-- advance setting fields: start -->
356
+ <?php $class_name = !$this->is_pro()?"not-is-pro":""; ?>
357
+ <div class="chaty-advance-settings <?php esc_attr_e($class_name); ?>">
358
+ <!-- Settings for custom icon and color -->
359
+ <div class="chaty-setting-col">
360
+ <label>Icon Appearance</label>
361
+ <div>
362
+ <!-- input for custom color -->
363
+ <input type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[bg_color]" class="chaty-color-field" value="<?php esc_attr_e($value['bg_color']) ?>" />
364
+
365
+ <!-- button to upload custom image -->
366
+ <?php if($this->is_pro()) { ?>
367
+ <a onclick="upload_chaty_image('<?php echo esc_attr($social['slug']); ?>')" href="javascript:;" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
368
+
369
+ <!-- hidden input value for image -->
370
+ <input id="cht_social_image_<?php echo esc_attr($social['slug']); ?>" type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[image_id]" value="<?php esc_attr_e($imageId) ?>" />
371
+ <?php } else { ?>
372
+ <div class="pro-features">
373
+ <div class="pro-item">
374
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
375
+ </div>
376
+ <div class="pro-button">
377
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
378
+ </div>
379
+ </div>
380
+ <?php } ?>
381
+ </div>
382
+ </div>
383
+
384
+ <div class="clear clearfix"></div>
385
+
386
+ <?php if($this->is_pro()) { ?>
387
+ <!-- Settings for custom title -->
388
+ <div class="chaty-setting-col">
389
+ <label>On Hover Text</label>
390
+ <div>
391
+ <!-- input for custom title -->
392
+ <input type="text" class="chaty-title" name="cht_social_<?php echo esc_attr($social['slug']); ?>[title]" value="<?php esc_attr_e($value['title']) ?>">
393
+ </div>
394
+ </div>
395
+ <div class="clear clearfix"></div>
396
+ <?php if($social['slug'] == "Whatsapp") { ?>
397
+ <!-- advance setting for Whatsapp -->
398
+ <div class="clear clearfix"></div>
399
+ <div class="chaty-setting-col">
400
+ <label>Pre Set Message</label>
401
+ <div>
402
+ <?php $pre_set_message = isset($value['pre_set_message'])?$value['pre_set_message']:""; ?>
403
+ <input id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[pre_set_message]" value="<?php esc_attr_e($pre_set_message) ?>" >
404
+ </div>
405
+ </div>
406
+ <?php } else if($social['slug'] == "Email") { ?>
407
+ <!-- advance setting for Email -->
408
+ <div class="clear clearfix"></div>
409
+ <div class="chaty-setting-col">
410
+ <label>Mail Subject</label>
411
+ <div>
412
+ <?php $mail_subject = isset($value['mail_subject'])?$value['mail_subject']:""; ?>
413
+ <input id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[mail_subject]" value="<?php esc_attr_e($mail_subject) ?>" >
414
+ </div>
415
+ </div>
416
+ <?php } else if($social['slug'] == "WeChat") { ?>
417
+ <!-- advance setting for WeChat -->
418
+ <?php
419
+ $qr_code = isset($value['qr_code'])?$value['qr_code']:""; // Initialize QR code value if not exists. 2.1.0 change
420
+ $imageUrl = "";
421
+ $status = 0;
422
+ if($qr_code != "") {
423
+ $imageUrl = wp_get_attachment_image_src($qr_code, "full")[0]; // get custom Image URL if exists
424
+ }
425
+ if($imageUrl == "") {
426
+ $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; // Initialize with default image URL if URL is not exists
427
+ } else {
428
+ $status = 1;
429
+ }
430
+ ?>
431
+ <div class="clear clearfix"></div>
432
+ <div class="chaty-setting-col">
433
+ <label>Upload QR Code</label>
434
+ <div>
435
+ <!-- Button to upload QR Code image -->
436
+ <a class="cht-upload-image <?php esc_attr_e(($status)?"active":"") ?>" id="upload_qr_code" href="javascript:;" onclick="upload_qr_code()">
437
+ <img id="cht_social_image_src_<?php echo esc_attr($social['slug']); ?>" src="<?php echo esc_url($imageUrl) ?>" alt="<?php esc_attr_e($value['title']) ?>">
438
+ <span class="dashicons dashicons-upload"></span>
439
+ </a>
440
+
441
+ <!-- Button to remove QR Code image -->
442
+ <a href="javascript:;" class="remove-qr-code <?php esc_attr_e(($status)?"active":"") ?>" onclick="remove_qr_code()"><span class="dashicons dashicons-no-alt"></span></a>
443
+
444
+ <!-- input hidden field for QR Code -->
445
+ <input id="upload_qr_code_val" type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[qr_code]" value="<?php esc_attr_e($qr_code) ?>" >
446
+ </div>
447
+ </div>
448
+ <?php } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
449
+ $is_checked = (!isset($value['new_window']) || $value['new_window'] == 1)?1:0;
450
+ ?>
451
+ <!-- Advance setting for Custom Link -->
452
+ <div class="clear clearfix"></div>
453
+ <div class="chaty-setting-col">
454
+ <label >Open In a New Tab</label>
455
+ <div>
456
+ <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
457
+ <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
458
+ <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" <?php checked($is_checked, 1) ?> >
459
+ <span class="channels__view-txt">&nbsp;</span>
460
+ </label>
461
+ </div>
462
+ </div>
463
+ <?php } else if($social['slug'] == "Linkedin") {
464
+ $is_checked = isset($value['link_type'])?$value['link_type']:"personal";
465
+ ?>
466
+ <!-- Advance setting for Custom Link -->
467
+ <div class="clear clearfix"></div>
468
+ <div class="chaty-setting-col">
469
+ <label >LinkedIn</label>
470
+ <div>
471
+ <label>
472
+ <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
473
+ Personal
474
+ </label>
475
+ <label>
476
+ <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
477
+ Company
478
+ </label>
479
+ </div>
480
+ </div>
481
+ <?php } ?>
482
+ <?php } else { ?>
483
+ <div class="clear clearfix"></div>
484
+ <div class="chaty-setting-col">
485
+ <label>On Hover Text</label>
486
+ <div>
487
+ <input type="text" class="chaty-title" name="cht_social_<?php echo esc_attr($social['slug']); ?>[title]" value="<?php esc_attr_e($value['title']) ?>">
488
+ </div>
489
+ </div>
490
+ <div class="clear clearfix"></div>
491
+ <?php if($social['slug'] == "Whatsapp") {
492
+ $pre_set_message = isset($value['pre_set_message'])?$value['pre_set_message']:"";
493
+ ?>
494
+ <div class="clear clearfix"></div>
495
+ <div class="chaty-setting-col">
496
+ <label>Pre Set Message</label>
497
+ <div>
498
+ <div class="pro-features">
499
+ <div class="pro-item">
500
+ <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="<?php esc_attr_e($pre_set_message) ?>" >
501
+ </div>
502
+ <div class="pro-button">
503
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
504
+ </div>
505
+ </div>
506
+ </div>
507
+ </div>
508
+ <?php } else if($social['slug'] == "Email") { ?>
509
+ <div class="clear clearfix"></div>
510
+ <div class="chaty-setting-col">
511
+ <label>Mail Subject</label>
512
+ <div>
513
+ <div class="pro-features">
514
+ <div class="pro-item">
515
+ <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="" >
516
+ </div>
517
+ <div class="pro-button">
518
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
519
+ </div>
520
+ </div>
521
+ </div>
522
+ </div>
523
+ <?php } else if($social['slug'] == "WeChat") { ?>
524
+ <div class="clear clearfix"></div>
525
+ <div class="chaty-setting-col">
526
+ <label>Upload QR Code</label>
527
+ <div>
528
+ <a target="_blank" class="cht-upload-image-pro" id="upload_qr_code" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" >
529
+ <span class="dashicons dashicons-upload"></span>
530
+ </a>
531
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
532
+ </div>
533
+ </div>
534
+ <?php } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
535
+ $is_checked = 1;
536
+ ?>
537
+ <div class="clear clearfix"></div>
538
+ <div class="chaty-setting-col">
539
+ <label >Open In a New Tab</label>
540
+ <div>
541
+ <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
542
+ <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
543
+ <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" checked >
544
+ <span class="channels__view-txt">&nbsp;</span>
545
+ </label>
546
+ </div>
547
+ </div>
548
+ <?php } else if($social['slug'] == "Linkedin") {
549
+ $is_checked = "personal";
550
+ ?>
551
+ <!-- Advance setting for Custom Link -->
552
+ <div class="clear clearfix"></div>
553
+ <div class="chaty-setting-col">
554
+ <label >LinkedIn</label>
555
+ <div>
556
+ <label>
557
+ <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
558
+ Personal
559
+ </label>
560
+ <label>
561
+ <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
562
+ Company
563
+ </label>
564
+ </div>
565
+ </div>
566
+ <?php } ?>
567
+ <?php } ?>
568
+ </div>
569
+ <!-- advance setting fields: end -->
570
+
571
+
572
+ <!-- remove social media setting button: start -->
573
+ <button class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
574
+ <svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
575
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
576
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
577
+ </svg>
578
+ </button>
579
+ <!-- remove social media setting button: end -->
580
+ </div>
581
+ </li>
582
+ <!-- Social media setting box: end -->
583
+ <?php endforeach; ?>
584
+ <?php endforeach?>
585
+ <?php endif; ?>
586
+ <?php
587
+ $is_pro = $this->is_pro();
588
+ $pro_class = ($is_pro)?"pro":"free";
589
+ $text = get_option("cht_close_button_text");
590
+ $text = ($text === false)?"Hide":$text;
591
+ ?>
592
+ <!-- close setting strat -->
593
+ <li class="chaty-cls-setting" data-id="" id="chaty-social-close">
594
+ <div class="channels-selected__item pro 1 available">
595
+ <div class="chaty-default-settings ">
596
+ <div class="move-icon">
597
+ <img src="<?php echo esc_url(plugins_url()."/chaty/admin/assets/images/move-icon.png") ?>" style="opacity:0"; />
598
+ </div>
599
+ <div class="icon icon-md active" data-title="close" data-label="close">
600
+ <span id="image_data_close">
601
+ <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
602
+ </span>
603
+ <span class="default_image_close" style="display: none;">
604
+ <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
605
+ </span>
606
+ </div>
607
+ <div class="channels__input-box cls-btn-settings">
608
+ <input type="text" class="channels__input" name="cht_close_button_text" value="<?php echo esc_attr($text) ?>" data-gramm_editor="false" >
609
+ </div>
610
+ <div class="chaty-settings cls-btn">
611
+ <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
612
+ </div>
613
+ <div class="input-example cls-btn-settings">
614
+ <?php esc_attr_e('On hover Close button text', CHT_OPT); ?>
615
+ </div>
616
+ </div>
617
+ <button class="btn-cancel close-btn-set" data-social="<?php echo esc_attr($social['slug']); ?>">
618
+ <svg width="14" height="13" viewBox="0 0 14 13" fill="none"
619
+ xmlns="http://www.w3.org/2000/svg">
620
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
621
+ <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
622
+ </svg>
623
+ </button>
624
+ </div>
625
+ </li>
626
+ <!-- close setting end -->
627
+ </ul>
628
+ <div class="clear clearfix"></div>
629
+ <div class="channels-selected__item disabled" style="opacity: 0; display: none;">
630
+
631
+ </div>
632
+
633
+ <input type="hidden" id="is_pro_plugin" value="<?php esc_attr_e($this->is_pro()?"1":"0"); ?>" />
634
+ <?php if ($this->is_pro() && $this->is_expired()) : ?>
635
+ <div class="popover">
636
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
637
+ <?php esc_attr_e('Your Pro Plan has expired. ', CHT_OPT); ?>
638
+ <strong><?php esc_attr_e('Upgrade Now', CHT_OPT); ?></strong>
639
+ </a>
640
+ </div>
641
+ <?php endif; ?>
642
+ </div>
643
+
644
+ <!-- form sticky save button -->
645
+ <button class="btn-save-sticky">
646
+ <span><?php esc_attr_e('Save', CHT_OPT); ?></span>
647
+ <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
648
+ <path d="M21.5 0.5H0.5V27.5H27.5V6.5L21.5 0.5ZM14 24.5C11.51 24.5 9.5 22.49 9.5 20C9.5 17.51 11.51 15.5 14 15.5C16.49 15.5 18.5 17.51 18.5 20C18.5 22.49 16.49 24.5 14 24.5ZM18.5 9.5H3.5V3.5H18.5V9.5Z" fill="white"/>
649
+ </svg>
650
+ </button>
651
+
652
+ <!-- chaty help button -->
653
+ <a class="btn-help"><?php esc_attr_e('help', CHT_OPT); ?><span>?</span></a>
654
+ </section>
655
+ <script>
656
+ var PRO_PLUGIN_URL = "<?php echo esc_url(CHT_PRO_URL) ?>";
657
+ </script>
658
+
views/{modals → admin}/chaty-deactivate-form.php RENAMED
@@ -1,24 +1,20 @@
1
  <style>
2
- .chaty--hidden {
3
  overflow: hidden;
4
  }
5
-
6
- .chaty--popup-overlay .chaty--internal-message {
7
  margin: 3px 0 3px 22px;
8
  display: none;
9
  }
10
-
11
- .chaty--reason-input {
12
  margin: 3px 0 3px 22px;
13
  display: none;
14
  }
15
-
16
- .chaty--reason-input input[type="text"] {
17
  width: 100%;
18
  display: block;
19
  }
20
-
21
- .chaty--popup-overlay {
22
  background: rgba(0, 0, 0, .8);
23
  position: fixed;
24
  top: 0;
@@ -31,184 +27,165 @@
31
  opacity: 0;
32
  transition: opacity 0.3s ease-in-out :
33
  }
34
-
35
- .chaty--popup-overlay.chaty--active {
36
  opacity: 1;
37
  visibility: visible;
38
  }
39
-
40
- .chaty--serveypanel {
41
  width: 600px;
42
  background: #fff;
43
  margin: 65px auto 0;
44
  }
45
-
46
- .chaty--popup-header {
47
  background: #f1f1f1;
48
  padding: 20px;
49
  border-bottom: 1px solid #ccc;
50
  }
51
-
52
- .chaty--popup-header h2 {
53
  margin: 0;
54
  }
55
-
56
- .chaty--popup-body {
57
  padding: 10px 20px;
58
  }
59
-
60
- .chaty--popup-footer {
61
  background: #f9f3f3;
62
  padding: 10px 20px;
63
  border-top: 1px solid #ccc;
64
  }
65
-
66
- .chaty--popup-footer:after {
67
  content: "";
68
  display: table;
69
  clear: both;
70
  }
71
-
72
  .action-btns {
73
  float: right;
74
  }
75
-
76
- .chaty--anonymous {
77
  display: none;
78
  }
79
-
80
  .attention, .error-message {
81
  color: red;
82
  font-weight: 600;
83
  display: none;
84
  }
85
-
86
- .chaty--spinner {
87
  display: none;
88
  }
89
-
90
- .chaty--spinner img {
91
  margin-top: 3px;
92
  }
93
-
94
- .chaty--hidden-input {
95
  padding: 10px 0 0;
96
  display: none;
97
  }
98
-
99
- .chaty--hidden-input input[type='text'] {
100
  padding: 0 10px;
101
  width: 100%;
102
  height: 26px;
103
  line-height: 26px;
104
  }
105
-
106
  .chaty--popup-overlay textarea {
107
  padding: 10px;
108
  width: 100%;
109
  height: 100px;
110
  margin: 0 0 15px 0;
111
  }
112
-
113
- span.chaty--error-message {
114
  color: #dd0000;
115
  font-weight: 600;
116
  }
117
- .chaty--popup-body h3 {
118
  line-height: 24px;
119
  }
 
 
 
 
120
  .chaty--popup-overlay .form-control input {
121
  width: 100%;
122
  margin: 0 0 15px 0;
123
  }
124
  </style>
125
-
126
- <div class="chaty--popup-overlay">
127
- <div class="chaty--serveypanel">
128
- <form action="#" method="post" id="chaty--deactivate-form">
129
- <div class="chaty--popup-header">
130
- <h2><?php esc_attr_e('Quick feedback about Chaty', CHT_OPT); ?> 🙏</h2>
 
131
  </div>
132
- <div class="chaty--popup-body">
133
- <h3><?php esc_attr_e('Your feedback will help us improve the product, please tell us why did you decide to deactivate Chaty :)', CHT_OPT); ?></h3>
134
  <div class="form-control">
135
- <input type="email" value="<?php echo get_option( 'admin_email' ) ?>" placeholder="<?php echo _e("Email address", CHT_OPT) ?>" id="chaty-deactivation-email_id">
136
  </div>
137
  <div class="form-control">
138
  <label></label>
139
- <textarea placeholder="<?php esc_attr_e("Your comment", CHT_OPT) ?>" id="chaty-deactivation-comment"></textarea>
140
  </div>
141
  </div>
142
- <div class="chaty--popup-footer">
143
- <label class="chaty--anonymous">
144
- <input type="checkbox"/><?php esc_attr_e('Anonymous feedback', CHT_OPT); ?>
145
  </label>
146
- <input type="button" class="button button-secondary button-skip chaty--popup-skip-feedback" value="Skip &amp; Deactivate">
147
  <div class="action-btns">
148
- <span class="chaty--spinner"><img src="<?php echo esc_url(admin_url('/images/spinner.gif')); ?>" alt=""></span>
149
- <input type="submit" class="button button-secondary button-deactivate chaty--popup-allow-deactivate" value="Submit &amp; Deactivate" disabled="disabled">
150
- <a href="#" class="button button-primary chaty--popup-button-close"><?php esc_attr_e('Cancel', CHT_OPT); ?></a>
151
  </div>
152
  </div>
153
  </form>
 
154
  </div>
155
  </div>
156
-
157
-
158
  <script>
159
  (function ($) {
160
-
161
  $(function () {
162
-
163
- var pluginSlug = 'chaty';
164
  // Code to fire when the DOM is ready.
165
-
166
  $(document).on('click', 'tr[data-slug="' + pluginSlug + '"] .deactivate', function (e) {
167
  e.preventDefault();
168
-
169
- $('.chaty--popup-overlay').addClass('chaty--active');
170
- $('body').addClass('chaty--hidden');
171
  });
172
- $(document).on('click', '.chaty--popup-button-close', function () {
173
  close_popup();
174
  });
175
- $(document).on('click', ".chaty--serveypanel,tr[data-slug='" + pluginSlug + "'] .deactivate", function (e) {
176
  e.stopPropagation();
177
  });
178
-
179
  $(document).click(function () {
180
  close_popup();
181
  });
182
- $('.chaty--reason label').on('click', function () {
183
- $(".chaty--hidden-input").hide();
184
- jQuery(".chaty--error-message").remove();
185
  if ($(this).find('input[type="radio"]').is(':checked')) {
186
- $(this).closest("li").find('.chaty--hidden-input').show();
187
  }
188
  });
189
  $(document).on("keyup", "#chaty-deactivation-comment", function(){
190
  if($.trim($(this).val()) == "") {
191
- $(".chaty--popup-allow-deactivate").attr("disabled", true);
192
  } else {
193
- $(".chaty--popup-allow-deactivate").attr("disabled", false);
194
  }
195
  });
196
- $('input[type="radio"][name="chaty--selected-reason"]').on('click', function (event) {
197
- $(".chaty--popup-allow-deactivate").removeAttr('disabled');
198
  });
199
- $(document).on('submit', '#chaty--deactivate-form', function (event) {
200
  event.preventDefault();
201
  _reason = "";
202
  if(jQuery.trim(jQuery("#chaty-deactivation-comment").val()) == "") {
203
- jQuery("#alt_plugin").after("<span class='chaty--error-message'>Please provide your feedback</span>");
204
  return false;
205
  } else {
206
  _reason = jQuery.trim(jQuery("#chaty-deactivation-comment").val());
207
  }
208
-
209
- jQuery('[name="chaty--selected-reason"]:checked').val();
210
  var email_id = jQuery.trim(jQuery("#chaty-deactivation-email_id").val());
211
-
212
  $.ajax({
213
  url: ajaxurl,
214
  type: 'POST',
@@ -219,29 +196,26 @@
219
  nonce: '<?php esc_attr_e(wp_create_nonce("chaty_deactivate_nonce")) ?>'
220
  },
221
  beforeSend: function () {
222
- $(".chaty--spinner").show();
223
- $(".chaty--popup-allow-deactivate").attr("disabled", "disabled");
224
  }
225
  }).done(function () {
226
- $(".chaty--spinner").hide();
227
- $(".chaty--popup-allow-deactivate").removeAttr("disabled");
228
  window.location.href = $("tr[data-slug='" + pluginSlug + "'] .deactivate a").attr('href');
229
  });
230
  });
231
-
232
- $('.chaty--popup-skip-feedback').on('click', function (e) {
233
  window.location.href = $("tr[data-slug='" + pluginSlug + "'] .deactivate a").attr('href');
234
- })
235
-
236
  function close_popup() {
237
- $('.chaty--popup-overlay').removeClass('chaty--active');
238
- $('#chaty--deactivate-form').trigger("reset");
239
- $(".chaty--popup-allow-deactivate").attr('disabled', 'disabled');
240
- $(".chaty--reason-input").hide();
241
- $('body').removeClass('chaty--hidden');
242
  $('.message.error-message').hide();
243
  }
244
  });
245
-
246
  })(jQuery); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
247
  </script>
1
  <style>
2
+ .chaty-hidden {
3
  overflow: hidden;
4
  }
5
+ .chaty-popup-overlay .chaty-internal-message {
 
6
  margin: 3px 0 3px 22px;
7
  display: none;
8
  }
9
+ .chaty-reason-input {
 
10
  margin: 3px 0 3px 22px;
11
  display: none;
12
  }
13
+ .chaty-reason-input input[type="text"] {
 
14
  width: 100%;
15
  display: block;
16
  }
17
+ .chaty-popup-overlay {
 
18
  background: rgba(0, 0, 0, .8);
19
  position: fixed;
20
  top: 0;
27
  opacity: 0;
28
  transition: opacity 0.3s ease-in-out :
29
  }
30
+ .chaty-popup-overlay.chaty-active {
 
31
  opacity: 1;
32
  visibility: visible;
33
  }
34
+ .chaty-serveypanel {
 
35
  width: 600px;
36
  background: #fff;
37
  margin: 65px auto 0;
38
  }
39
+ .chaty-popup-header {
 
40
  background: #f1f1f1;
41
  padding: 20px;
42
  border-bottom: 1px solid #ccc;
43
  }
44
+ .chaty-popup-header h2 {
 
45
  margin: 0;
46
  }
47
+ .chaty-popup-body {
 
48
  padding: 10px 20px;
49
  }
50
+ .chaty-popup-footer {
 
51
  background: #f9f3f3;
52
  padding: 10px 20px;
53
  border-top: 1px solid #ccc;
54
  }
55
+ .chaty-popup-footer:after {
 
56
  content: "";
57
  display: table;
58
  clear: both;
59
  }
 
60
  .action-btns {
61
  float: right;
62
  }
63
+ .chaty-anonymous {
 
64
  display: none;
65
  }
 
66
  .attention, .error-message {
67
  color: red;
68
  font-weight: 600;
69
  display: none;
70
  }
71
+ .chaty-spinner {
 
72
  display: none;
73
  }
74
+ .chaty-spinner img {
 
75
  margin-top: 3px;
76
  }
77
+ .chaty-hidden-input {
 
78
  padding: 10px 0 0;
79
  display: none;
80
  }
81
+ .chaty-hidden-input input[type='text'] {
 
82
  padding: 0 10px;
83
  width: 100%;
84
  height: 26px;
85
  line-height: 26px;
86
  }
 
87
  .chaty--popup-overlay textarea {
88
  padding: 10px;
89
  width: 100%;
90
  height: 100px;
91
  margin: 0 0 15px 0;
92
  }
93
+ span.chaty-error-message {
 
94
  color: #dd0000;
95
  font-weight: 600;
96
  }
97
+ .chaty-popup-body h3 {
98
  line-height: 24px;
99
  }
100
+ .chaty-popup-body textarea {
101
+ width: 100%;
102
+ height: 80px;
103
+ }
104
  .chaty--popup-overlay .form-control input {
105
  width: 100%;
106
  margin: 0 0 15px 0;
107
  }
108
  </style>
109
+ <!-- modal for plugin deactivation popup -->
110
+ <div class="chaty-popup-overlay">
111
+ <div class="chaty-serveypanel">
112
+ <!-- form start -->
113
+ <form action="#" method="post" id="chaty-deactivate-form">
114
+ <div class="chaty-popup-header">
115
+ <h2><?php esc_attr_e('Quick feedback about Chaty', CHT_PRO_OPT); ?> 🙏</h2>
116
  </div>
117
+ <div class="chaty-popup-body">
118
+ <h3><?php esc_attr_e('Your feedback will help us improve the product, please tell us why did you decide to deactivate Chaty :)', CHT_PRO_OPT); ?></h3>
119
  <div class="form-control">
120
+ <input type="email" value="<?php echo get_option( 'admin_email' ) ?>" placeholder="<?php echo _e("Email address", CHT_PRO_OPT) ?>" id="chaty-deactivation-email_id">
121
  </div>
122
  <div class="form-control">
123
  <label></label>
124
+ <textarea placeholder="<?php esc_attr_e("Your comment", CHT_PRO_OPT) ?>" id="chaty-deactivation-comment"></textarea>
125
  </div>
126
  </div>
127
+ <div class="chaty-popup-footer">
128
+ <label class="chaty-anonymous">
129
+ <input type="checkbox"/><?php esc_attr_e('Anonymous feedback', CHT_PRO_OPT); ?>
130
  </label>
131
+ <input type="button" class="button button-secondary button-skip chaty-popup-skip-feedback" value="Skip &amp; Deactivate">
132
  <div class="action-btns">
133
+ <span class="chaty-spinner"><img src="<?php echo esc_url(admin_url('/images/spinner.gif')); ?>" alt=""></span>
134
+ <input type="submit" class="button button-secondary button-deactivate chaty-popup-allow-deactivate" value="Submit &amp; Deactivate" disabled="disabled">
135
+ <a href="#" class="button button-primary chaty-popup-button-close"><?php esc_attr_e('Cancel', CHT_PRO_OPT); ?></a>
136
  </div>
137
  </div>
138
  </form>
139
+ <!-- form end -->
140
  </div>
141
  </div>
 
 
142
  <script>
143
  (function ($) {
 
144
  $(function () {
145
+ var pluginSlug = 'chaty-pro';
 
146
  // Code to fire when the DOM is ready.
 
147
  $(document).on('click', 'tr[data-slug="' + pluginSlug + '"] .deactivate', function (e) {
148
  e.preventDefault();
149
+ $('.chaty-popup-overlay').addClass('chaty-active');
150
+ $('body').addClass('chaty-hidden');
 
151
  });
152
+ $(document).on('click', '.chaty-popup-button-close', function () {
153
  close_popup();
154
  });
155
+ $(document).on('click', ".chaty-serveypanel,tr[data-slug='" + pluginSlug + "'] .deactivate", function (e) {
156
  e.stopPropagation();
157
  });
 
158
  $(document).click(function () {
159
  close_popup();
160
  });
161
+ $('.chaty-reason label').on('click', function () {
162
+ $(".chaty-hidden-input").hide();
163
+ jQuery(".chaty-error-message").remove();
164
  if ($(this).find('input[type="radio"]').is(':checked')) {
165
+ $(this).closest("li").find('.chaty-hidden-input').show();
166
  }
167
  });
168
  $(document).on("keyup", "#chaty-deactivation-comment", function(){
169
  if($.trim($(this).val()) == "") {
170
+ $(".chaty-popup-allow-deactivate").attr("disabled", true);
171
  } else {
172
+ $(".chaty-popup-allow-deactivate").attr("disabled", false);
173
  }
174
  });
175
+ $('input[type="radio"][name="chaty-selected-reason"]').on('click', function (event) {
176
+ $(".chaty-popup-allow-deactivate").removeAttr('disabled');
177
  });
178
+ $(document).on('submit', '#chaty-deactivate-form', function (event) {
179
  event.preventDefault();
180
  _reason = "";
181
  if(jQuery.trim(jQuery("#chaty-deactivation-comment").val()) == "") {
182
+ jQuery("#alt_plugin").after("<span class='chaty-error-message'>Please provide your feedback</span>");
183
  return false;
184
  } else {
185
  _reason = jQuery.trim(jQuery("#chaty-deactivation-comment").val());
186
  }
187
+ jQuery('[name="chaty-selected-reason"]:checked').val();
 
188
  var email_id = jQuery.trim(jQuery("#chaty-deactivation-email_id").val());
 
189
  $.ajax({
190
  url: ajaxurl,
191
  type: 'POST',
196
  nonce: '<?php esc_attr_e(wp_create_nonce("chaty_deactivate_nonce")) ?>'
197
  },
198
  beforeSend: function () {
199
+ $(".chaty-spinner").show();
200
+ $(".chaty-popup-allow-deactivate").attr("disabled", "disabled");
201
  }
202
  }).done(function () {
203
+ $(".chaty-spinner").hide();
204
+ $(".chaty-popup-allow-deactivate").removeAttr("disabled");
205
  window.location.href = $("tr[data-slug='" + pluginSlug + "'] .deactivate a").attr('href');
206
  });
207
  });
208
+ $('.chaty-popup-skip-feedback').on('click', function (e) {
 
209
  window.location.href = $("tr[data-slug='" + pluginSlug + "'] .deactivate a").attr('href');
210
+ });
 
211
  function close_popup() {
212
+ $('.chaty-popup-overlay').removeClass('chaty-active');
213
+ $('#chaty-deactivate-form').trigger("reset");
214
+ $(".chaty-popup-allow-deactivate").attr('disabled', 'disabled');
215
+ $(".chaty-reason-input").hide();
216
+ $('body').removeClass('chaty-hidden');
217
  $('.message.error-message').hide();
218
  }
219
  });
 
220
  })(jQuery); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
221
  </script>
views/{parts → admin}/chaty_widget.php RENAMED
@@ -1,21 +1,21 @@
1
  <div class="chaty-new-widget-wrap">
2
- <div class="h2">What can you use it for?</div>
3
  <div class="chaty-new-widget-row">
4
  <div class="chaty-new-widget-left">
5
- <img src="<?php echo esc_url(plugin_dir_url("")."/chaty/assets/images/new_widget_img.png") ?>" width="322" height="258" />
6
  </div>
7
  <div class="chaty-new-widget-right">
8
  <p><strong>Create a new Chaty widget and show it on specific pages and categories of your website based on page targeting rules.</strong></p>
9
-
10
  <ul>
11
- <li>If you have a multi-language website or WPML plugin installed, you can show different buttons based on URL (e.g. visitors to yourdomain.com/fr/* pages will get an option to send a WhatsApp message to a French number and call your French phone number)</li>
12
  <li>You can show separate widgets for different products on your website (e.g. you can show the Facebook Messenger channel for products in the yourdomain.com/high-end/* category)</li>
13
  <li>Display different channels for your landing pages</li>
14
  <li>Show one widget on your support and contact pages, and a different widget on your sales pages.</li>
15
  <li>Display different call-to-action messages for different pages on your website or separate call-to-action messages for mobile and desktop</li>
16
  </ul>
17
  <div class="upgrade-chatys">
18
- <a href="<?php echo esc_url(CHT_PRO_URL); ?>" target="_blank"><span class="dashicons dashicons-lock"></span> <?php esc_attr_e('Upgrade Now', CHT_OPT );?></a>
19
  </div>
20
  </div>
21
  </div>
1
  <div class="chaty-new-widget-wrap">
2
+ <h2><?php esc_attr_e( 'Create another widget', CHT_OPT ); ?></h2>
3
  <div class="chaty-new-widget-row">
4
  <div class="chaty-new-widget-left">
5
+ <img src="<?php echo esc_url(plugin_dir_url("")."chaty/admin/assets/images/new_widget_img.png") ?>" width="322" height="258" />
6
  </div>
7
  <div class="chaty-new-widget-right">
8
  <p><strong>Create a new Chaty widget and show it on specific pages and categories of your website based on page targeting rules.</strong></p>
9
+ <p><strong>What can you use it for?</strong></p>
10
  <ul>
11
+ <li>If you have a multi-language website or WPML plugin installed, you can show different form and buttons based on URL (e.g. visitors to yourdomain.com/fr/* pages will get an option to send a WhatsApp message to a French number and call your French phone number)</li>
12
  <li>You can show separate widgets for different products on your website (e.g. you can show the Facebook Messenger channel for products in the yourdomain.com/high-end/* category)</li>
13
  <li>Display different channels for your landing pages</li>
14
  <li>Show one widget on your support and contact pages, and a different widget on your sales pages.</li>
15
  <li>Display different call-to-action messages for different pages on your website or separate call-to-action messages for mobile and desktop</li>
16
  </ul>
17
  <div class="upgrade-chatys">
18
+ <a href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>" target="_blank"><i class="fas fa-lock"></i><?php esc_attr_e('Upgrade to Pro', CHT_OPT );?></a>
19
  </div>
20
  </div>
21
  </div>
views/{parts/section2.php → admin/customize-widget-section.php} RENAMED
@@ -7,6 +7,7 @@
7
  <?php
8
  // Color
9
  $color = $this->get_current_color();
 
10
  ?>
11
  <div class="form-horizontal__item">
12
  <label class="align-top form-horizontal__item-label"><?php esc_attr_e('Color', 'chaty'); ?>:</label>
@@ -15,40 +16,32 @@
15
  <div class="color-picker">
16
  <div class="color-picker-radio">
17
  <label style="background-color: #A886CD">
18
- <input type="checkbox" name="cht_color" value="#A886CD" title="Purple"
19
- <?php
20
- if (!$color) {
21
- esc_attr_e('checked');
22
- } elseif($color === '#A886CD') {
23
- esc_attr_e('checked');
24
- }
25
- ?>
26
- >
27
  <span></span>
28
  </label>
29
 
30
  <label style="background-color: #86CD91">
31
- <input type="checkbox" name="cht_color" value="#86CD91" title="Green" <?php checked($color, '#86CD91') ?> >
32
  <span></span>
33
  </label>
34
 
35
  <label style="background-color: #4F6ACA">
36
- <input type="checkbox" name="cht_color" value="#4F6ACA" title="Blue" <?php checked($color, '#4F6ACA') ?> >
37
  <span></span>
38
  </label>
39
 
40
  <label style="background-color: #FF6060">
41
- <input type="checkbox" name="cht_color" value="#FF6060" title="Red" <?php checked($color, '#FF6060') ?> >
42
  <span></span>
43
  </label>
44
 
45
  <label style="background-color: #000">
46
- <input type="checkbox" name="cht_color" value="#000" title="Black" <?php checked($color, '#000') ?> >
47
  <span></span>
48
  </label>
49
 
50
  <label style="background-color: #EEF075">
51
- <input type="checkbox" name="cht_color" value="#EEF075" title="Yellow" <?php checked($color, '#EEF075') ?> >
52
  <span></span>
53
  </label>
54
 
@@ -62,16 +55,16 @@
62
  <?php if ($this->is_pro()) : ?>
63
  <div>
64
  <?php
65
- $os = array("#86CD91", "#A886CD", "#4F6ACA", "#FF6060", "#000", "#EEF075", "#FF95EE");
66
- if (in_array($color, $os)) {
67
- $color = '';
68
- }
69
  ?>
70
- <?php if($color): ?>
71
- <div class="circle" style="background-color: <?php esc_attr_e($color);?> ">
72
- </div><?php esc_attr_e('Custom color', CHT_OPT);?>
73
  <?php else: ?>
74
- <div class="circle">?</div><?php esc_attr_e('Custom color', CHT_OPT);?>
75
  <?php endif ?>
76
  </div>
77
  <div>
@@ -82,21 +75,18 @@
82
 
83
  <div>
84
  <div class="circle">?</div>
85
- <?php esc_attr_e('Custom color', CHT_OPT);?>
86
- <?php $image_url = $this->getUpgradeMenuItemUrl(); ?>
87
- <a target="_blank" href="<?php echo esc_url($image_url);?>">
88
- (<?php esc_attr_e('upgrade to pro', CHT_OPT);?>)
89
  </a>
90
  </div>
91
-
92
  <div>
93
- <input type="input" name="cht_custom_colo" placeholder="HEX code: #ffffff"
94
- value="" readonly style="cursor:not-allowed;width: 172px;"
95
- />
96
- <button class="btn-red"><?php esc_attr_e('Ok', CHT_OPT);?></button>
97
  </div>
98
  <?php endif; ?>
99
  </div>
 
100
  <button class="color-picker-btn-close">
101
  <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg">
102
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
@@ -106,22 +96,22 @@
106
  </div>
107
 
108
  <button class="color-picker-btn">
109
- <span class="circle" style="background-color: <?php esc_attr_e($color); ?>"></span>
 
110
  <span class="text">
111
  <?php
112
- if (!empty($color)) {
113
- $colors = $this->colors;
114
- if (isset($colors[$color])) {
115
- esc_attr_e($colors[$color]);
116
- } else {
117
- esc_attr_e('Custom', CHT_OPT);
118
- }
119
  } else {
120
- esc_attr_e('Purple', CHT_OPT);
121
  }
 
 
 
122
  ?>
123
  </span>
124
-
125
  <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg">
126
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
127
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="#4F4F4F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
@@ -135,119 +125,113 @@
135
  <div class="form-horizontal__item">
136
  <label class="align-top form-horizontal__item-label">Position:</label>
137
  <div>
138
- <?php $position = get_option('cht_position'); ?>
139
- <label class="custom-control custom-radio">
140
- <input type="radio" name="cht_position" class="custom-control-input" <?php checked($position, "left") ?> value="left" />
141
- <span class="custom-control-label"><?php esc_attr_e('Left', CHT_OPT);?></span>
142
  </label>
143
 
144
- <label class="custom-control custom-radio">
145
- <input type="radio" name="cht_position" class="custom-control-input" <?php checked($position, "right") ?> value="right" />
146
- <span class="custom-control-label"><?php esc_attr_e('Right', CHT_OPT);?></span>
147
  </label>
148
 
149
  <?php if ($this->is_pro()) : ?>
150
- <label class="custom-control custom-radio">
151
- <input type="radio" id="positionCustom" name="cht_position" class="custom-control-input position-pro-radio" <?php checked($position, "custom") ?> value="custom" />
152
  <span class="custom-control-label">
153
- <?php esc_attr_e('Custom', CHT_OPT);?>
154
  </span>
155
  </label>
156
  <?php else: ?>
157
- <span class="custom-control custom-radio free-custom-radio">
158
  <input type="radio" class="custom-control-input" disabled>
159
- <span class="custom-control-label"><?php esc_attr_e('Custom', CHT_OPT);?> </span>
160
  </span>
161
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>">(<?php esc_attr_e('upgrade to pro', CHT_OPT);?>)</a>
162
  <?php endif; ?>
163
 
164
- <div id="positionPro">
165
  <div class="position-pro">
166
  <div>
167
  <label>Side selection:</label>
168
- <?php $positionSide = get_option('positionSide') ?>
169
  <?php $pos_custom = empty($positionSide) ? 'right' : $positionSide; ?>
170
  <div class="custom-control-group">
171
  <label class="custom-control custom-radio custom-radio-btn">
172
  <input type="radio" value="left" name="positionSide" class="custom-control-input" <?php checked($pos_custom, "left") ?> />
173
  <span class="custom-control-label">
174
- <svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg">
175
- <path d="M6.92473 5.70473L2.4086 0.20886C2.30824 0.00901022 2.00717 -0.0909147 1.70609 0.108935L0.200717 1.30803C0.100358 1.40796 0 1.50788 0 1.70773C0 1.90758 -9.72047e-08 1.90758 0.100358 2.00751L3.31183 6.00451L0.100358 10.0015C-9.72047e-08 10.1014 0 10.2014 0 10.3013C0 10.4012 0.100358 10.6011 0.200717 10.6011L1.70609 11.8002C1.80645 12 1.90681 12 2.00717 12C2.10753 12 2.30824 11.9001 2.4086 11.8002L6.92473 6.30428C7.02509 6.10443 7.02509 5.90458 6.92473 5.70473Z" transform="translate(7 12) rotate(180)" fill="#E0E0E0"/>
176
- </svg>
177
- <?php esc_attr_e('Left', CHT_OPT); ?>
178
- </span>
179
  </label>
180
  <label class="custom-control custom-radio custom-radio-btn">
181
  <input type="radio" value="right" name="positionSide" class="custom-control-input" <?php checked($pos_custom, "right") ?> />
182
  <span class="custom-control-label">
183
- <?php esc_attr_e('Right', CHT_OPT); ?>
184
  <svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg">
185
  <path d="M6.92473 5.70473L2.4086 0.20886C2.30824 0.00901022 2.00717 -0.0909147 1.70609 0.108935L0.200717 1.30803C0.100358 1.40796 0 1.50788 0 1.70773C0 1.90758 -9.72047e-08 1.90758 0.100358 2.00751L3.31183 6.00451L0.100358 10.0015C-9.72047e-08 10.1014 0 10.2014 0 10.3013C0 10.4012 0.100358 10.6011 0.200717 10.6011L1.70609 11.8002C1.80645 12 1.90681 12 2.00717 12C2.10753 12 2.30824 11.9001 2.4086 11.8002L6.92473 6.30428C7.02509 6.10443 7.02509 5.90458 6.92473 5.70473Z" fill="#E0E0E0"/>
186
- </svg>
187
- </span>
188
  </label>
189
  </div>
190
  </div>
191
 
192
  <div>
193
- <?php
194
- $cht_bottom_spacing = get_option('cht_bottom_spacing');
195
- $cht_bottom_spacing = ($cht_bottom_spacing)?$cht_bottom_spacing:25;
196
- ?>
197
  <label><?php esc_attr_e('Bottom spacing', CHT_OPT); ?>:</label>
198
- <input type="number" name="cht_bottom_spacing" id="positionBottom" max="2000" value="<?php esc_attr_e($cht_bottom_spacing) ?>" placeholder="25">px
 
199
  </div>
200
 
201
  <div>
202
- <?php
203
- $cht_side_spacing = get_option('cht_side_spacing');
204
- $cht_side_spacing = ($cht_side_spacing)?$cht_side_spacing:25;
205
- ?>
206
  <label><?php esc_attr_e('Side spacing', CHT_OPT); ?>:</label>
 
207
  <input type="number" name="cht_side_spacing" id="positionSide" max="2000" value="<?php esc_attr_e($cht_side_spacing) ?>" placeholder="25">px
208
  </div>
209
  </div>
210
  </div>
211
  </div>
212
-
213
  </div>
214
 
215
  <?php // Call to Action ?>
216
  <div class="form-horizontal__item">
217
- <label class="align-top form-horizontal__item-label"><?php esc_attr_e('Call to action', CHT_OPT);?>:</label>
218
- <div> <script type="text/javascript">
219
- var keynum, lines = 1;
220
- function limitLines(obj, e) {
221
- // IE
222
- if(window.event) {
223
- keynum = e.keyCode;
224
- // Netscape/Firefox/Opera
225
- } else if(e.which) {
226
- keynum = e.which;
227
- }
228
- if(keynum == 13) {
229
- var text = jQuery(".test_textarea").val();
230
- var lines = text.split(/\r|\r\n|\n/);
231
- var count = lines.length;
232
- console.log(count); // Outputs 4
233
- if(count >= obj.rows) {
234
- return false;
235
- }else{
236
- lines++;
237
- }
238
- }
239
- }
240
- </script>
241
- <?php
242
- $cta =nl2br(get_option('cht_cta'));
 
243
  $cta = str_replace(array("\r","\n"),"",$cta);
244
- ?>
245
- <textarea class="test_textarea" cols="40" rows="2" name="cht_cta" data-value="<?php echo esc_attr($cta) ?>" ><?php echo esc_attr($cta) ?></textarea>
246
  </div>
247
  </div>
248
 
249
  <div class="form-horizontal__item flex-center">
250
- <label class="form-horizontal__item-label"><span class="icon label-tooltip" data-label="The attention effect will appear on your site until your website visitors engage with the widget for the first time. After the first engagement, the attention effect will not appear again."><span class="dashicons dashicons-editor-help"></span></span> <?php esc_attr_e('Attention effect', CHT_OPT);?>:</label>
251
  <div>
252
  <?php
253
  $group = '';
@@ -259,7 +243,7 @@
259
  "spin" => "Spin",
260
  "fade" => "Fade"
261
  );
262
- $effect = get_option('chaty_attention_effect');
263
  $effect = empty($effect)?"":$effect;
264
  ?>
265
  <select name="chaty_attention_effect" class="chaty-select" id="chaty_attention_effect" data-effect="<?php echo esc_attr($effect) ?>">
@@ -270,8 +254,6 @@
270
  </div>
271
  </div>
272
 
273
- <?php $disabled = (!$this->is_pro())?'disabled':""; ?>
274
-
275
  <div class="form-horizontal__item widget-icon__block">
276
  <label class="form-horizontal__item-label">Widget icon:</label>
277
  <?php $pro_class = $this->is_pro() ? "has-pro" : "has-free"; ?>
@@ -295,7 +277,7 @@
295
  </i>
296
  <span class="custom-control-label"></span>
297
  </label>
298
- <?php $widget_icon = get_option('widget_icon'); ?>
299
  <?php $disabled = (!$this->is_pro())?"disabled":""; ?>
300
 
301
  <label class="custom-control custom-radio">
@@ -318,7 +300,7 @@
318
 
319
 
320
  <label class="custom-control custom-radio">
321
- <input type="radio" name="widget_icon" class="custom-control-input js-widget-i" value="chat-bubble" data-type="chat-bubble" data-gramm_editor="false" <?php checked($widget_icon, "chat-bubble") ?> />
322
  <i class="icon-chat" data-type="chat-bubble">
323
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve">
324
  <style type="text/css">.st1 { fill: #FFFFFF; }</style>
@@ -347,28 +329,28 @@
347
  <span class="custom-control-label"></span>
348
  </label>
349
 
350
- <?php if (!$this->is_pro()): ?>
351
  <div class="custom-control custom-radio upgrade-upload-btn">
352
- <?php else: ?>
353
- <label class="custom-control custom-radio" id="image-upload-content">
354
- <?php endif; ?>
355
- <div class="form-group" id="image-upload">
356
- <div id="elPreviewImage"></div>
357
- <div class="file-loading">
358
- <input type="file" id="testUpload" name="cht_widget_img" <?php if (!$this->is_pro()) echo 'disabled'; ?> >
359
- </div>
360
- <div id="errorBlock" class="help-block"></div>
361
  </div>
362
- <?php if ($this->is_pro()): ?>
363
- <input type="radio" name="widget_icon" class="custom-control-input js-widget-i js-upload" value="chat-image" data-gramm_editor="false" <?php checked($widget_icon, "chat-image") ?> <?php esc_attr_e($disabled) ?> data-type="chat-image" id="uploadInput" >
364
- <span class="custom-control-label"></span>
365
- <?php endif; ?>
366
- <?php if (!$this->is_pro()): ?>
367
  <span class="custom-control-label"></span>
368
- <a class="upgrade-link" target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>"><?php esc_attr_e('upgrade to pro', CHT_OPT); ?></a>
 
 
 
369
  </div>
370
- <?php else: ?>
371
- </label>
372
  <?php endif; ?>
373
 
374
 
@@ -404,55 +386,56 @@
404
  }(jQuery));
405
  </script>
406
  </div>
 
407
 
408
- <div class="form-horizontal__item">
409
- <label class="form-horizontal__item-label">Font Family:</label>
410
- <div>
411
- <?php
412
- $font = get_option('cht_widget_font');
413
- $font = empty($font)?"":$font;
414
- ?>
415
- <select name="cht_widget_font" class="form-fonts">
416
- <option value="">Select font family</option>
417
- <?php $group = '';
418
- foreach ($fonts as $key => $value):
419
- if ($value != $group) {
420
- echo '<optgroup label="' . $value . '">';
421
- $group = $value;
422
- }
423
- ?>
424
- <option value="<?php echo $key; ?>" <?php selected($font, $key); ?>><?php echo $key; ?></option>
425
- <?php endforeach; ?>
426
- </select>
427
- </div>
428
  </div>
 
429
 
430
- <div class="form-horizontal__item">
431
- <label class="form-horizontal__item-label">Widget size:</label>
432
- <div>
433
- <?php
434
- $cht_widget_size = get_option("cht_widget_size");
435
- $cht_widget_size = ($cht_widget_size)?$cht_widget_size: 54 ;
436
- ?>
437
- <input type="number" min="24" max="100" name="cht_widget_size" class="widget-size__input" data-gramm_editor="false" value="<?php esc_attr_e($cht_widget_size) ?>" />
438
- <span class="custom-control-label">
439
- px
440
- </span>
441
- </div>
442
  </div>
 
443
 
444
  <div class="form-horizontal__item flex-center">
 
445
  <label class="form-horizontal__item-label"><?php esc_attr_e('Google Analytics', CHT_OPT);?>:</label>
446
  <div>
447
  <label class="switch">
448
  <?php
449
- $checked = get_option('cht_google_analytics');
450
  ?>
451
  <span class="switch__label"><?php esc_attr_e('Off', CHT_OPT);?></span>
452
- <input disabled data-gramm_editor="false" type="checkbox" name="cht_google_analytics" value="1" <?php echo (!empty($checked)) ? 'checked' : ''; ?>>
 
453
  <span class="switch__styled"></span>
454
- <span class="switch__label"><?php esc_attr_e('On', CHT_OPT);?></span>&nbsp;&nbsp;
455
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>">(<?php esc_attr_e('upgrade to pro', CHT_OPT);?>)</a>
456
  </label>
457
  </div>
458
  </div>
@@ -465,11 +448,18 @@
465
  <label class="form-horizontal__item-label">Credit:</label>
466
  <div>
467
  <label class="custom-control custom-checkbox free-custom-checkbox">
468
- <input type="checkbox" class="custom-control-input" disabled data-gramm_editor="false" >
469
- <span class="custom-control-label"><?php esc_attr_e('Remove "Get widget" link', CHT_OPT);?></span>
470
  </label>
471
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>">(<?php esc_attr_e('upgrade to pro', CHT_OPT);?>)</a>
472
  </div>
473
  <?php endif; ?>
474
  </div>
 
 
 
 
 
 
 
475
  </section>
7
  <?php
8
  // Color
9
  $color = $this->get_current_color();
10
+ $color = empty($color)?'#A886CD':$color;
11
  ?>
12
  <div class="form-horizontal__item">
13
  <label class="align-top form-horizontal__item-label"><?php esc_attr_e('Color', 'chaty'); ?>:</label>
16
  <div class="color-picker">
17
  <div class="color-picker-radio">
18
  <label style="background-color: #A886CD">
19
+ <input type="checkbox" name="cht_color" value="#A886CD" title="Purple" <?php checked($color, '#A886CD') ?> >
 
 
 
 
 
 
 
 
20
  <span></span>
21
  </label>
22
 
23
  <label style="background-color: #86CD91">
24
+ <input type="checkbox" name="cht_color" value="#86CD91" title="Green" <?php checked($color, '#86CD91') ?> />
25
  <span></span>
26
  </label>
27
 
28
  <label style="background-color: #4F6ACA">
29
+ <input type="checkbox" name="cht_color" value="#4F6ACA" title="Blue" <?php checked($color, '#4F6ACA') ?> />
30
  <span></span>
31
  </label>
32
 
33
  <label style="background-color: #FF6060">
34
+ <input type="checkbox" name="cht_color" value="#FF6060" title="Red" <?php checked($color, '#FF6060') ?> >
35
  <span></span>
36
  </label>
37
 
38
  <label style="background-color: #000">
39
+ <input type="checkbox" name="cht_color" value="#000" title="Black" <?php checked($color, '#000') ?> >
40
  <span></span>
41
  </label>
42
 
43
  <label style="background-color: #EEF075">
44
+ <input type="checkbox" name="cht_color" value="#EEF075" title="Yellow" <?php checked($color, '#EEF075') ?> >
45
  <span></span>
46
  </label>
47
 
55
  <?php if ($this->is_pro()) : ?>
56
  <div>
57
  <?php
58
+ $os = array("#86CD91", "#A886CD", "#4F6ACA", "#FF6060", "#000", "#EEF075", "#FF95EE");
59
+ if (in_array($color, $os)) {
60
+ $color = '';
61
+ }
62
  ?>
63
+ <?php if ($color): ?>
64
+ <div class="circle" style="background-color: <?php esc_attr_e($color); ?> "></div>
65
+ <?php esc_attr_e('Custom color', CHT_OPT); ?>
66
  <?php else: ?>
67
+ <div class="circle">?</div><?php esc_attr_e('Custom color', CHT_OPT); ?>
68
  <?php endif ?>
69
  </div>
70
  <div>
75
 
76
  <div>
77
  <div class="circle">?</div>
78
+ <?php esc_attr_e('Custom color', CHT_OPT); ?>
79
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
80
+ (<?php esc_attr_e('Upgrade to Pro', CHT_OPT); ?>)
 
81
  </a>
82
  </div>
 
83
  <div>
84
+ <input type="input" name="cht_custom_colo" placeholder="HEX code: #ffffff" value="" readonly style="cursor:not-allowed;width: 172px;" />
85
+ <button class="btn-red"><?php esc_attr_e('Ok', CHT_OPT); ?></button>
 
 
86
  </div>
87
  <?php endif; ?>
88
  </div>
89
+ <?php $color = $this->get_current_color(); ?>
90
  <button class="color-picker-btn-close">
91
  <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg">
92
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
96
  </div>
97
 
98
  <button class="color-picker-btn">
99
+ <?php $color = !empty($color) ? $color : '#A886CD'; ?>
100
+ <span class="circle" style="background-color: <?php esc_attr_e($color) ?>"></span>
101
  <span class="text">
102
  <?php
103
+ if (!empty($color)) {
104
+ $colors = $this->colors;
105
+ if (isset($colors[$color])) {
106
+ esc_attr_e($colors[$color]);
 
 
 
107
  } else {
108
+ esc_attr_e('Custom', CHT_OPT);
109
  }
110
+ } else {
111
+ esc_attr_e('Purple', CHT_OPT);
112
+ }
113
  ?>
114
  </span>
 
115
  <svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg">
116
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
117
  <path d="M0 0L4.31505 3.77708L8.63008 0" transform="translate(1.37436 1.31006)" stroke="#4F4F4F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
125
  <div class="form-horizontal__item">
126
  <label class="align-top form-horizontal__item-label">Position:</label>
127
  <div>
128
+ <?php $position = get_option('cht_position'.$this->widget_index); ?>
129
+ <label class="custom-control custom-radio" for="left-position">
130
+ <input type="radio" id="left-position" name="cht_position" class="custom-control-input" <?php checked($position, "left") ?> value="left" />
131
+ <span class="custom-control-label"><?php esc_attr_e('Left', CHT_OPT); ?></span>
132
  </label>
133
 
134
+ <label class="custom-control custom-radio" for="right-position">
135
+ <input type="radio" id="right-position" name="cht_position" class="custom-control-input" <?php checked($position, "right") ?> value="right" />
136
+ <span class="custom-control-label"><?php esc_attr_e('Right', CHT_OPT); ?></span>
137
  </label>
138
 
139
  <?php if ($this->is_pro()) : ?>
140
+ <label class="custom-control custom-radio" for="positionCustom">
141
+ <input type="radio" id="positionCustom" name="cht_position" class="custom-control-input position-pro-radio" <?php checked($position, "custom") ?> value="custom" />
142
  <span class="custom-control-label">
143
+ <?php esc_attr_e('Custom', CHT_OPT); ?>
144
  </span>
145
  </label>
146
  <?php else: ?>
147
+ <span class="custom-control custom-radio free-custom-radio" style="pointer-events: none">
148
  <input type="radio" class="custom-control-input" disabled>
149
+ <span class="custom-control-label"><?php esc_attr_e('Custom', CHT_OPT); ?> </span>
150
  </span>
151
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">(<?php esc_attr_e('Upgrade to Pro', CHT_OPT); ?>)</a>
152
  <?php endif; ?>
153
 
154
+ <div id="positionPro" style="display: <?php esc_attr_e(($position === 'custom') ? 'block' : 'none'); ?>" >
155
  <div class="position-pro">
156
  <div>
157
  <label>Side selection:</label>
158
+ <?php $positionSide = get_option('positionSide'.$this->widget_index) ?>
159
  <?php $pos_custom = empty($positionSide) ? 'right' : $positionSide; ?>
160
  <div class="custom-control-group">
161
  <label class="custom-control custom-radio custom-radio-btn">
162
  <input type="radio" value="left" name="positionSide" class="custom-control-input" <?php checked($pos_custom, "left") ?> />
163
  <span class="custom-control-label">
164
+ <svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg">
165
+ <path d="M6.92473 5.70473L2.4086 0.20886C2.30824 0.00901022 2.00717 -0.0909147 1.70609 0.108935L0.200717 1.30803C0.100358 1.40796 0 1.50788 0 1.70773C0 1.90758 -9.72047e-08 1.90758 0.100358 2.00751L3.31183 6.00451L0.100358 10.0015C-9.72047e-08 10.1014 0 10.2014 0 10.3013C0 10.4012 0.100358 10.6011 0.200717 10.6011L1.70609 11.8002C1.80645 12 1.90681 12 2.00717 12C2.10753 12 2.30824 11.9001 2.4086 11.8002L6.92473 6.30428C7.02509 6.10443 7.02509 5.90458 6.92473 5.70473Z" transform="translate(7 12) rotate(180)" fill="#E0E0E0"/>
166
+ </svg>
167
+ <?php esc_attr_e('Left', CHT_OPT); ?>
168
+ </span>
169
  </label>
170
  <label class="custom-control custom-radio custom-radio-btn">
171
  <input type="radio" value="right" name="positionSide" class="custom-control-input" <?php checked($pos_custom, "right") ?> />
172
  <span class="custom-control-label">
173
+ <?php esc_attr_e('Right', CHT_OPT); ?>
174
  <svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg">
175
  <path d="M6.92473 5.70473L2.4086 0.20886C2.30824 0.00901022 2.00717 -0.0909147 1.70609 0.108935L0.200717 1.30803C0.100358 1.40796 0 1.50788 0 1.70773C0 1.90758 -9.72047e-08 1.90758 0.100358 2.00751L3.31183 6.00451L0.100358 10.0015C-9.72047e-08 10.1014 0 10.2014 0 10.3013C0 10.4012 0.100358 10.6011 0.200717 10.6011L1.70609 11.8002C1.80645 12 1.90681 12 2.00717 12C2.10753 12 2.30824 11.9001 2.4086 11.8002L6.92473 6.30428C7.02509 6.10443 7.02509 5.90458 6.92473 5.70473Z" fill="#E0E0E0"/>
176
+ </svg>
177
+ </span>
178
  </label>
179
  </div>
180
  </div>
181
 
182
  <div>
 
 
 
 
183
  <label><?php esc_attr_e('Bottom spacing', CHT_OPT); ?>:</label>
184
+ <?php $cht_bottom_spacing = get_option('cht_bottom_spacing'.$this->widget_index) ? get_option('cht_bottom_spacing'.$this->widget_index) : 25; ?>
185
+ <input type="number" name="cht_bottom_spacing" id="positionBottom" max="2000" value="<?php esc_attr_e($cht_bottom_spacing) ?>" placeholder="25">px
186
  </div>
187
 
188
  <div>
 
 
 
 
189
  <label><?php esc_attr_e('Side spacing', CHT_OPT); ?>:</label>
190
+ <?php $cht_side_spacing = get_option('cht_side_spacing'.$this->widget_index) ? get_option('cht_side_spacing'.$this->widget_index) : 25; ?>
191
  <input type="number" name="cht_side_spacing" id="positionSide" max="2000" value="<?php esc_attr_e($cht_side_spacing) ?>" placeholder="25">px
192
  </div>
193
  </div>
194
  </div>
195
  </div>
 
196
  </div>
197
 
198
  <?php // Call to Action ?>
199
  <div class="form-horizontal__item">
200
+ <label class="align-top form-horizontal__item-label"><?php esc_attr_e('Call to action', CHT_OPT); ?>:</label>
201
+ <div>
202
+ <script type="text/javascript">
203
+ var keynum, lines = 1;
204
+ function limitLines(obj, e) {
205
+ // IE
206
+ if (window.event) {
207
+ keynum = e.keyCode;
208
+ // Netscape/Firefox/Opera
209
+ } else if (e.which) {
210
+ keynum = e.which;
211
+ }
212
+ if (keynum == 13) {
213
+ var text = jQuery(".test_textarea").val();
214
+ var lines = text.split(/\r|\r\n|\n/);
215
+ var count = lines.length;
216
+ console.log(count); // Outputs 4
217
+ if (count >= obj.rows) {
218
+ return false;
219
+ } else {
220
+ lines++;
221
+ }
222
+ }
223
+ }
224
+ </script>
225
+ <?php
226
+ $cta =nl2br(get_option('cht_cta'.$this->widget_index));
227
  $cta = str_replace(array("\r","\n"),"",$cta);
228
+ ?>
229
+ <textarea type="text" data-gramm_editor="false" data-value="<?php echo esc_attr($cta) ?>" class="test_textarea" cols="40" rows="2" name="cht_cta" value="<?php echo esc_attr_e(wp_unslash($cta)) ?>" placeholder="<?php esc_attr_e('Message us!', CHT_OPT); ?>" onkeydown="return limitLines(this, event)"><?php esc_attr_e($cta) ?></textarea>
230
  </div>
231
  </div>
232
 
233
  <div class="form-horizontal__item flex-center">
234
+ <label class="form-horizontal__item-label"><span class="icon label-tooltip" data-title="The attention effect will appear on your site until your website visitors engage with the widget for the first time. After the first engagement, the attention effect will not appear again."><span class="dashicons dashicons-editor-help"></span></span> <?php esc_attr_e('Attention effect', CHT_OPT);?>:</label>
235
  <div>
236
  <?php
237
  $group = '';
243
  "spin" => "Spin",
244
  "fade" => "Fade"
245
  );
246
+ $effect = get_option('chaty_attention_effect'.$this->widget_index);
247
  $effect = empty($effect)?"":$effect;
248
  ?>
249
  <select name="chaty_attention_effect" class="chaty-select" id="chaty_attention_effect" data-effect="<?php echo esc_attr($effect) ?>">
254
  </div>
255
  </div>
256
 
 
 
257
  <div class="form-horizontal__item widget-icon__block">
258
  <label class="form-horizontal__item-label">Widget icon:</label>
259
  <?php $pro_class = $this->is_pro() ? "has-pro" : "has-free"; ?>
277
  </i>
278
  <span class="custom-control-label"></span>
279
  </label>
280
+ <?php $widget_icon = get_option('widget_icon'.$this->widget_index); ?>
281
  <?php $disabled = (!$this->is_pro())?"disabled":""; ?>
282
 
283
  <label class="custom-control custom-radio">
300
 
301
 
302
  <label class="custom-control custom-radio">
303
+ <input type="radio" name="widget_icon" class="custom-control-input js-widget-i" value="chat-bubble" data-type="chat-bubble" data-gramm_editor="false" <?php checked($widget_icon, "chat-bubble") ?> />
304
  <i class="icon-chat" data-type="chat-bubble">
305
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve">
306
  <style type="text/css">.st1 { fill: #FFFFFF; }</style>
329
  <span class="custom-control-label"></span>
330
  </label>
331
 
332
+ <?php if (!$this->is_pro()): ?>
333
  <div class="custom-control custom-radio upgrade-upload-btn">
334
+ <?php else: ?>
335
+ <label class="custom-control custom-radio" id="image-upload-content">
336
+ <?php endif; ?>
337
+ <div class="form-group" id="image-upload">
338
+ <div id="elPreviewImage"></div>
339
+ <div class="file-loading">
340
+ <input type="file" id="testUpload" name="cht_widget_img" <?php if (!$this->is_pro()) echo 'disabled'; ?> >
 
 
341
  </div>
342
+ <div id="errorBlock" class="help-block"></div>
343
+ </div>
344
+ <?php if ($this->is_pro()): ?>
345
+ <input type="radio" name="widget_icon" class="custom-control-input js-widget-i js-upload" value="chat-image" data-gramm_editor="false" <?php checked($widget_icon, "chat-image") ?> <?php esc_attr_e($disabled) ?> data-type="chat-image" id="uploadInput" >
 
346
  <span class="custom-control-label"></span>
347
+ <?php endif; ?>
348
+ <?php if (!$this->is_pro()): ?>
349
+ <span class="custom-control-label"></span>
350
+ <a class="upgrade-link" target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT); ?></a>
351
  </div>
352
+ <?php else: ?>
353
+ </label>
354
  <?php endif; ?>
355
 
356
 
386
  }(jQuery));
387
  </script>
388
  </div>
389
+ </div>
390
 
391
+ <div class="form-horizontal__item">
392
+ <label class="form-horizontal__item-label">Font Family:</label>
393
+ <div>
394
+ <?php
395
+ $font = get_option('cht_widget_font'.$this->widget_index);
396
+ $font = empty($font)?"":$font;
397
+ ?>
398
+ <select name="cht_widget_font" class="form-fonts">
399
+ <option value="">Select font family</option>
400
+ <?php $group = '';
401
+ foreach ($fonts as $key => $value):
402
+ if ($value != $group) {
403
+ echo '<optgroup label="' . $value . '">';
404
+ $group = $value;
405
+ }
406
+ ?>
407
+ <option value="<?php echo $key; ?>" <?php selected($font, $key); ?>><?php echo $key; ?></option>
408
+ <?php endforeach; ?>
409
+ </select>
 
410
  </div>
411
+ </div>
412
 
413
+ <div class="form-horizontal__item">
414
+ <label class="form-horizontal__item-label">Widget size:</label>
415
+ <div>
416
+ <?php
417
+ $size = get_option('cht_widget_size'.$this->widget_index);
418
+ $size = empty($size)?54:$size;
419
+ ?>
420
+ <input type="number" min="24" max="100" name="cht_widget_size" class="widget-size__input" data-gramm_editor="false" value="<?php echo esc_attr($size); ?>" />
421
+ <span class="custom-control-label">px</span>
 
 
 
422
  </div>
423
+ </div>
424
 
425
  <div class="form-horizontal__item flex-center">
426
+ <input type="hidden" name="cht_google_analytics" value="0" >
427
  <label class="form-horizontal__item-label"><?php esc_attr_e('Google Analytics', CHT_OPT);?>:</label>
428
  <div>
429
  <label class="switch">
430
  <?php
431
+ $checked = get_option('cht_google_analytics'.$this->widget_index);
432
  ?>
433
  <span class="switch__label"><?php esc_attr_e('Off', CHT_OPT);?></span>
434
+
435
+ <input data-gramm_editor="false" type="checkbox" name="cht_google_analytics" value="1" <?php checked($checked, 1) ?> <?php esc_attr_e($disabled) ?> >
436
  <span class="switch__styled"></span>
437
+ <span class="switch__label"><?php esc_attr_e('On', CHT_OPT);?></span>
438
+ <?php if (!$this->is_pro()): ?><a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">(<?php esc_attr_e('Upgrade to Pro', CHT_OPT); ?>)</a><?php endif ?>
439
  </label>
440
  </div>
441
  </div>
448
  <label class="form-horizontal__item-label">Credit:</label>
449
  <div>
450
  <label class="custom-control custom-checkbox free-custom-checkbox">
451
+ <input type="checkbox" class="custom-control-input" disabled data-gramm_editor="false" />
452
+ <span class="custom-control-label"><?php esc_attr_e('Remove "Get widget" link', CHT_OPT); ?></span>
453
  </label>
454
+ <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">(<?php esc_attr_e('Upgrade to Pro', CHT_OPT); ?>)</a>
455
  </div>
456
  <?php endif; ?>
457
  </div>
458
+ <input type="hidden" id="chaty_site_url" value="<?php echo site_url("/") ?>" >
459
+ <?php $request_data = filter_input_array(INPUT_GET); ?>
460
+ <?php if(isset($request_data['page']) && $request_data['page'] == "chaty-widget-settings") { ?>
461
+ <input type="hidden" name="widget" value="new-widget" >
462
+ <?php } else if(isset($request_data['widget']) && !empty($request_data['widget']) && is_numeric($request_data['widget']) && $request_data['widget'] > 0) { ?>
463
+ <input type="hidden" name="widget" value="<?php esc_attr_e($request_data['widget']) ?>" >
464
+ <?php } ?>
465
  </section>
views/{parts → admin}/help.php RENAMED
@@ -20,7 +20,7 @@
20
  </form>
21
  </div>
22
  <div class="chaty-help-btn">
23
- <a class="chaty-help-tooltip" href="javascript:;"><img src="<?php echo esc_url(CHT_PLUGIN_URL."assets/images/owner.png") ?>" alt="<?php esc_attr_e("Need help?", CHT_OPT) ?>" /></a>
24
  <span class="tooltiptext"><?php esc_attr_e("Need help?", CHT_OPT) ?></span>
25
  </div>
26
  <script>
20
  </form>
21
  </div>
22
  <div class="chaty-help-btn">
23
+ <a class="chaty-help-tooltip" href="javascript:;"><img src="<?php echo esc_url(CHT_PLUGIN_URL."admin/assets/images/owner.png") ?>" alt="<?php esc_attr_e("Need help?", CHT_OPT) ?>" /></a>
24
  <span class="tooltiptext"><?php esc_attr_e("Need help?", CHT_OPT) ?></span>
25
  </div>
26
  <script>
views/{parts/section3.php → admin/launch-section.php} RENAMED
@@ -4,6 +4,7 @@
4
  </h1>
5
 
6
  <div class="form-horizontal">
 
7
  <div class="form-horizontal__item flex-center">
8
  <label class="form-horizontal__item-label"><?php esc_attr_e('Active', CHT_OPT);?>:</label>
9
  <div>
4
  </h1>
5
 
6
  <div class="form-horizontal">
7
+ <input type="hidden" name="cht_active" value="0" >
8
  <div class="form-horizontal__item flex-center">
9
  <label class="form-horizontal__item-label"><?php esc_attr_e('Active', CHT_OPT);?>:</label>
10
  <div>
views/{parts → admin}/trigger-and-target.php RENAMED
@@ -111,7 +111,7 @@ $days = array(
111
  <div class="chaty-date-time-option last" data-index="__count__">
112
  <div class="date-time-content">
113
  <div class="day-select">
114
- <select class="cht-required" id="url_shown_on___count___option">
115
  <?php foreach ($days as $key=>$value) { ?>
116
  <option value="<?php echo esc_attr($key) ?>"><?php echo esc_attr($value) ?></option>
117
  <?php } ?>
@@ -121,19 +121,19 @@ $days = array(
121
  From
122
  </div>
123
  <div class="day-time">
124
- <input type="text" class="cht-required time-picker" value="" id="start_time___count__" />
125
  </div>
126
  <div class="day-label">
127
  To
128
  </div>
129
  <div class="day-time">
130
- <input type="text" class="cht-required time-picker" value="" id="end_time___count__" />
131
  </div>
132
  <div class="day-label">
133
  <span class="gmt-data">GMT</span>
134
  </div>
135
  <div class="day-time">
136
- <select class="cht-required gmt-data" id="url_shown_on___count___option">
137
  <?php for($i=12; $i>=-12;$i--) { ?>
138
  <option <?php selected($i, 0) ?> value="<?php echo esc_attr($i) ?>"><?php echo esc_attr($i>0?"+":"").esc_attr($i) ?></option>
139
  <?php } ?>
@@ -170,13 +170,13 @@ $days = array(
170
  <div class="chaty-page-option">
171
  <div class="url-content">
172
  <div class="url-select">
173
- <select class="cht-required" id="url_shown_on___count___option">
174
  <option value="show_on">Show on</option>
175
  <option value="not_show_on">Don't show on</option>
176
  </select>
177
  </div>
178
  <div class="url-option">
179
- <select class="url-options cht-required" id="url_rules___count___option">
180
  <option selected="selected" disabled value="">Select Rule</option>
181
  </select>
182
  </div>
@@ -184,7 +184,7 @@ $days = array(
184
  <span class='chaty-url'><?php echo esc_url(site_url("/")); ?></span>
185
  </div>
186
  <div class="url-values">
187
- <input type="text" class="cht-required" value="" id="url_rules___count___value" />
188
  </div>
189
  <div class="url-buttons">
190
  <a class="remove-chaty" href="javascript:;">
111
  <div class="chaty-date-time-option last" data-index="__count__">
112
  <div class="date-time-content">
113
  <div class="day-select">
114
+ <select class="cht-free-required" id="url_shown_on___count___option">
115
  <?php foreach ($days as $key=>$value) { ?>
116
  <option value="<?php echo esc_attr($key) ?>"><?php echo esc_attr($value) ?></option>
117
  <?php } ?>
121
  From
122
  </div>
123
  <div class="day-time">
124
+ <input type="text" class="cht-free-required time-picker" value="" id="start_time___count__" />
125
  </div>
126
  <div class="day-label">
127
  To
128
  </div>
129
  <div class="day-time">
130
+ <input type="text" class="cht-free-required time-picker" value="" id="end_time___count__" />
131
  </div>
132
  <div class="day-label">
133
  <span class="gmt-data">GMT</span>
134
  </div>
135
  <div class="day-time">
136
+ <select class="cht-free-required gmt-data" id="url_shown_on___count___option">
137
  <?php for($i=12; $i>=-12;$i--) { ?>
138
  <option <?php selected($i, 0) ?> value="<?php echo esc_attr($i) ?>"><?php echo esc_attr($i>0?"+":"").esc_attr($i) ?></option>
139
  <?php } ?>
170
  <div class="chaty-page-option">
171
  <div class="url-content">
172
  <div class="url-select">
173
+ <select class="cht-free-required" id="url_shown_on___count___option">
174
  <option value="show_on">Show on</option>
175
  <option value="not_show_on">Don't show on</option>
176
  </select>
177
  </div>
178
  <div class="url-option">
179
+ <select class="url-options cht-free-required" id="url_rules___count___option">
180
  <option selected="selected" disabled value="">Select Rule</option>
181
  </select>
182
  </div>
184
  <span class='chaty-url'><?php echo esc_url(site_url("/")); ?></span>
185
  </div>
186
  <div class="url-values">
187
+ <input type="text" class="cht-free-required" value="" id="url_rules___count___value" />
188
  </div>
189
  <div class="url-buttons">
190
  <a class="remove-chaty" href="javascript:;">
views/{update.php → admin/update.php} RENAMED
File without changes
views/{upgrade.php → admin/upgrade.php} RENAMED
@@ -223,12 +223,6 @@
223
  jQuery(this).closest(".rpt_plan").find("a.rpt_foot").attr("href", thisValue);
224
  thisPrice = jQuery(this).find("option:selected").attr("data-price");
225
  jQuery(this).closest(".rpt_plan").find(".rpt_price").text("$"+thisPrice);
226
- /*firstPrice = jQuery(this).find("option:first").attr("data-price");
227
- if(firstPrice == thisPrice) {
228
- jQuery(this).closest(".rpt_plan").removeClass("pro-active");
229
- } else {
230
- jQuery(this).closest(".rpt_plan").addClass("pro-active");
231
- }*/
232
  priceText = jQuery(this).find("option:selected").attr("data-header");
233
  jQuery(this).closest(".rpt_plan").find(".rpt_desc").text(priceText);
234
  });
223
  jQuery(this).closest(".rpt_plan").find("a.rpt_foot").attr("href", thisValue);
224
  thisPrice = jQuery(this).find("option:selected").attr("data-price");
225
  jQuery(this).closest(".rpt_plan").find(".rpt_price").text("$"+thisPrice);
 
 
 
 
 
 
226
  priceText = jQuery(this).find("option:selected").attr("data-header");
227
  jQuery(this).closest(".rpt_plan").find(".rpt_desc").text(priceText);
228
  });
views/modals/token.php DELETED
@@ -1,32 +0,0 @@
1
- <div class="easy-modal" id="token-modal">
2
- <div class="easy-modal-inner">
3
- <button class="easy-modal-close" title="Close">
4
- <svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
5
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(1.5874) rotate(45)" fill="#4F4F4F"/>
6
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(12.6396 1.58742) rotate(135)" fill="#4F4F4F"/>
7
- </svg>
8
- </button>
9
-
10
- <h2><?php esc_attr_e('Activate Pro Plan', CHT_OPT); ?></h2>
11
- <p class="text-center" style="font-size: 17px;">
12
- <?php esc_attr_e('Enter your Pro token to activate all features', CHT_OPT); ?>
13
- </p>
14
- <?php settings_fields($this->plugin_slug); ?>
15
- <div class="form-horizontal__item">
16
- <label><?php esc_attr_e('Token number', CHT_OPT); ?>:</label>
17
- <input type="text" name="cht_license_key" value="<?php esc_attr_e($this->token); ?>" placeholder="XXXXXXXXXXXXXXXXX">
18
- </div>
19
-
20
- <div class="text-center">
21
- <button class="btn-red update_token">
22
- <?php esc_attr_e('Upgrade Now', CHT_OPT); ?>
23
- <svg width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg">
24
- <path d="M17.4674 7.42523L11.8646 0.128021C11.7548 0.128021 11.6449 0 11.4252 0C11.3154 0 11.0956 0 10.9858 0.128021L9.44777 1.92032C9.22806 2.17636 9.22806 2.56042 9.33791 2.81647L11.7548 6.017H0.549289C0.219716 6.017 0 6.27304 0 6.6571V9.21753C0 9.60159 0.219716 9.85763 0.549289 9.85763H11.8646L9.44777 13.0582C9.22806 13.3142 9.22806 13.6983 9.44777 13.9543L11.0956 15.6186C11.2055 15.7466 11.3154 15.7466 11.4252 15.7466C11.5351 15.7466 11.7548 15.6186 11.8646 15.4906L17.4674 8.19336C17.5772 8.06534 17.5772 7.68127 17.4674 7.42523Z" transform="translate(0.701416 18.3653) rotate(-90)" fill="white"/>
25
- </svg>
26
- </button>
27
- </div>
28
- <div class="text-center">
29
- <a href="#" class="easy-modal-link show_up"><?php esc_attr_e('How to get a token?', CHT_OPT); ?></a>
30
- </div>
31
- </div>
32
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/parts/custom-styles.php DELETED
@@ -1,29 +0,0 @@
1
- <style>
2
- #positionPro {
3
- <?php if (get_option('cht_position') === 'custom') : ?>
4
- display: block;
5
- <?php else : ?>
6
- display: none;
7
- <?php endif; ?>
8
- }
9
-
10
- .update-nag{
11
- display: none;
12
- }
13
- #setting-error-settings_updated{
14
- margin: 0 auto;
15
- background: #51F2B8;
16
- left: 37px;
17
- border-left-color: #51F2B8;
18
- }
19
- .none_pro #upgrade-modal{
20
- display: block !important;
21
- position: fixed !important;
22
- z-index: 1000013 !important;
23
- margin-left: -257.5px !important;
24
- margin-top: 0px !important;
25
- }
26
- .none_pro .easy-modal-close{
27
- display: none;
28
- }
29
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/parts/section1.php DELETED
@@ -1,518 +0,0 @@
1
- <div class="preview-section-chaty wrap">
2
- <svg class="read-only" aria-hidden="true" width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <defs>
4
- <linearGradient id="linear-gradient" x1="0.892" y1="0.192" x2="0.128" y2="0.85" gradientUnits="objectBoundingBox">
5
- <stop offset="0" stop-color="#4a64d5"></stop>
6
- <stop offset="0.322" stop-color="#9737bd"></stop>
7
- <stop offset="0.636" stop-color="#f15540"></stop>
8
- <stop offset="1" stop-color="#fecc69"></stop>
9
- </linearGradient>
10
- </defs>
11
- <circle class="color-element" cx="19.5" cy="19.5" r="19.5" fill="url(#linear-gradient)"></circle>
12
- <path id="Path_1923" data-name="Path 1923" d="M13.177,0H5.022A5.028,5.028,0,0,0,0,5.022v8.155A5.028,5.028,0,0,0,5.022,18.2h8.155A5.028,5.028,0,0,0,18.2,13.177V5.022A5.028,5.028,0,0,0,13.177,0Zm3.408,13.177a3.412,3.412,0,0,1-3.408,3.408H5.022a3.411,3.411,0,0,1-3.408-3.408V5.022A3.412,3.412,0,0,1,5.022,1.615h8.155a3.412,3.412,0,0,1,3.408,3.408v8.155Z" transform="translate(10 10.4)" fill="#fff"></path>
13
- <path id="Path_1924" data-name="Path 1924" d="M45.658,40.97a4.689,4.689,0,1,0,4.69,4.69A4.695,4.695,0,0,0,45.658,40.97Zm0,7.764a3.075,3.075,0,1,1,3.075-3.075A3.078,3.078,0,0,1,45.658,48.734Z" transform="translate(-26.558 -26.159)" fill="#fff"></path>
14
- <path id="Path_1925" data-name="Path 1925" d="M120.105,28.251a1.183,1.183,0,1,0,.838.347A1.189,1.189,0,0,0,120.105,28.251Z" transform="translate(-96.119 -14.809)" fill="#fff"></path>
15
- </svg>
16
- <div class="preview" id="admin-preview">
17
- <div class="h2"><span class="header-tooltip"><span class="header-tooltip-text">Please make all your live tests in <a href="https://www.computerworld.com/article/3356840/how-to-go-incognito-in-chrome-firefox-safari-and-edge.html" target="_blank">incognito mode</a>. Some of the features like call to action, attention effect, and trigger will appear for your website visitors just once until they engage with the chat widget, so to emulate it you'll need to use incognito mode</span> <span class="dashicons dashicons-editor-help"></span></span><?php esc_attr_e('Preview', CHT_OPT); ?>:</div>
18
-
19
- <div class="page">
20
- <div class="page-header">
21
- <div class="circle"></div>
22
- <div class="circle"></div>
23
- <div class="circle"></div>
24
- <svg width="33" height="38" viewBox="0 0 33 38" fill="none" xmlns="http://www.w3.org/2000/svg">
25
- <g filter="url(#filter0_d)">
26
- <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 13.0053) scale(1 -1)" fill="#828282"/>
27
- </g>
28
- <g filter="url(#filter1_d)">
29
- <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 15.6891) scale(1 -1)" fill="#828282"/>
30
- </g>
31
- <g filter="url(#filter2_d)">
32
- <ellipse cx="0.855225" cy="0.745508" rx="0.855225" ry="0.745508" transform="translate(15.6492 18.373) scale(1 -1)" fill="#828282"/>
33
- </g>
34
- <defs>
35
- <filter id="filter0_d" x="0.64917" y="0.514328" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
36
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
37
- <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
38
- <feOffset dy="4"/>
39
- <feGaussianBlur stdDeviation="7.5"/>
40
- <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
41
- <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
42
- <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
43
- </filter>
44
- <filter id="filter1_d" x="0.64917" y="3.1981" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
45
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
46
- <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
47
- <feOffset dy="4"/>
48
- <feGaussianBlur stdDeviation="7.5"/>
49
- <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
50
- <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
51
- <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
52
- </filter>
53
- <filter id="filter2_d" x="0.64917" y="5.88202" width="31.7105" height="31.491" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
54
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
55
- <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
56
- <feOffset dy="4"/>
57
- <feGaussianBlur stdDeviation="7.5"/>
58
- <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
59
- <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
60
- <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
61
- </filter>
62
- </defs>
63
- </svg>
64
- </div>
65
-
66
-
67
- <?php $position = $this->get_position_style(); ?>
68
- <div class="page-body">
69
- <?php
70
- $cht_position = get_option("cht_position");
71
- $cht_position = ($cht_position == "custom")?"positionSide":"cht_position";
72
- $cht_position = get_option($cht_position);
73
- $cht_cta = get_option("cht_cta");
74
- $cht_cta = ($cht_cta)?$cht_cta:"Contact Us";
75
- $widget_icon = get_option('widget_icon');
76
- ?>
77
- <div class="chaty-widget chaty-widget-icons-<?php esc_attr_e($cht_position) ?>" style="<?php esc_attr_e($position); ?>">
78
- <div class="icon icon-xs active tooltip-show tooltip" data-title="<?php echo esc_attr($cht_cta) ?>">
79
- <div class="chaty-channels"></div>
80
- <i id="iconWidget">
81
- <?php $bg_color = $this->get_current_color(); ?>
82
- <?php $fill = ($bg_color) ? $bg_color : '#A886CD'; ?>
83
- <?php if ($widget_icon == 'chat-base'): ?>
84
- <svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">
85
- <style type="text/css">
86
- .st1 { fill: #FFFFFF; }
87
- .st0 { fill: #808080; }
88
- </style>
89
- <g>
90
- <circle cx="-469" cy="534.7" r="27" fill="<?php esc_attr_e($fill) ?>" />
91
- </g>
92
- <path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>
93
- <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/>
94
- <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/>
95
- </svg>
96
- <?php endif; ?>
97
- <?php if ($widget_icon == 'chat-smile'): ?>
98
- <svg version="1.1" id="smile" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.8 507.1 54 54" style="enable-background:new -496.8 507.1 54 54;" xml:space="preserve" >
99
- <style type="text/css">
100
- .st1 { fill: #FFFFFF; }
101
- .st2 { fill: none; stroke: #808080; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
102
- </style>
103
- <g>
104
- <circle cx="-469.8" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
105
- </g>
106
- <path class="st1" d="M-459.5,523.5H-482c-2.1,0-3.7,1.7-3.7,3.7v13.1c0,2.1,1.7,3.7,3.7,3.7h19.3l5.4,5.4c0.2,0.2,0.4,0.2,0.7,0.2 c0.2,0,0.2,0,0.4,0c0.4-0.2,0.6-0.6,0.6-0.9v-21.5C-455.8,525.2-457.5,523.5-459.5,523.5z"/>
107
- <path class="st2" d="M-476.5,537.3c2.5,1.1,8.5,2.1,13-2.7"/>
108
- <path class="st2" d="M-460.8,534.5c-0.1-1.2-0.8-3.4-3.3-2.8"/>
109
- </svg>
110
- <?php endif; ?>
111
- <?php if ($widget_icon == 'chat-bubble'): ?>
112
- <?php $fill = ($bg_color) ? $bg_color : '#A886CD'; ?>
113
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496.9 507.1 54 54" style="enable-background:new -496.9 507.1 54 54;" xml:space="preserve">
114
- <style type="text/css">.st1 {
115
- fill: #FFFFFF;
116
- }</style>
117
- <g>
118
- <circle cx="-469.9" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
119
- </g>
120
- <path class="st1" d="M-472.6,522.1h5.3c3,0,6,1.2,8.1,3.4c2.1,2.1,3.4,5.1,3.4,8.1c0,6-4.6,11-10.6,11.5v4.4c0,0.4-0.2,0.7-0.5,0.9 c-0.2,0-0.2,0-0.4,0c-0.2,0-0.5-0.2-0.7-0.4l-4.6-5c-3,0-6-1.2-8.1-3.4s-3.4-5.1-3.4-8.1C-484.1,527.2-478.9,522.1-472.6,522.1z M-462.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-464.6,534.6-463.9,535.3-462.9,535.3z M-469.9,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-471.7,534.6-471,535.3-469.9,535.3z M-477,535.3c1.1,0,1.8-0.7,1.8-1.8c0-1.1-0.7-1.8-1.8-1.8c-1.1,0-1.8,0.7-1.8,1.8C-478.8,534.6-478.1,535.3-477,535.3z"/>
121
- </svg>
122
- <?php endif; ?>
123
- <?php if ($widget_icon == 'chat-db'): ?>
124
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.1 54 54" style="enable-background:new -496 507.1 54 54;" xml:space="preserve">
125
- <style type="text/css">.st1 {
126
- fill: #FFFFFF;
127
- }</style>
128
- <g>
129
- <circle cx="-469" cy="534.1" r="27" fill="<?php esc_attr_e($fill) ?>"/>
130
- </g>
131
- <path class="st1" d="M-464.6,527.7h-15.6c-1.9,0-3.5,1.6-3.5,3.5v10.4c0,1.9,1.6,3.5,3.5,3.5h12.6l5,5c0.2,0.2,0.3,0.2,0.7,0.2 c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18.2C-461.1,529.3-462.7,527.7-464.6,527.7z"/>
132
- <path class="st1" d="M-459.4,522.5H-475c-1.9,0-3.5,1.6-3.5,3.5h13.9c2.9,0,5.2,2.3,5.2,5.2v11.6l1.9,1.9c0.2,0.2,0.3,0.2,0.7,0.2 c0.2,0,0.2,0,0.3,0c0.3-0.2,0.5-0.5,0.5-0.9v-18C-455.9,524.1-457.5,522.5-459.4,522.5z"/>
133
- </svg>
134
- <?php endif; ?>
135
- <?php if ($widget_icon == 'chat-image'): ?>
136
- <img src="<?php echo esc_url($this->getCustomWidgetImg()); ?>"/>
137
- <?php else: ?>
138
- <style type="text/css">.st1 {fill: #FFFFFF;}.st0{fill: #a886cd;}</style>
139
- <g>
140
- <circle cx="-469" cy="534.7" r="27" fill="<?php esc_attr_e($fill) ?>"/>
141
- </g>
142
- <path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>
143
- <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,530.8-478.2,530.5-477.7,530.5z"/>
144
- <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0C-478.6,533.9-478.2,533.5-477.7,533.5z"/>
145
- </svg>
146
- <?php endif; ?>
147
- </i>
148
- <i class="chaty-close-icon">
149
- <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
150
- </i>
151
- <?php
152
- $display_status = get_option("cht_cta");
153
- $display_status = ($display_status)?"block":"none";
154
- $cta = nl2br(get_option('cht_cta'));
155
- $cta = str_replace(array("\r", "\n"), "", $cta);
156
- ?>
157
- <span class="tooltiptext" style='display:<?php esc_attr_e($display_status) ?>'><span><?php esc_attr_e($cta); ?></span></span>
158
- </div>
159
-
160
- </div>
161
- </div>
162
- </div>
163
- <div class="switch-preview">
164
- <input data-gramm_editor="false" type="radio" id="previewDesktop" name="switchPreview" class="js-switch-preview switch-preview__input" checked="checked">
165
- <label for="previewDesktop" class="switch-preview__label switch-preview__desktop">
166
- <?php esc_attr_e('Desktop', CHT_OPT); ?>
167
- </label>
168
- <input data-gramm_editor="false" type="radio" id="previewMobile" name="switchPreview" class="js-switch-preview switch-preview__input">
169
- <label for="previewMobile" class="switch-preview__label switch-preview__mobile">
170
- <?php esc_attr_e('Mobile', CHT_OPT); ?>
171
- </label>
172
- </div>
173
- </div>
174
- </div>
175
- <?php $pro_id = $this->is_pro()?"pro":""; ?>
176
- <section class="section one chaty-setting-form" id="<?php esc_attr_e($pro_id) ?>" xmlns="http://www.w3.org/1999/html">
177
- <h1 class="section-title">
178
- <strong><?php esc_attr_e('Step', CHT_OPT); ?> 1:</strong> <?php esc_attr_e('Choose your channels', CHT_OPT); ?>
179
- </h1>
180
- <?php $social_app = get_option('cht_numb_slug'); ?>
181
- <?php $social_app = explode(",", $social_app); ?>
182
- <?php $social_app = array_unique($social_app); ?>
183
-
184
- <div class="channels-icons">
185
- <?php if ($this->socials) : ?>
186
- <?php foreach ($this->socials as $key => $social) : ?>
187
- <?php
188
- $value = get_option('cht_social_' . $social['slug']);
189
- $slug = strtolower($this->del_space($social['slug']));
190
- ?>
191
- <div class="icon icon-sm <?php echo esc_attr($channel_class) ?>
192
- <?php foreach ($social_app as $key_soc): ?>
193
- <?php if ($key_soc == $social['slug']) { ?>
194
- active
195
- <?php } ?>
196
- <?php endforeach; ?>"
197
- data-social="<?php echo esc_attr($social['slug']); ?>" data-label="<?php echo esc_attr($social['title']); ?>" data-title="<?php echo esc_attr($social['slug']); ?>">
198
- <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
199
- <?php echo $social['svg']; ?>
200
- </svg>
201
- </div>
202
- <?php endforeach; ?>
203
- <?php endif; ?>
204
- </div>
205
- <div class="popover" >
206
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl()); ?>">
207
- <?php esc_attr_e('Get unlimited channels in the Pro plan', CHT_OPT); ?>
208
- <strong><?php esc_attr_e('Upgrade Now', CHT_OPT); ?></strong>
209
- </a>
210
- </div>
211
- <input data-gramm_editor="false" type="text" class="add_slug" name="cht_numb_slug" placeholder="test" value="<?php esc_attr_e(get_option('cht_numb_slug')); ?>" id="cht_numb_slug" hidden>
212
-
213
- <div class="channels-selected" id="channels-selected-list">
214
- <ul id="channels-selected-list" class="channels-selected-list channels-selected">
215
- <?php if ($this->socials) :
216
- $social = get_option('cht_numb_slug'); ?>
217
- <?php $social = explode(",", $social); ?>
218
- <?php $social = array_unique($social); ?>
219
- <?php foreach ($social as $key_soc): ?>
220
- <?php foreach ($this->socials as $key => $social) : ?>
221
- <?php if ($social['slug'] != $key_soc) {
222
- continue;
223
- } ?>
224
- <?php $value = get_option('cht_social_' . $social['slug']) ?>
225
- <?php
226
- if (empty($value)) {
227
- $value = [
228
- 'value' => '',
229
- 'is_mobile' => 'checked',
230
- 'is_desktop' => 'checked'
231
- ];
232
- }
233
- $value['title'] = $social['title'];
234
- $status = 0;
235
- if(!isset($value['bg_color']) || empty($value['bg_color'])) {
236
- $value['bg_color'] = $social['color']; // Initialize background color value if not exists. 2.1.0 change
237
- }
238
- if(!isset($value['image_id'])) {
239
- $value['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change
240
- }
241
- if(!isset($value['title']) || $value['title'] == "") {
242
- $value['title'] = $social['title']; // Initialize title if not exists. 2.1.0 change
243
- }
244
- if(!isset($value['fa_icon'])) {
245
- $value['fa_icon'] = ""; // Initialize title if not exists. 2.1.0 change
246
- }
247
- if($social['slug'] == "Whatsapp"){
248
- $val = $value['value'];
249
- $val = str_replace("+","", $val);
250
- $value['value'] = $val;
251
- } else if($social['slug'] == "Facebook_Messenger"){
252
- $val = $value['value'];
253
- $val = str_replace("facebook.com","m.me", $val);
254
- $val = str_replace("www.","", $val);
255
- $value['value'] = $val;
256
-
257
- $val = trim($val, "/");
258
- $val_array = explode("/", $val);
259
- $total = count($val_array)-1;
260
- $last_value = $val_array[$total];
261
- $last_value = explode("-", $last_value);
262
- $total_text = count($last_value)-1;
263
- $total_text = $last_value[$total_text];
264
-
265
- if(is_numeric($total_text)) {
266
- $val_array[$total] = $total_text;
267
- $value['value'] = implode("/", $val_array);
268
- }
269
- }
270
- $image_url = plugin_dir_url("")."/chaty/assets/images/move-icon.png";
271
- $is_pro = ($this->is_pro()) ? 'pro' : 'free';
272
- $img_active = ($status)?"img-active":"";
273
- ?>
274
- <li data-id="<?php echo esc_attr($social['slug']) ?>" id="chaty-social-<?php echo esc_attr($social['slug']) ?>">
275
- <div class="channels-selected__item <?php esc_attr_e($img_active) ?> <?php esc_attr_e($is_pro); ?> 1 available">
276
- <div class="chaty-default-settings">
277
- <div class="move-icon">
278
- <img src="<?php echo esc_url($image_url) ?>" >
279
- </div>
280
- <div class="icon icon-md active" data-label="<?php echo esc_attr($social['title']); ?>" data-title="<?php echo esc_attr($social['title']); ?>">
281
- <span class="default-chaty-icon custom-icon-<?php echo esc_attr($social['slug']) ?> default_image_<?php echo esc_attr($social['slug']) ?>" >
282
- <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
283
- <?php echo $social['svg']; ?>
284
- </svg>
285
- </span>
286
- </div>
287
- <div class="channels__input-box">
288
- <input type="text" class="channels__input" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php esc_attr_e($value['value']); ?>" data-gramm_editor="false" id="<?php echo esc_attr($social['slug']); ?>" >
289
- </div>
290
- <?php
291
- $channel_id = $this->del_space($social['slug']);
292
- $channel_id = str_replace(' ', '_', $channel_id);
293
- $channel_slug = strtolower($channel_id);
294
- $is_desktop = isset($value['is_desktop']) ? $value['is_desktop'] : '';
295
- $is_mobile = isset($value['is_mobile']) ? $value['is_mobile'] : '';
296
- ?>
297
- <div>
298
- <label class="channels__view" for="<?php echo esc_attr($channel_slug); ?>Desktop">
299
- <input type="checkbox"
300
- id="<?php echo esc_attr($channel_slug); ?>Desktop"
301
- class="channels__view-check js-chanel-icon js-chanel-desktop"
302
- data-type="<?php echo esc_attr($social['title']); ?>"
303
- name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_desktop]"
304
- value="checked"
305
- data-gramm_editor="false"
306
- <?php esc_attr_e($is_desktop); ?>
307
- >
308
- <span class="channels__view-txt">Desktop</label>
309
- </label>
310
- <label class="channels__view"
311
- for="<?php echo esc_attr($channel_slug); ?>Mobile">
312
- <input type="checkbox"
313
- id="<?php echo esc_attr($channel_slug); ?>Mobile"
314
- class="channels__view-check js-chanel-icon js-chanel-mobile"
315
- data-type="<?php echo esc_attr($social['title']); ?>"
316
- name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_mobile]"
317
- value="checked"
318
- data-gramm_editor="false"
319
- <?php esc_attr_e($is_mobile); ?>
320
- >
321
- <span class="channels__view-txt">Mobile</span>
322
- </label>
323
- </div>
324
- <div class="chaty-settings" onclick="toggle_chaty_setting('<?php echo esc_attr($social['slug']); ?>')">
325
- <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
326
- </div>
327
- <div class="input-example">
328
- <?php esc_attr_e('For example', CHT_OPT); ?>: <?php esc_attr_e($social['example']); ?>
329
- </div>
330
- <?php if((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) { ?>
331
- <div class="viber-help">
332
- <?php if(isset($social['help_link'])) { ?>
333
- <?php $help_text = isset($social['help_title'])?$social['help_title']:"Doesn't work?"; ?>
334
- <a href="<?php echo esc_url($social['help_link']) ?>" target="_blank"><?php esc_attr_e($help_text); ?></a>
335
- <?php } else { ?>
336
- <?php $help_text = isset($social['help_title'])?$social['help_title']:"Doesn't work?"; ?>
337
- <span><?php echo $social['help']; ?></span>
338
- <?php esc_attr_e($help_text); ?>
339
- <?php } ?>
340
- </div>
341
- <?php } ?>
342
- </div>
343
- <div class="chaty-advance-settings">
344
- <div class="chaty-setting-col">
345
- <label>Icon Appearance</label>
346
- <div>
347
- <input type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[bg_color]" class="chaty-color-field" value="<?php esc_attr_e($value['bg_color']) ?>" />
348
- <div class="pro-features">
349
- <div class="pro-item">
350
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" class="upload-chaty-icon"><span class="dashicons dashicons-upload"></span> Custom Image</a>
351
- </div>
352
- <div class="pro-button">
353
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
354
- </div>
355
- </div>
356
- </div>
357
- </div>
358
- <div class="clear clearfix"></div>
359
- <div class="chaty-setting-col">
360
- <label>On Hover Text</label>
361
- <div>
362
- <input type="text" class="chaty-title" name="cht_social_<?php echo esc_attr($social['slug']); ?>[title]" value="<?php esc_attr_e($value['title']) ?>">
363
- </div>
364
- </div>
365
- <div class="clear clearfix"></div>
366
- <?php if($social['slug'] == "Whatsapp") {
367
- $pre_set_message = isset($value['pre_set_message'])?$value['pre_set_message']:"";
368
- ?>
369
- <div class="clear clearfix"></div>
370
- <div class="chaty-setting-col">
371
- <label>Pre Set Message</label>
372
- <div>
373
- <div class="pro-features">
374
- <div class="pro-item">
375
- <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="<?php esc_attr_e($pre_set_message) ?>" >
376
- </div>
377
- <div class="pro-button">
378
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
379
- </div>
380
- </div>
381
- </div>
382
- </div>
383
- <?php } else if($social['slug'] == "Email") { ?>
384
- <div class="clear clearfix"></div>
385
- <div class="chaty-setting-col">
386
- <label>Mail Subject</label>
387
- <div>
388
- <div class="pro-features">
389
- <div class="pro-item">
390
- <input disabled id="cht_social_message_<?php echo esc_attr($social['slug']); ?>" type="text" name="" value="" >
391
- </div>
392
- <div class="pro-button">
393
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
394
- </div>
395
- </div>
396
- </div>
397
- </div>
398
- <?php } else if($social['slug'] == "WeChat") { ?>
399
- <div class="clear clearfix"></div>
400
- <div class="chaty-setting-col">
401
- <label>Upload QR Code</label>
402
- <div>
403
- <a class="cht-upload-image" id="upload_qr_code" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>" >
404
- <span class="dashicons dashicons-upload"></span>
405
- </a>
406
- <a target="_blank" href="<?php echo esc_url($this->getUpgradeMenuItemUrl());?>"><?php esc_attr_e('Upgrade to Pro', CHT_OPT);?></a>
407
- </div>
408
- </div>
409
- <?php } else if($social['slug'] == "Link" || $social['slug'] == "Custom_Link") {
410
- $is_checked = (!isset($value['new_window']) || $value['new_window'] == 1)?1:0;
411
- ?>
412
- <!-- Advance setting for Custom Link -->
413
- <div class="clear clearfix"></div>
414
- <div class="chaty-setting-col">
415
- <label >Open In a New Tab</label>
416
- <div>
417
- <input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="0" >
418
- <label class="channels__view" for="cht_social_window_<?php echo esc_attr($social['slug']); ?>">
419
- <input id="cht_social_window_<?php echo esc_attr($social['slug']); ?>" type="checkbox" class="channels__view-check" name="cht_social_<?php echo esc_attr($social['slug']); ?>[new_window]" value="1" <?php checked($is_checked, 1) ?> >
420
- <span class="channels__view-txt">&nbsp;</span>
421
- </label>
422
- </div>
423
- </div>
424
- <?php } else if($social['slug'] == "Linkedin") {
425
- $is_checked = isset($value['link_type'])?$value['link_type']:"personal";
426
- ?>
427
- <!-- Advance setting for Custom Link -->
428
- <div class="clear clearfix"></div>
429
- <div class="chaty-setting-col">
430
- <label >LinkedIn</label>
431
- <div>
432
- <label>
433
- <input type="radio" <?php checked($is_checked, "personal") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="personal">
434
- Personal
435
- </label>
436
- <label>
437
- <input type="radio" <?php checked($is_checked, "company") ?> name="cht_social_<?php echo esc_attr($social['slug']); ?>[link_type]" value="company">
438
- Company
439
- </label>
440
- </div>
441
- </div>
442
- <?php } ?>
443
- <!--<div class="chaty-pro-feature">
444
- <a target="_blank" href="<?php /*echo esc_url($this->getUpgradeMenuItemUrl()); */?>">
445
- <?php /*esc_attr_e('Upgrade to Pro', CHT_OPT);*/?>
446
- </a>
447
- </div>-->
448
- </div>
449
- <button class="btn-cancel" data-social="<?php echo esc_attr($social['slug']); ?>">
450
- <svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
451
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
452
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
453
- </svg>
454
- </button>
455
- </div>
456
- </li>
457
- <?php endforeach; ?>
458
- <?php endforeach?>
459
- <?php endif; ?>
460
- <?php
461
- $is_pro = $this->is_pro();
462
- $pro_class = ($is_pro)?"pro":"free";
463
- $text = get_option("cht_close_button_text");
464
- $text = ($text === false)?"Hide":$text;
465
- ?>
466
- <li class="chaty-cls-setting" id="chaty-social-close">
467
- <div class="channels-selected__item <?php esc_attr_e($pro_class) ?> 1 available">
468
- <div class="chaty-default-settings">
469
- <div class="move-icon">
470
- <?php $icon_url = plugins_url("")."/chaty/assets/images/move-icon.png" ?>
471
- <img src="<?php echo esc_url($icon_url) ?>" style="opacity:0"; />
472
- </div>
473
- <div class="icon icon-md active" data-title="close">
474
- <span id="image_data_close">
475
- <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
476
- </span>
477
- <span class="default_image_close" style="display: none;">
478
- <svg viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><ellipse cx="26" cy="26" rx="26" ry="26" fill="#A886CD"></ellipse><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(18.35 15.6599) scale(0.998038 1.00196) rotate(45)" fill="white"></rect><rect width="27.1433" height="3.89857" rx="1.94928" transform="translate(37.5056 18.422) scale(0.998038 1.00196) rotate(135)" fill="white"></rect></svg>
479
- </span>
480
- </div>
481
- <div class="channels__input-box cls-btn-settings">
482
- <input type="text" class="channels__input" name="cht_close_button_text" value="<?php echo esc_attr($text) ?>" data-gramm_editor="false" >
483
- </div>
484
- <div class="chaty-settings cls-btn">
485
- <a href="javascript:;"><span class="dashicons dashicons-admin-generic"></span></a>
486
- </div>
487
- <div class="input-example cls-btn-settings">
488
- <?php esc_attr_e('On hover Close button text', CHT_OPT); ?>
489
- </div>
490
- </div>
491
- <button class="btn-cancel close-btn-set" data-social="<?php echo esc_attr($social['slug']); ?>">
492
- <svg width="14" height="13" viewBox="0 0 14 13" fill="none"
493
- xmlns="http://www.w3.org/2000/svg">
494
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(2.26764 0.0615997) rotate(45)" fill="white"/>
495
- <rect width="15.6301" height="2.24494" rx="1.12247" transform="translate(13.3198 1.649) rotate(135)" fill="white"/>
496
- </svg>
497
- </button>
498
- </div>
499
- </li>
500
- </ul>
501
- <div class="clear clearfix"></div>
502
- <div class="channels-selected__item disabled" >
503
- </div>
504
- </div>
505
- <button class="btn-save-sticky">
506
- <span><?php esc_attr_e('Save', CHT_OPT); ?></span>
507
- <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
508
- <path
509
- d="M21.5 0.5H0.5V27.5H27.5V6.5L21.5 0.5ZM14 24.5C11.51 24.5 9.5 22.49 9.5 20C9.5 17.51 11.51 15.5 14 15.5C16.49 15.5 18.5 17.51 18.5 20C18.5 22.49 16.49 24.5 14 24.5ZM18.5 9.5H3.5V3.5H18.5V9.5Z"
510
- fill="white"/>
511
- </svg>
512
- </button>
513
- <a class="btn-help"><?php esc_attr_e('help', CHT_OPT); ?><span>?</span></a>
514
- </section>
515
- <script>
516
- var PRO_PLUGIN_URL = "<?php echo esc_url(CHT_PRO_URL) ?>";
517
- </script>
518
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/widget.php CHANGED
@@ -1,26 +1,55 @@
1
  <?php
2
- $social_channels = $this->int_arr();
 
3
  $cht_active = get_option("cht_active");
4
- $bg_color = $this->get_current_color();
5
- $len = count($social_channels);
6
- $cta = $this->getCallToAction();
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- $current_count = get_option("chaty_total_channel_click");
10
- if($current_count === false || empty($current_count)) {
11
- $current_count = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
13
- $current_count = intval($current_count);
14
- $save_user_clicks = ($current_count < 35)?"1":"0";
15
-
16
- $positionSide = get_option('positionSide');
17
- $cht_bottom_spacing = get_option('cht_bottom_spacing');
18
- $cht_side_spacing = get_option('cht_side_spacing');
19
- $cht_widget_size = get_option('cht_widget_size');
20
- $cta = str_replace("'","&#39;",$cta);
21
- $cta = str_replace('"',"&#34;",$cta);
22
  $font_family = get_option('cht_widget_font');
23
-
24
 
25
  $animation_class = get_option("chaty_attention_effect");
26
  $animation_class = empty($animation_class)?"":$animation_class;
@@ -45,47 +74,86 @@ $state = empty($state)?"click":$state;
45
 
46
  $has_close_button = get_option("cht_close_button");
47
  $has_close_button = empty($has_close_button)?"yes":$has_close_button;
48
- $button_text = get_option("cht_close_button_text");
49
- $button_text = ($button_text === false)?"Hide":$button_text;
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  $settings = array();
52
  $settings['isPRO'] = 0;
53
- $settings['position'] = get_option('cht_position');
54
- $settings['social'] = $social_channels;
55
- $settings['pos_side'] = empty($positionSide) ? 'right' : $positionSide;
56
- $settings['bot'] = ($cht_bottom_spacing) ? $cht_bottom_spacing : '25';
57
- $settings['side'] = ($cht_side_spacing) ? $cht_side_spacing : '25';
58
  $settings['device'] = $this->device();
59
- $settings['color'] = ($bg_color) ? $bg_color : '#A886CD';;
60
- $settings['widget_size'] = ($cht_widget_size) ? $cht_widget_size: '54';
61
  $settings['widget_type'] = get_option('widget_icon');
62
  $settings['widget_img'] = $this->getCustomWidgetImg();
63
- $settings['cta'] = wp_slash($cta);
64
  $settings['link_active'] = get_option('cht_credit');
65
- $settings['save_user_clicks'] = $save_user_clicks;
66
- $settings['isMobile'] = (wp_is_mobile())?"1":"0";
67
- $settings['is_mobile'] = (wp_is_mobile())?"1":"0";
 
 
 
68
  $settings['ajax_url'] = admin_url('admin-ajax.php');
69
- $settings['active'] = ($cht_active && $len > 0 && $len < 3) ? "true" : "false";
70
  $settings['animation_class'] = $animation_class;
71
  $settings['time_trigger'] = $time_trigger;
72
  $settings['trigger_time'] = $trigger_time;
73
  $settings['exit_intent'] = $exit_intent;
74
  $settings['on_page_scroll'] = $on_page_scroll;
75
  $settings['page_scroll'] = $page_scroll;
 
 
 
76
  $settings['display_state'] = $state;
77
  $settings['has_close_button'] = $has_close_button;
78
- $settings['button_text'] = $button_text;
79
  $data = array();
80
  $data['object_settings'] = $settings;
81
- //echo "<pre>"; print_r($settings['social']); die;
82
- if($len > 0 && $len < 3) {
83
- ob_start()
84
- ?>
85
- <style>
 
 
 
 
 
 
 
 
 
86
  .chaty-widget-is a{display: block; margin:0; padding:0; }
87
  .chaty-widget-is svg{margin:0; padding:0;}
88
- .chaty-widget.one_widget .chaty-get-btn {padding-top: 5px;}
89
  .chaty-main-widget { display: none; }
90
  .chaty-in-desktop .chaty-main-widget.is-in-desktop { display: block; }
91
  .chaty-in-mobile .chaty-main-widget.is-in-mobile { display: block; }
@@ -96,22 +164,25 @@ if($len > 0 && $len < 3) {
96
  .chaty-widget { font-family: <?php echo esc_attr($font_family) ?>; }
97
  <?php } ?>
98
  <?php foreach($settings['social'] as $social) {
99
- if(!empty($social['color']) && $social['color'] != "#ffffff") {?>
100
- .facustom-icon.chaty-btn-<?php echo esc_attr($social['slug']) ?> {background-color: <?php echo esc_attr($social['color']) ?>}
101
- .chaty-<?php echo esc_attr($social['slug']) ?> .color-element {fill: <?php echo esc_attr($social['color']) ?>}
102
- <?php }
 
103
  } ?>
 
104
  body div.chaty-widget.hide-widget { display: none !important; }
105
- </style>
106
- <?php
107
- echo ob_get_clean();
 
 
 
108
  if(!empty($font_family)) {
109
- wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family='.urlencode($font_family), false );
110
  }
111
- wp_enqueue_style( 'chaty-front-css', CHT_PLUGIN_URL."assets/css/chaty-front.css", array(), CHT_VERSION);
112
- wp_enqueue_script("chaty-front-end", CHT_PLUGIN_URL."assets/js/cht-front-script.js", array('jquery'), CHT_VERSION, '1.0', true);
113
  wp_localize_script('chaty-front-end', 'chaty_settings', $data);
114
- ?>
115
- <?php
116
  }
117
  ?>
1
  <?php
2
+ /* Initialize widget if widget is enable for current page */
3
+ $social = $this->get_social_icon_list(); // get active icon list
4
  $cht_active = get_option("cht_active");
 
 
 
5
 
6
+ //$bg_color = $this->get_current_color();
7
+ // get custom background color for widget
8
+ $def_color = get_option('cht_color' );
9
+ $custom_color = get_option('cht_custom_color' ); // checking for custom color
10
+ if (!empty($custom_color)) {
11
+ $color = $custom_color;
12
+ } else {
13
+ $color = $def_color;
14
+ }
15
+ $bg_color = strtoupper($color);
16
+
17
+ $len = count($social); // get total active channels
18
+ $cta =nl2br(get_option('cht_cta'));
19
+ $cta = str_replace(array("\r","\n"),"",$cta);
20
+ $cta = esc_attr__(wp_unslash($cta));
21
+
22
+ $isPro = get_option('cht_token'); // is PRO version
23
+ $isPro = (empty($isPro) || $isPro == null)?0:1;
24
 
25
+ $positionSide = get_option('positionSide'); // get widget position
26
+ $cht_bottom_spacing = get_option('cht_bottom_spacing'); // get widget position from bottom
27
+ $cht_side_spacing = get_option('cht_side_spacing'); // get widget position from left/Right
28
+ $cht_widget_size = get_option('cht_widget_size'); // get widget size
29
+ $positionSide = empty($positionSide) ? 'right' : $positionSide; // Initialize widget position if not exists
30
+ $cht_side_spacing = ($cht_side_spacing) ? $cht_side_spacing : '25'; // Initialize widget from left/Right if not exists
31
+ $cht_widget_size = ($cht_widget_size) ? $cht_widget_size : '54'; // Initialize widget size if not exists
32
+ $position = get_option('cht_position');
33
+ $position = ($position) ? $position : 'right'; // Initialize widget position if not exists
34
+ $total = $cht_side_spacing+$cht_widget_size+$cht_side_spacing;
35
+ $cht_bottom_spacing = ($cht_bottom_spacing) ? $cht_bottom_spacing : '25'; // Initialize widget bottom position if not exists
36
+ $cht_side_spacing = ($cht_side_spacing) ? $cht_side_spacing : '25'; // Initialize widget left/Right position if not exists
37
+ $image_id = "";
38
+ $imageUrl = plugin_dir_url("")."chaty-pro/admin/assets/images/chaty-default.png"; // Initialize default image
39
+ $analytics = get_option("cht_google_analytics"); // check for google analytics enable or not
40
+ $analytics = empty($analytics)?0:$analytics; // Initialize google analytics flag to 0 if not data not exists
41
+ $text = get_option("cht_close_button_text"); // close button settings
42
+ $close_text = ($text === false)?"Hide":$text;
43
+
44
+ $imageUrl = "";
45
+ if($image_id != "") {
46
+ $image_data = wp_get_attachment_image_src($image_id, "full");
47
+ if(!empty($image_data) && is_array($image_data)) {
48
+ $imageUrl = $image_data[0]; // change close button image if exists
49
+ }
50
  }
 
 
 
 
 
 
 
 
 
51
  $font_family = get_option('cht_widget_font');
52
+ /* add inline css for custom position */
53
 
54
  $animation_class = get_option("chaty_attention_effect");
55
  $animation_class = empty($animation_class)?"":$animation_class;
74
 
75
  $has_close_button = get_option("cht_close_button");
76
  $has_close_button = empty($has_close_button)?"yes":$has_close_button;
 
 
77
 
78
+ $display_days = get_option("cht_date_and_time_settings");
79
+ $display_rules = array();
80
+
81
+ $gmt = "";
82
+ if(!empty($display_days)) {
83
+ $count = 0;
84
+ foreach ($display_days as $key=>$value) {
85
+ if($count == 0) {
86
+ $gmt = intval($value['gmt']);
87
+ $count++;
88
+ }
89
+ $record = array();
90
+ $record['days'] = $value['days']-1;
91
+ $record['start_time'] = $value['start_time'];
92
+ $record['start_hours'] = intval(date("G",strtotime(date("Y-m-d ".$value['start_time']))));
93
+ $record['start_min'] = intval(date("i",strtotime(date("Y-m-d ".$value['start_time']))));
94
+ $record['end_time'] = $value['end_time'];
95
+ $record['end_hours'] = intval(date("G",strtotime(date("Y-m-d ".$value['end_time']))));
96
+ $record['end_min'] = intval(date("i",strtotime(date("Y-m-d ".$value['end_time']))));
97
+ $display_rules[] = $record;
98
+ }
99
+ }
100
+ $display_conditions = 0;
101
+ if(!empty($display_rules)) {
102
+ $display_conditions = 1;
103
+ }
104
+
105
+
106
+ /* widget setting array */
107
  $settings = array();
108
  $settings['isPRO'] = 0;
109
+ $settings['position'] = $position;;
110
+ $settings['social'] = $this->get_social_icon_list();
111
+ $settings['pos_side'] = $positionSide;
112
+ $settings['bot'] = $cht_bottom_spacing;
113
+ $settings['side'] = $cht_side_spacing;
114
  $settings['device'] = $this->device();
115
+ $settings['color'] = ($bg_color) ? $bg_color : '#A886CD';
116
+ $settings['widget_size'] = $cht_widget_size;
117
  $settings['widget_type'] = get_option('widget_icon');
118
  $settings['widget_img'] = $this->getCustomWidgetImg();
119
+ $settings['cta'] = $cta;
120
  $settings['link_active'] = get_option('cht_credit');
121
+ $settings['active'] = ($cht_active && $len >= 1) ? 'true' : 'false';
122
+ $settings['close_text'] = $close_text;
123
+ $settings['analytics'] = $analytics;
124
+ $settings['save_user_clicks'] = 0;
125
+ $settings['close_img'] = "";
126
+ $settings['is_mobile'] = (wp_is_mobile())?1:0;
127
  $settings['ajax_url'] = admin_url('admin-ajax.php');
 
128
  $settings['animation_class'] = $animation_class;
129
  $settings['time_trigger'] = $time_trigger;
130
  $settings['trigger_time'] = $trigger_time;
131
  $settings['exit_intent'] = $exit_intent;
132
  $settings['on_page_scroll'] = $on_page_scroll;
133
  $settings['page_scroll'] = $page_scroll;
134
+ $settings['gmt'] = $gmt;
135
+ $settings['display_conditions'] = $display_conditions;
136
+ $settings['display_rules'] = $display_rules;
137
  $settings['display_state'] = $state;
138
  $settings['has_close_button'] = $has_close_button;
 
139
  $data = array();
140
  $data['object_settings'] = $settings;
141
+ ob_start();
142
+ ?>
143
+ <style>
144
+ <?php if($position == "left") { ?>
145
+ #wechat-qr-code{left: {<?php esc_attr_e($total) ?>}px; right:auto;}
146
+ <?php } else if($position == "right") { ?>
147
+ #wechat-qr-code{right: {<?php esc_attr_e($total) ?>}px; left:auto;}
148
+ <?php } else if($position == "custom") { ?>
149
+ <?php if($positionSide == "left") { ?>
150
+ #wechat-qr-code{left: {<?php esc_attr_e($total) ?>}px; right:auto;}
151
+ <?php } else { ?>
152
+ #wechat-qr-code{right: {<?php esc_attr_e($total) ?>}px; left:auto;}
153
+ <?php } ?>
154
+ <?php } ?>
155
  .chaty-widget-is a{display: block; margin:0; padding:0; }
156
  .chaty-widget-is svg{margin:0; padding:0;}
 
157
  .chaty-main-widget { display: none; }
158
  .chaty-in-desktop .chaty-main-widget.is-in-desktop { display: block; }
159
  .chaty-in-mobile .chaty-main-widget.is-in-mobile { display: block; }
164
  .chaty-widget { font-family: <?php echo esc_attr($font_family) ?>; }
165
  <?php } ?>
166
  <?php foreach($settings['social'] as $social) {
167
+ if(!empty($social['bg_color']) && $social['bg_color'] != "#ffffff") {
168
+ ?>
169
+ .facustom-icon.chaty-btn-<?php echo esc_attr($social['social_channel']) ?> {background-color: <?php echo esc_attr($social['bg_color']) ?>}
170
+ .chaty-<?php echo esc_attr($social['social_channel']) ?> .color-element {fill: <?php echo esc_attr($social['bg_color']) ?>}
171
+ <?php }
172
  } ?>
173
+ /*.chaty-widget-i-title.hide-it { display: none !important; }*/
174
  body div.chaty-widget.hide-widget { display: none !important; }
175
+ </style>
176
+ <?php
177
+ echo ob_get_clean();
178
+
179
+ if($len >= 1 && !empty($settings['social'])) {
180
+ /* add js for front end widget */
181
  if(!empty($font_family)) {
182
+ wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family='.urlencode($font_family), false, false );
183
  }
184
+ wp_enqueue_style( 'chaty-front-css', CHT_PLUGIN_URL."css/chaty-front.css", array(), CHT_VERSION);
185
+ wp_enqueue_script( "chaty-front-end", CHT_PLUGIN_URL."js/cht-front-script.js", array( 'jquery' ), rand());
186
  wp_localize_script('chaty-front-end', 'chaty_settings', $data);
 
 
187
  }
188
  ?>