PageSourceSearch

https://www.achieveglobalsafaris.com/wp-content/plugins/wordpress-…/assets/js/wws-public-script.js?ver=2.0.1

js achieveglobalsafaris.com collected 2026-10-02 21:32:56 UTC 16,497 bytes, 443 lines download raw bytes

1var wwsLoader = '<div class="wws-spinner">';
2    wwsLoader += '<div class="wws-bounce1 wws--bg-color"></div>';
3    wwsLoader += '<div class="wws-bounce2 wws--bg-color"></div>';
4    wwsLoader += '<div class="wws-bounce3 wws--bg-color"></div>';
5    wwsLoader += '</div>';
6
7const wwsWidget = {
8
9    /*
10     * Popup show and hide
11     */
12    trigger: function() {
13
14        // Popup not open
15        if ( jQuery( '.wws-popup' ).attr( 'data-wws-popup-status' ) == '0' ) {
16            jQuery( '.wws-popup' ).slideDown();
17            jQuery( '.wws-popup' ).attr( 'data-wws-popup-status', '1' );
18            jQuery( '.wws-gradient' ).show();
19
20        } else { // Popup open
21            jQuery( '.wws-popup' ).slideUp();
22            jQuery( '.wws-popup' ).attr( 'data-wws-popup-status', '0' );
23            jQuery( '.wws-gradient' ).hide();
24        }
25
26    },
27
28    /*
29     * Auto popup 
30     */
31    autoPopup: function( delayInSeconds ) {
32        if ( 'yes' !== sessionStorage.wwsAutoPopup ) {
33            setTimeout( function() {
34                if ( '0' == jQuery( '.wws-popup' ).data( 'wws-popup-status' ) ) {
35                    wwsWidget.trigger();
36                }
37                sessionStorage.wwsAutoPopup = 'yes';
38            }, Number( delayInSeconds * 1000 ) );
39        }
40    },
41
42    /*
43     * Send message
44     */
45    sendMessage: function( message = '', whatsappNumber = '' ) {
46        if ( '' === message || '' === whatsappNumber) {
47            return false;
48        }
49        if ( this.is_mobile.any() ) {
50            window.open( wwsObj.whatsapp_mobile_api + '/send?phone=' + whatsappNumber + '&text=' + message + '');
51        } else {
52            window.open( wwsObj.whatsapp_desktop_api + '/send?phone=' + whatsappNumber + '&text=' + message + '');
53        }
54
55        jQuery( document.body ).trigger( 'wws_message_sent' );
56
57        return true;
58    },
59
60    /*
61     * Send group invitation
62     */
63    sendGroupInvitation: function( groupID ) {
64        window.open('https://chat.whatsapp.com/' + groupID );
65    },
66
67    /* 
68     * Mobile detection
69     */
70    is_mobile: {
71        Android: function() {
72            return navigator.userAgent.match(/Android/i);
73        },
74        BlackBerry: function() {
75            return navigator.userAgent.match(/BlackBerry/i);
76        },
77        iOS: function() {
78            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
79        },
80        Opera: function() {
81            return navigator.userAgent.match(/Opera Mini/i);
82        },
83        Windows: function() {
84            return navigator.userAgent.match(/IEMobile/i);
85        },
86        any: function() {
87            return ( wwsWidget.is_mobile.Android() || wwsWidget.is_mobile.BlackBerry() || wwsWidget.is_mobile.iOS() || wwsWidget.is_mobile.Opera() || wwsWidget.is_mobile.Windows());
88        },
89    },
90
91    logAnalytics: function( message = 'N/A', number = 'N/A', through = '' ) {
92        jQuery.ajax({
93            url: wwsObj.admin_url,
94            type: 'post',
95            data: {
96                'action':   'wws_click_analytics',
97                'message':  message,
98                'number':   number,
99                'through':  through,
100                'security': wwsObj.security_token,
101            }
102        });
103    },
104}
105
106;(function( $ ) {
107    "use strict";
108
109    jQuery( document ).ready(function() {
110
111        // Google and Facebook Pixel Analytics
112        function wws_ga_and_fb_click_analytics() {
113
114            var fbGaAnalytics = jQuery.parseJSON( wwsObj.fb_ga_click_tracking );
115
116            if ( 'yes' == fbGaAnalytics.ga_click_tracking_status ) {
117
118                try {
119                    gtag( 
120                        'event', 
121                        fbGaAnalytics.ga_click_tracking_event_name, {
122                            'event_category': fbGaAnalytics.ga_click_tracking_event_category,
123                            'event_label': fbGaAnalytics.ga_click_tracking_event_label,
124                        } 
125                    );
126                } catch ( error ) {
127                    if ( 'yes' === wwsObj.is_debug ) {
128                        window.console && console.log( 'WordPress WhatsApp Support Google or Facebook analytics error message: ' + error.message );
129                    }
130                }
131                
132                try {
133                    ga( 
134                        'send', 
135                        'event', 
136                        fbGaAnalytics.ga_click_tracking_event_category, 
137                        fbGaAnalytics.ga_click_tracking_event_name, 
138                        fbGaAnalytics.ga_click_tracking_event_label
139                    );
140                } catch ( error ) {
141                    if ( 'yes' === wwsObj.is_debug ) {
142                        window.console && console.log( 'WordPress WhatsApp Support Google or Facebook analytics error message: ' + error.message );
143                    }
144                }
145                
146                try {
147                    _gaq.push([ 
148                        '_trackEvent', 
149                        fbGaAnalytics.ga_click_tracking_event_category, 
150                        fbGaAnalytics.ga_click_tracking_event_name, 
151                        fbGaAnalytics.ga_click_tracking_event_label 
152                    ]);
153                }
154                catch ( error ) {
155                    if ( 'yes' === wwsObj.is_debug ) {
156                        window.console && console.log( 'WordPress WhatsApp Support Google or Facebook analytics error message: ' + error.message );
157                    }
158                }
159                
160                try {
161                    dataLayer.push({
162                        'event': 'customEvent',
163                        'eventCategory': fbGaAnalytics.ga_click_tracking_event_category,
164                        'eventAction': fbGaAnalytics.ga_click_tracking_event_name,
165                        'eventLabel': fbGaAnalytics.ga_click_tracking_event_label
166                    });
167                }
168                catch ( error ) {
169                    if ( 'yes' === wwsObj.is_debug ) {
170                        window.console && console.log( 'WordPress WhatsApp Support Google or Facebook analytics error message: ' + error.message );
171                    }
172                }
173            }
174
175            if ( 'yes' == fbGaAnalytics.fb_click_tracking_status ) {
176                var FBpixeled = false;
177                try {
178                    if ( ! FBpixeled ) {
179                        fbq( 'trackCustom', 'WordPressWhatsAppSupport', {
180                            event: fbGaAnalytics.fb_click_tracking_event_name,
181                            account: fbGaAnalytics.fb_click_tracking_event_label
182                        });
183                        FBpixeled = true;
184                    }
185                }
186                catch ( error ) {
187                    if ( 'yes' === wwsObj.is_debug ) {
188                        window.console && console.log( 'WordPress WhatsApp Support Google or Facebook analytics error message: ' + error.message );
189                    }
190                }
191            }
192        }
193
194        function isGDPRChecked() {
195            if ( 'yes' !== wwsObj.is_gdpr ) {
196                return;
197            }
198
199            if ( jQuery('.wws-gdpr input').is(':checked') == false ) {
200                jQuery( '.wws-gdpr > div' ).addClass('wws-shake-animation');
201                setTimeout( function() { 
202                    jQuery( '.wws-gdpr > div' ).removeClass('wws-shake-animation');
203                }, 300 );
204                return false;
205            } else {
206                return true;
207            }
208        }
209
210        // Open and close the wws popup
211        jQuery( '.wws-popup__open-btn, .wws-popup__close-btn' ).on('click', function(event) {
212            event.preventDefault();
213            wwsWidget.trigger();
214        });
215
216
217        // send message
218        jQuery( document ).on('click', '.wws-popup__send-btn', function(event) {
219            event.preventDefault();
220
221            // If popup template is 8th
222            if ( wwsObj.popup_layout == 8 ) {
223                var preMessage      = jQuery( this ).attr( 'data-wws-pre-msg' );
224                var whatsappNumber  = jQuery( this ).attr( 'data-wws-number' );
225
226                if ( isGDPRChecked() == false ) return;
227
228                if ( '' === preMessage ) {
229                    preMessage = '%20';
230                }
231
232                if( wwsWidget.sendMessage( preMessage, whatsappNumber ) == true ) {   
233                    wwsWidget.logAnalytics( preMessage, 'N/A', 'Layout 8' );
234                    wws_ga_and_fb_click_analytics();
235                }
236            }
237            
238            // If popup template is 7th
239            if ( wwsObj.popup_layout == 7 ) {
240
241                var message         = jQuery( '.wws-popup__input' ).val();
242                var number          = jQuery( '.wws-popup__fields-number' ).val();
243                var whatsappNumber  = wwsObj.support_number;
244
245                if ( isGDPRChecked() == false ) return;
246
247                setTimeout( function() {
248                    jQuery( '.wws-popup__fields-textarea-wrapper, .wws-popup__fields-number' ).removeClass( 'wws-shake-animation' );
249                }, 300 );
250
251                if ( number == '' ) {
252                    jQuery( '.wws-popup__fields-number' ).addClass( 'wws-shake-animation' );
253                    return;
254                }
255                if ( message == '' ) {
256                    jQuery( '.wws-popup__fields-textarea-wrapper' ).addClass( 'wws-shake-animation' );
257                    return;
258                }
259                if( wwsWidget.sendMessage( ( message + wwsObj.pre_defined_text ), whatsappNumber ) == true ) {
260                    wwsWidget.logAnalytics( message, number, 'Layout 7' );
261                    wws_ga_and_fb_click_analytics();
262                }
263
264            }
265
266            if ( wwsObj.popup_layout == 6 ) {
267
268                var message         = jQuery( '.wws-popup__input' ).val();
269                var preMessage      = jQuery( '.wws-popup-multi-support-pre-essage' ).val();
270                var number          = jQuery( '.wws-popup__fields-number' ).val();
271                var whatsappNumber  = jQuery( '.wws-popup-multi-support-number' ).val();
272
273                if ( isGDPRChecked() == false ) return;
274
275                setTimeout( function() {
276                    jQuery( '.wws-popup__fields-textarea-wrapper, .wws-popup__fields-number' ).removeClass( 'wws-shake-animation' );
277                }, 300 );
278
279                if ( number == '' ) {
280                    jQuery( '.wws-popup__fields-number' ).addClass( 'wws-shake-animation' );
281                    return;
282                }
283
284                if ( message == '' ) {
285                    jQuery( '.wws-popup__fields-textarea-wrapper' ).addClass( 'wws-shake-animation' );
286                    return;
287                }
288
289                if( wwsWidget.sendMessage( ( message + preMessage ), whatsappNumber ) == true ) {
290                    
291                    wwsWidget.logAnalytics( message, number, 'Layout 6' );
292                    wws_ga_and_fb_click_analytics();
293
294                }
295
296            }
297
298            // if popup template is 1st, 2nd, or 3rd
299            if ( wwsObj.popup_layout == 1 || wwsObj.popup_layout == 2 || wwsObj.popup_layout == 3 ) {
300
301                var message         = jQuery( '.wws-popup__input' ).val();
302                var whatsappNumber  = wwsObj.support_number;
303
304                if ( isGDPRChecked() == false ) return;
305
306                setTimeout( function() {
307                    jQuery( '.wws-popup__input-wrapper' ).removeClass( 'wws-shake-animation' );
308                }, 300 );
309
310                if ( 0 == message.length ) {
311                    jQuery( '.wws-popup__input-wrapper' ).addClass( 'wws-shake-animation' );
312                    return;
313                }
314                if ( wwsWidget.sendMessage( ( message + wwsObj.pre_defined_text ), whatsappNumber ) == true ) {                    
315                    if ( 1 == wwsObj.popup_layout ) {
316                        wwsWidget.logAnalytics( message, 'N/A', 'Layout 1' );
317                    } else if ( 2 == wwsObj.popup_layout ) {
318                        wwsWidget.logAnalytics( message, 'N/A', 'Layout 2' );
319                    } else if ( 3 == wwsObj.popup_layout ) {
320                        wwsWidget.logAnalytics( message, 'N/A', 'Layout 3' );
321                    }
322
323                    wws_ga_and_fb_click_analytics();
324                }
325            } 
326
327            // if popup template is 4th
328            if ( wwsObj.popup_layout == 4 ) {
329
330                var message         = jQuery( '.wws-popup__input' ).val();
331                var whatsappNumber  = wwsObj.support_number;
332
333                if( wwsWidget.sendMessage( ( message + wwsObj.pre_defined_text ), whatsappNumber ) == true ) {
334                    wwsWidget.logAnalytics( 'N/A', 'N/A', 'Layout 4' );
335                    wws_ga_and_fb_click_analytics();
336                }
337            }
338
339        });
340
341        // Hit enter to send a message.
342        jQuery('.wws-popup__input').on( 'keypress', function (e) {
343            var key = e.which;
344
345            if(key == 13) { // the enter key code
346                jQuery('.wws-popup__send-btn').click();
347                return false;  
348            }
349        });
350
351        // Group invitation
352        jQuery( '.wws-popup-group-invitation__button' ).on( 'click', function() {
353            wwsWidget.sendGroupInvitation( wwsObj.group_invitation_id );
354            wwsWidget.logAnalytics();
355            wws_ga_and_fb_click_analytics()
356        });
357
358        // autoPopup
359        if ( 'yes' === wwsObj.auto_popup ) {
360            wwsWidget.autoPopup( wwsObj.auto_popup_time );
361        }
362
363        // popup button display by scroll lenght
364        if ( wwsObj.scroll_lenght != null ) {
365
366            jQuery(document).on( 'scroll', function () {
367                var y = jQuery(window).scrollTop() + jQuery(window).height();
368                var documentHeight = jQuery(document).height() * wwsObj.scroll_lenght / 100;
369
370                if ( y >= documentHeight - 10 ) {
371                    jQuery('.wws-popup-container').fadeIn();
372                } else {
373                    jQuery('.wws-popup-container').fadeOut();
374                }
375            });
376        }
377
378        // Layout 6 - open selected support person.
379        jQuery( document ).on( 'click', '[data-wws-multi-support-person-id]', function() { 
380            var multiSupportPersonID = jQuery( this ).attr( 'data-wws-multi-support-person-id' );
381            
382            jQuery( '.wws-popup__support-person-wrapper' ).hide();
383            jQuery( '.wws-popup__support-person-form' ).show();
384            jQuery( '.wws-popup__support-person-form' ).html( wwsLoader );
385
386            jQuery.ajax({
387                url: wwsObj.admin_url,
388                type: 'post',
389                data: {
390                    'action':   'wws_view_multi_person_form',
391                    'support_person_id': multiSupportPersonID,
392                    'post_id' : wwsObj.current_page_id,
393                }
394            }).done(function( response ) {
395                jQuery( '.wws-popup__support-person-form' ).html( response );
396                if ( ''  !== wwsObj.numberMasking) {
397                    jQuery( '.wws-popup__fields-number' ).mask( wwsObj.numberMasking );
398                }
399            });
400            
401        } );
402        
403
404        // Layout 6 - close selected support person.
405        jQuery( document ).on( 'click', '[data-wws-multi-support-back]', function() {
406            jQuery( '.wws-popup__support-person-wrapper' ).show();
407            jQuery( '.wws-popup__support-person-form' ).hide();
408        } );
409
410        // Mobile number masking
411        if ( ''  !== wwsObj.numberMasking) {
412            jQuery( '.wws-popup__fields-number' ).mask( wwsObj.numberMasking );
413        }
414
415        /**
416         * Generated shortcode button analytics.
417         * 
418         * @since 1.9.7
419         * 
420         */
421        jQuery( '.wws-shortcode-btn' ).on( 'click', function() {
422            wwsWidget.logAnalytics( 'N/A', 'N/A', 'Shortcode Button' );
423            wws_ga_and_fb_click_analytics();
424        } );
425
426
427        /**
428         * WooCommerce query button analytics.
429         * 
430         * @since 1.9.7
431         * 
432         */
433        jQuery( '.wws-product-query-btn' ).on( 'click', function() {
434            wwsWidget.logAnalytics( 'N/A', 'N/A', 'Woo Query Button' );
435            wws_ga_and_fb_click_analytics();
436        } );
437
438
439
440
441    }); // Document ready end here.
442
443})(jQuery)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.