PageSourceSearch

https://wibernet.co.za/wp-content/plugins/tw-whatsapp-chat-rotator/js/functions.js

js wibernet.co.za collected 2026-10-09 22:42:20 UTC 4,672 bytes, 132 lines download raw bytes

1(function($) {
2    "use strict";
3    jQuery(document).ready(function($) {
4        $(document).on('click', '.twwr-whatsapp-button', function() {
5                var FBAction = $(this).attr('fb-pixel');
6                if ( typeof fbq !== 'undefined' && FBAction ) {
7                    if( FBAction != 'noevent' ){
8                        fbq('track', FBAction, {});
9                    }
10                }
11            });
12
13        $(document).click(function(event) {
14                if($(event.target).closest('#contact-trigger').length) {
15                    $('.twwr-container').toggleClass('open');
16                }
17            });
18
19        function twResponsive() {
20            $('.twwr-container.twwr-std .twwr-wa-button').each(function() {
21            var $this = $(this),
22                width = $this.outerWidth();
23
24            if (width <= 200) {
25                $this.addClass('smallScreen');
26            } else {
27                $this.removeClass('smallScreen');
28            }
29            })
30        }
31
32        $(window).on('load', function() {
33            twResponsive();
34        });
35        $(window).on('resize', function() {
36            twResponsive();
37        });
38
39        $(document).click(function(x) {
40            if($(x.target).closest('.close-chat').length) {
41                $('.twwr-container').removeClass('open');
42            }
43        });
44
45        function ForNumbers(evt){
46            var charCode = (evt.which) ? evt.which : event.keyCode;
47
48            if (
49                //0~9
50                charCode >= 48 && charCode <= 57 ||
51                //number pad 0~9
52                charCode >
52= 96 && charCode <= 105 ||
53                //backspace
54                charCode == 8 ||
55                //tab
56                charCode == 9 ||
57                //enter
58                charCode == 13 ||
59                //left, right, delete..
60                charCode >= 35 && charCode <= 46
61            )
62            {
63                //make sure the new value below 20
64                if(parseInt(this.value+String.fromCharCode(charCode), 10) <= 100)
65                    return true;
66            }
67
68            evt.preventDefault();
69            evt.stopPropagation();
70
71            return false;
72        }
73
74        $('input.input-views').each(function() {
75            var $this = $(this);
76            $this.on('keypress', ForNumbers, false);
77
78            console.log('anu mas')
79        })
80
81        if( jQuery('.twwr-whatsapp-content').length > 0 || jQuery('.twwr-std').length > 0 ){
82            var script = document.createElement('script');
83            script.type = 'text/javascript';
84            // script.src = 'https://geolocation-db.com/json/geoip.php?jsonp=twwr_whatsapp_callback';
85            // script.src = 'https://api.ipify.org/?format=jsonp&callback=twwr_whatsapp_callback';
86            script.src = 'https://ipapi.co/jsonp/?callback=twwr_whatsapp_callback';
87            var h = document.getElementsByTagName('script')[0];
88            h.parentNode.insertBefore(script, h);
89        }
90    });
91})(jQuery);
92
93function twwr_whatsapp_callback(data){
94    "use strict";
95    var geo = data;
96    
97    var chats = [];
98    var agents = [];
99    var numbers = [];
100    if( jQuery('.twwr-whatsapp-button').length > 0 ){
101        jQuery.each( jQuery('.twwr-whatsapp-button'), function(key, button){
102            chats.push( jQuery(button).attr('data-chat') );
103            agents.push( jQuery(button).attr('data-agent') );
104            numbers.push( jQuery(button).attr('data-number') );
105        });
106
107        const rot_data = "action=twwr-whatsapp-chat-agent-count-click&chat="+chats+"&agent="+agents+"&number="+numbers+"&geo="+JSON.stringify(geo)+"&type=view&ref="+window.location.href;
108
109        jQuery.ajax({
110            async: true,
111            url: twwr_whatsapp_chat.ajax_url,
112            type: 'POST',
113            data: rot_data,
114        });
115    }
116    else if( jQuery('.twwr-wa-button').length > 0 ){
117        jQuery.each( jQuery('.twwr-wa-button'), function(key, button){
118            chats.push( jQuery(button).attr('data-chat') );
119            agents.push( jQuery(button).attr('data-agent') );
120            numbers.push( jQuery(button).attr('data-number') );
121        });
122
123        const rot_data = "action=twwr-whatsapp-chat-agent-count-click&chat="+chats+"&agent="+agents+"&number="+numbers+"&geo="+JSON.stringify(geo)+"&type=view&ref="+window.location.href;
124
125        jQuery.ajax({
126            async: true,
127            url: twwr_whatsapp_chat.ajax_url,
128            type: 'POST',
129            data: rot_data,
130        });
131    }
132}

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.