sidokumpul.desa.id Open in urlscan Pro
103.28.52.75  Public Scan

URL: https://sidokumpul.desa.id/desa/themes/denava%2014/assets/plugin/czm-chat-support.min.js
Submission: On August 22 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

/* ======================================================= 
 *
 *      Project: CZM All in One Social Chat Support
 *      Version: 3.0
 *
 *      Author: czmMedia
 *      Contact: https://codecanyon.net/user/czmmedia
 *      Available only in: https://codecanyon.net/item/czm-social-chat-support/26387234
 *
 *      Copyright (c) 2021, Czm Media. All rights reserved.
 *    
 * ======================================================= */

(function ($) {

    'use strict';

    $.fn.czmChatSupport = function (options) {

        var defaults = {
            button: {
                position: "right",
                style: 1,
                src: '<i class="fab fa-whatsapp"></i>',
                backgroundColor: "#26c281",
                effect: 1,
                notificationNumber: "1",
                speechBubble: "How can we help you?",
                pulseEffect: true,
                text: {
                    title: "Need help? Chat with us",
                    description: "Customer Support",
                    online: "I'm Online",
                    offline: "I will be back soon"
                },
                link: {
                    desktop: false,
                    mobile: false
                },
                onlineDay: {
                    sunday: false,
                    monday: false,
                    tuesday: false,
                    wednesday: false,
                    thursday: false,
                    friday: false,
                    saturday: false
                },
                delay: true
            },
            popup: {
                automaticOpen: false,
                outsideClickClosePopup: true,
                effect: 1,
                header: {
                    backgroundColor: "#26c281",
                    title: "Need help? Chat with us",
                    description: "Click one of our representatives below"
                },
                persons: [],
                personsSettings: {
                    avatar: {
                        src: '<i class="fab fa-whatsapp"></i>',
                        backgroundColor: "#26c281",
                        onlineCircle: true
                    },
                    text: {
                        title: "Need Help?",
                        description: "Customer Support",
                        online: "I'm Online",
                        offline: "I will be back soon",
                        message: false,
                        textbox: false,
                        button: "Start Chat"
                    },
                    link: {
                        desktop: false,
                        mobile: false
                    },
                    onlineDay: {
                        sunday: false,
                        monday: false,
                        tuesday: false,
                        wednesday: false,
                        thursday: false,
                        friday: false,
                        saturday: false
                    }
                }
            },
            sound: true,
            changeBrowserTitle: "New Message!",
            cookie: false,
            timezone: false,
            onLoad: function () {},
            onClick: function () {},
            onPopupOpen: function () {},
            onPopupClose: function () {}
        };

        /**************************************************************************************************/
        /**************************************************************************************************/
        /**************************************************************************************************/

        var settings = $.extend(true, {}, defaults, options);

        /**************************************************************************************************/
        /**************************************************************************************************/
        /**************************************************************************************************/
        /********** TIMEZONE **********/

        var mtimezone;

        if (window.moment) {

            if (settings.timezone !== false) {

                mtimezone = moment().tz(settings.timezone);

            } else {

                mtimezone = moment().tz(moment.tz.guess());
            }
        }

        /**************************************************************************************************/
        /**************************************************************************************************/
        /**************************************************************************************************/

        return this.each(function () {

            //console.log(settings);

            var czmID = this;

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** COOKIE **********/

            if (getCookie('czmChatSupport') == 'true') {

                settings.button.pulseEffect = false;
                settings.button.notificationNumber = false;
                settings.button.speechBubble = false;
                settings.button.delay = false;
                settings.popup.automaticOpen = false;
                settings.sound = false;
                settings.changeBrowserTitle = false;
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/

            if (settings.onLoad && typeof settings.onLoad === 'function') {

                settings.onLoad.call(this);
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/

            if ((settings.button.position !== 'right') && (settings.button.position !== 'left')) {

                settings.button.speechBubble = false;
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** BUTTON **********/

            $(czmID).addClass('czm-chat-support czm-chat-support-' + settings.button.style).prepend('<div class="czm-button"></div>');

            if ((settings.button.position == 'right') || (settings.button.position == 'left')) {

                $(czmID).addClass('czm-fixed');

                if (settings.button.position == 'right') {

                    $(czmID).addClass('czm-right');

                } else if (settings.button.position == 'left') {

                    $(czmID).addClass('czm-left');
                }

                if (settings.button.delay !== false) {

                    if ((settings.button.effect == 2) || (settings.button.effect == 4) || (settings.button.effect == 5) || (settings.button.effect == 7)) {

                        if (settings.button.position == 'right') {

                            settings.button.effect = settings.button.effect + '__1';

                        } else if (settings.button.position == 'left') {

                            settings.button.effect = settings.button.effect + '__2';
                        }
                    }

                    $(czmID).addClass('czm-chat-support-show');

                    $('.czm-button', czmID).addClass('animate__animated animate__' + settings.button.effect);

                    setInterval(function () {

                        $('.czm-button', czmID).removeClass('animate__animated animate__' + settings.button.effect);

                    }, 1000);

                } else {

                    $(czmID).addClass('czm-chat-support-show');
                }

            } else {

                $(czmID).addClass('czm-chat-support-show');
            }

            var buttonOnline = true;
            var buttonLink;

            if ((settings.button.link.desktop !== false) || (settings.button.link.mobile !== false)) {

                if (window.moment) {

                    if ((settings.button.onlineDay[mtimezone.format('dddd').toLowerCase()] == false) || (settings.button.onlineDay[mtimezone.format('dddd').toLowerCase()] == undefined)) {

                        buttonOnline = false;

                    } else if (moment(mtimezone.format('HH:mm:ss'), 'HH:mm:ss').isBetween(moment(settings.button.onlineDay[mtimezone.format('dddd').toLowerCase()].split('-')[0] + ':00', 'HH:mm:ss'), moment(settings.button.onlineDay[mtimezone.format('dddd').toLowerCase()].split('-')[1] + ':59', 'HH:mm:ss')) == false) {

                        buttonOnline = false;
                    }
                }

            } else if (settings.popup.persons.length == 0) {

                buttonOnline = false;
            }

            $('.czm-button', czmID).css('background-color', settings.button.backgroundColor);

            $('.czm-button', czmID).append('<div class="czm-button-person-avatar"></div>');

            $('.czm-button-person-avatar', czmID).append(settings.button.src);

            if ((settings.button.style == 6) || (settings.button.style == 7)) {

                $('.czm-button-person-avatar', czmID).css('background-color', settings.button.backgroundColor);
            }

            if ((settings.button.style == 3) || (settings.button.style == 5)) {

                $('.czm-button', czmID).append('<div class="czm-button-content"><div class="czm-button-content-title">' + settings.button.text.title + '</div></div>');

            } else if ((settings.button.style == 2) || (settings.button.style == 4) || (settings.button.style == 6) || (settings.button.style == 7)) {

                $('.czm-button', czmID).append('<div class="czm-button-content"><div class="czm-button-content-title">' + settings.button.text.title + '</div></div>');

                if (((settings.button.text.description !== false) && (settings.button.text.description !== '') && (settings.button.text.description !== undefined)) || ((settings.button.text.online !== false) && (settings.button.text.online !== '') && (settings.button.text.online !== undefined)) || (settings.button.text.offline !== false) && (settings.button.text.offline !== '') && (settings.button.text.offline !== undefined)) {

                    if ((settings.button.text.description !== false) && (settings.button.text.description !== '') && (settings.button.text.description !== undefined)) {

                        $('.czm-button-content', czmID).append('<div class="czm-button-content-description">' + settings.button.text.description + '</div>');
                    }

                    if (buttonOnline == true) {

                        if ((settings.button.text.online !== false) && (settings.button.text.online !== '') && (settings.button.text.online !== undefined)) {

                            $('.czm-button-content', czmID).append('<div class="czm-button-content-online-offline-text">' + settings.button.text.online + '</div>');
                        }

                    } else {

                        if ((settings.button.text.offline !== false) && (settings.button.text.offline !== '') && (settings.button.text.offline !== undefined)) {

                            $('.czm-button-content', czmID).append('<div class="czm-button-content-online-offline-text">' + settings.button.text.offline + '</div>');
                        }
                    }
                }
            }
			
			if (settings.button.src.search('img') !== -1) {

                $('.czm-button', czmID).addClass('czm-button-image');
            }

            if (buttonOnline == false) {

                $('.czm-button', czmID).addClass('czm-button-offline');
            }

            if (((settings.button.link.desktop !== false) || (settings.button.link.mobile !== false)) && (buttonOnline == true)) {

                $('.czm-button', czmID).click(function () {

                    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

                        if (settings.button.link.mobile !== false) {

                            buttonLink = settings.button.link.mobile;

                        } else {

                            buttonLink = settings.button.link.desktop;
                        }

                    } else {

                        buttonLink = settings.button.link.desktop;
                    }

                    window.open(buttonLink, '_blank');

                    if (settings.onClick && typeof settings.onClick === 'function') {

                        settings.onClick.call(this);
                    }
                });
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** POPUP **********/

            if ((settings.button.link.desktop == false) && (settings.button.link.mobile == false) && (settings.popup.persons.length > 0) && ((settings.button.position == 'right') || (settings.button.position == 'left'))) {

                if (settings.popup.outsideClickClosePopup == true) {

                    $(document).click(function () {

                        if ($(czmID).hasClass('czm-popup-show')) {

                            czmHide();

                            if (settings.onPopupClose && typeof settings.onPopupClose === 'function') {

                                settings.onPopupClose.call(this);
                            }
                        }
                    });

                    $(czmID).click(function (e) {

                        e.stopPropagation();
                        return false;
                    });
                }

                $('.czm-button', czmID).click(function () {

                    czmHide();

                    if ($(czmID).hasClass('czm-popup-show')) {

                        if (settings.onPopupOpen && typeof settings.onPopupOpen === 'function') {

                            settings.onPopupOpen.call(this);
                        }

                    } else {

                        if (settings.onPopupClose && typeof settings.onPopupClose === 'function') {

                            settings.onPopupClose.call(this);
                        }
                    }
                });

                if ((settings.popup.effect == 2) || (settings.popup.effect == 10) || (settings.popup.effect == 12)) {

                    if (settings.button.position == 'right') {

                        settings.popup.effect = settings.popup.effect + '__1';

                    } else if (settings.button.position == 'left') {

                        settings.popup.effect = settings.popup.effect + '__2';
                    }
                }

                $(czmID).prepend('<div class="czm-popup animate__popup__' + settings.popup.effect + '"></div>');

                if (settings.popup.automaticOpen == true) {

                    var automaticOpenTime;

                    if (settings.button.delay == true) {

                        automaticOpenTime = 900;

                    } else {

                        automaticOpenTime = 200;
                    }

                    setTimeout(function () {

                        czmHide();

                        if (settings.onPopupOpen && typeof settings.onPopupOpen === 'function') {

                            settings.onPopupOpen.call(this);
                        }

                    }, automaticOpenTime);
                }

                $('.czm-popup', czmID).prepend('<div class="czm-popup-header"><span class="czm-popup-close"></span></div>');

                $('.czm-popup-close', czmID).click(function () {

                    czmHide();

                    if (settings.onPopupClose && typeof settings.onPopupClose === 'function') {

                        settings.onPopupClose.call(this);
                    }
                });

                $('.czm-popup-header', czmID).css('background-color', settings.popup.header.backgroundColor);

                if ((settings.popup.header.title == false) || (settings.popup.header.title == '') || (settings.popup.header.title == undefined)) {

                    $('.czm-popup-header', czmID).append('<div class="czm-popup-header-title">Need Help? Chat with us</div>');

                } else {

                    $('.czm-popup-header', czmID).append('<div class="czm-popup-header-title">' + settings.popup.header.title + '</div>');
                }

                if ((settings.popup.header.description !== false) && (settings.popup.header.description !== '') && (settings.popup.header.description !== undefined)) {

                    $('.czm-popup-header', czmID).append('<div class="czm-popup-header-description">' + settings.popup.header.description + '</div>');
                }

                $('.czm-popup', czmID).append('<div class="czm-popup-area"><div class="czm-popup-persons"></div></div>');
				
				if (settings.popup.persons.length > 5) {

                    $('.czm-popup', czmID).addClass('czm-popup-small');

                }

                var pn = 0;

                for (var p = 0; p < settings.popup.persons.length; p++) {

                    pn = p + 1;

                    var personLink;
                    var personOnline = true;

                    if (settings.popup.persons[p].link == undefined) {

                        settings.popup.persons[p].link = settings.popup.personsSettings.link;

                    } else {

                        if (settings.popup.persons[p].link.desktop == undefined) {

                            settings.popup.persons[p].link.desktop = settings.popup.personsSettings.link.desktop;
                        }

                        if (settings.popup.persons[p].link.mobile == undefined) {

                            settings.popup.persons[p].link.mobile = settings.popup.personsSettings.link.mobile;
                        }
                    }

                    if (settings.popup.persons[p].avatar == undefined) {

                        settings.popup.persons[p].avatar = settings.popup.personsSettings.avatar;

                    } else {

                        if (settings.popup.persons[p].avatar.src == undefined) {

                            settings.popup.persons[p].avatar.src = settings.popup.personsSettings.avatar.src;
                        }

                        if (settings.popup.persons[p].avatar.backgroundColor == undefined) {

                            settings.popup.persons[p].avatar.backgroundColor = settings.popup.personsSettings.avatar.backgroundColor;
                        }

                        if (settings.popup.persons[p].avatar.onlineCircle == undefined) {

                            settings.popup.persons[p].avatar.onlineCircle = settings.popup.personsSettings.avatar.onlineCircle;
                        }
                    }

                    if (settings.popup.persons[p].text == undefined) {

                        settings.popup.persons[p].text = settings.popup.personsSettings.text;

                    } else {

                        if (settings.popup.persons[p].text.title == undefined) {

                            settings.popup.persons[p].text.title = settings.popup.personsSettings.text.title;
                        }

                        if (settings.popup.persons[p].text.description == undefined) {

                            settings.popup.persons[p].text.description = settings.popup.personsSettings.text.description;
                        }

                        if (settings.popup.persons[p].text.online == undefined) {

                            settings.popup.persons[p].text.online = settings.popup.personsSettings.text.online;
                        }

                        if (settings.popup.persons[p].text.offline == undefined) {

                            settings.popup.persons[p].text.offline = settings.popup.personsSettings.text.offline;
                        }

                        if (settings.popup.persons[p].text.message == undefined) {

                            settings.popup.persons[p].text.message = settings.popup.personsSettings.text.message;
                        }

                        if (settings.popup.persons[p].text.textbox == undefined) {

                            settings.popup.persons[p].text.textbox = settings.popup.personsSettings.text.textbox;
                        }

                        if (settings.popup.persons[p].text.button == undefined) {

                            settings.popup.persons[p].text.button = settings.popup.personsSettings.text.button;
                        }
                    }

                    if (settings.popup.persons[p].onlineDay == undefined) {

                        settings.popup.persons[p].onlineDay = settings.popup.personsSettings.onlineDay;

                    } else {

                        if (settings.popup.persons[p].onlineDay.sunday == undefined) {

                            settings.popup.persons[p].onlineDay.sunday = settings.popup.personsSettings.onlineDay.sunday;
                        }

                        if (settings.popup.persons[p].onlineDay.monday == undefined) {

                            settings.popup.persons[p].onlineDay.monday = settings.popup.personsSettings.onlineDay.monday;
                        }

                        if (settings.popup.persons[p].onlineDay.tuesday == undefined) {

                            settings.popup.persons[p].onlineDay.tuesday = settings.popup.personsSettings.onlineDay.tuesday;
                        }

                        if (settings.popup.persons[p].onlineDay.wednesday == undefined) {

                            settings.popup.persons[p].onlineDay.wednesday = settings.popup.personsSettings.onlineDay.wednesday;
                        }

                        if (settings.popup.persons[p].onlineDay.thursday == undefined) {

                            settings.popup.persons[p].onlineDay.thursday = settings.popup.personsSettings.onlineDay.thursday;
                        }

                        if (settings.popup.persons[p].onlineDay.friday == undefined) {

                            settings.popup.persons[p].onlineDay.friday = settings.popup.personsSettings.onlineDay.friday;
                        }

                        if (settings.popup.persons[p].onlineDay.saturday == undefined) {

                            settings.popup.persons[p].onlineDay.saturday = settings.popup.personsSettings.onlineDay.saturday;
                        }
                    }

                    if (window.moment) {

                        if (settings.popup.persons[p].onlineDay[mtimezone.format('dddd').toLowerCase()] == false) {

                            personOnline = false;

                        } else if (moment(mtimezone.format('HH:mm:ss'), 'HH:mm:ss').isBetween(moment(settings.popup.persons[p].onlineDay[mtimezone.format('dddd').toLowerCase()].split('-')[0] + ':00', 'HH:mm:ss'), moment(settings.popup.persons[p].onlineDay[mtimezone.format('dddd').toLowerCase()].split('-')[1] + ':59', 'HH:mm:ss')) == false) {

                            personOnline = false;
                        }
                    }

                    $('.czm-popup-persons', czmID).append('<div class="czm-popup-person" data-id="' + p + '"><div class="czm-popup-person-content"></div></div>');

                    var personChild = $('.czm-popup-person:nth-child(' + pn + ')', czmID);

                    personChild.prepend('<div class="czm-popup-person-avatar"></div>');

                    $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-avatar', czmID).prepend(settings.popup.persons[p].avatar.src).css('background-color', settings.popup.persons[p].avatar.backgroundColor);

                    if ((settings.popup.persons[p].text.title == false) || (settings.popup.persons[p].text.title == '') || (settings.popup.persons[p].text.title == undefined)) {

                        settings.popup.persons[p].text.title = 'Need Help?';
                    }

                    $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-content', czmID).append('<div class="czm-popup-person-title">' + settings.popup.persons[p].text.title + '</div>');

                    if ((settings.popup.persons[p].text.description !== false) && (settings.popup.persons[p].text.description !== '') && (settings.popup.persons[p].text.description !== undefined)) {

                        $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-content', czmID).append('<div class="czm-popup-person-description">' + settings.popup.persons[p].text.description + '</div>');
                    }

                    if (personOnline == true) {

                        if (settings.popup.persons[p].avatar.onlineCircle == true) {

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-avatar', czmID).append('<div class="czm-popup-person-avatar-status"></div>');
                        }

                        if ((settings.popup.persons[p].text.online !== false) && (settings.popup.persons[p].text.online !== '') && (settings.popup.persons[p].text.online !== undefined)) {

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-content', czmID).append('<div class="czm-popup-person-online-offline-text">' + settings.popup.persons[p].text.online + '</div>');
                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-online-offline-text', czmID).css('background-color', settings.popup.header.backgroundColor);
                        }

                    } else {

                        personChild.addClass('czm-popup-person-offline');

                        if ((settings.popup.persons[p].text.offline !== false) && (settings.popup.persons[p].text.offline !== '') && (settings.popup.persons[p].text.offline !== undefined)) {

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-content', czmID).append('<div class="czm-popup-person-online-offline-text">' + settings.popup.persons[p].text.offline + '</div>');
                        }
                    }

                    if (settings.popup.persons.length == 1) {

                        $('.czm-popup', czmID).addClass('czm-popup-single');

                        $('.czm-popup-header', czmID).css('background-color', settings.popup.header.backgroundColor);
                        $('.czm-popup-header-title', czmID).remove();
                        $('.czm-popup-header-description', czmID).remove();

                        $('.czm-popup-person:nth-child(' + pn + ')', czmID).css('background-color', settings.popup.header.backgroundColor);

                        $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-avatar', czmID).css('background-color', '#ffffff');
                        $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-avatar i', czmID).css('color', settings.popup.header.backgroundColor);

                        $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-person-online-offline-text', czmID).remove();

                        $('.czm-popup-person:nth-child(' + pn + ')', czmID).append('<div class="czm-popup-start-chat"></div>');

                        if (settings.popup.persons[p].text.message !== false) {

                            $('.czm-popup-person:nth-child(' + pn + ')', czmID).addClass('czm-popup-person-message');

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat', czmID).append('<div class="czm-popup-start-chat-message"><div>' + settings.popup.persons[p].text.message + '</div></div>');
                        }

                        if (settings.popup.persons[p].text.textbox !== false) {

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat', czmID).append('<div class="czm-popup-start-chat-textbox"><input type="text" placeholder="' + settings.popup.persons[p].text.textbox + '" autocomplete="off"><i class="fa fa-play"></i></div>');

                            if ((settings.popup.persons[p].link.desktop !== false) || (settings.popup.persons[p].link.mobile !== false)) {

                                $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat-textbox i', czmID).click(function () {

                                    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

                                        if (settings.popup.persons[0].link.mobile !== false) {

                                            personLink = settings.popup.persons[0].link.mobile;

                                        } else {

                                            personLink = settings.popup.persons[0].link.desktop;
                                        }

                                    } else {

                                        personLink = settings.popup.persons[0].link.desktop;
                                    }

                                    if (settings.popup.persons[0].text.textbox !== false) {

                                        if (personLink.search(/text/) != -1) {

                                            personLink = personLink.split('text')[0];
                                        }

                                        personLink = personLink + 'text=' + $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat-textbox input[type="text"]', czmID).val();
                                    }

                                    window.open(personLink, '_blank');
                                });

                                $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat-textbox input[type="text"]', czmID).keyup(function (e) {

                                    if (e.keyCode == 13) {

                                        if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

                                            if (settings.popup.persons[0].link.mobile !== false) {

                                                personLink = settings.popup.persons[0].link.mobile;

                                            } else {

                                                personLink = settings.popup.persons[0].link.desktop;
                                            }

                                        } else {

                                            personLink = settings.popup.persons[0].link.desktop;
                                        }

                                        if (settings.popup.persons[0].text.textbox !== false) {

                                            if (personLink.search(/text/) != -1) {

                                                personLink = personLink.split('text')[0];
                                            }

                                            personLink = personLink + 'text=' + $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat-textbox input[type="text"]', czmID).val();
                                        }

                                        window.open(personLink, '_blank');
                                    }
                                });
                            }

                        } else {

                            $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat', czmID).append('<div class="czm-popup-start-chat-button"><span>' + settings.popup.persons[p].text.button + '</span></div>');

                            $('.czm-popup-start-chat-button', czmID).css('background-color', settings.popup.header.backgroundColor);

                            if ((settings.popup.persons[p].link.desktop !== false) || (settings.popup.persons[p].link.mobile !== false)) {

                                $('.czm-popup-person:nth-child(' + pn + ') .czm-popup-start-chat-button', czmID).click(function () {

                                    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

                                        if (settings.popup.persons[0].link.mobile !== false) {

                                            personLink = settings.popup.persons[0].link.mobile;

                                        } else {

                                            personLink = settings.popup.persons[0].link.desktop;
                                        }

                                    } else {

                                        personLink = settings.popup.persons[0].link.desktop;
                                    }

                                    window.open(personLink, '_blank');
                                });
                            }
                        }

                        if (personOnline == false) {

                            $('.czm-popup', czmID).remove();
                            $('.czm-button', czmID).addClass('czm-button-offline');

                            if ((settings.button.text.offline !== false) && (settings.button.text.offline !== '') && (settings.button.text.offline !== undefined)) {

                                $('.czm-button-content-online-offline-text', czmID).html(settings.button.text.offline);

                            } else {

                                $('.czm-button-content-online-offline-text', czmID).remove();
                            }

                            buttonOnline = false;
                        }

                    } else {

                        if ((settings.popup.persons[p].link.desktop !== false) || (settings.popup.persons[p].link.mobile !== false)) {

                            personChild.click(function (e) {

                                if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

                                    if (settings.popup.persons[e.currentTarget.dataset.id].link.mobile !== false) {

                                        personLink = settings.popup.persons[e.currentTarget.dataset.id].link.mobile;

                                    } else {

                                        personLink = settings.popup.persons[e.currentTarget.dataset.id].link.desktop;
                                    }

                                } else {

                                    personLink = settings.popup.persons[e.currentTarget.dataset.id].link.desktop;
                                }

                                window.open(personLink, '_blank');
                            });
                        }
                    }
                }
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** PULSE EFFECT **********/

            if ((settings.button.pulseEffect == true) && (buttonOnline == true)) {

                if (settings.button.style == 1) {

                    $('.czm-button', czmID).append('<div class="czm-pulse"></div><div class="czm-pulse"></div>');
                    $('.czm-pulse', czmID).css('background-color', settings.button.backgroundColor);
                }
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** NOTIFY **********/

            if ((settings.button.notificationNumber !== false) && (buttonOnline == true)) {

                $('.czm-button', czmID).append('<div class="czm-notify"><div class="czm-notify-circle"></div></div>');

                setTimeout(function () {

                    $('.czm-notify-circle', czmID).addClass('czm-notify-circle-show czm-bounce').html(settings.button.notificationNumber);

                    setInterval(function () {

                        $('.czm-notify-circle', czmID).toggleClass('czm-bounce');

                    }, 2000);

                }, 4000);
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** SPEECH BUBBLE **********/

            if ((settings.button.speechBubble !== false) && (buttonOnline == true)) {

                $(czmID).prepend('<div class="czm-speech-bubble"><span class="czm-speech-bubble-close"></span><div class="czm-speech-bubble-text"></div></div>');

                setTimeout(function () {

                    setTimeout(function () {

                        $('.czm-speech-bubble', czmID).addClass('czm-speech-bubble-show');

                    }, 1);

                    $('.czm-speech-bubble-text', czmID).html('<div class="czm-speech-bubble-typing"><div></div><div></div><div></div></div>');

                    setTimeout(function () {

                        $('.czm-speech-bubble-close', czmID).addClass('czm-speech-bubble-close-show');
                        $('.czm-speech-bubble-text', czmID).html(settings.button.speechBubble);

                    }, 3000);

                }, 1000);

                $('.czm-speech-bubble-close', czmID).click(function () {

                    $('.czm-speech-bubble', czmID).removeClass('czm-speech-bubble-show');
                });
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** BU DOSYANIN TAM YOLU **********/

            window.getRunningScript = () => {

                return () => {
                    return new Error().stack.match(/([^ \n])*([a-z]*:\/\/\/?)*?[a-z0-9\/\\]*\.js/ig)[0]
                }
            }

            var getCurrentScriptPath = function () {

                var script = getRunningScript()();
                var path = script.substring(0, script.lastIndexOf('/'));
                return path + '/';
            };

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** SOUND **********/

            if ((settings.sound !== false) && (buttonOnline == true)) {

                if ($('#czmSound').length > 0) {

                    $('#czmSound').remove();
                }

                setTimeout(function () {

                    if (settings.sound === true) {

                        settings.sound = getCurrentScriptPath() + 'assets/sound/notification.mp3';
                    }

                    $(czmID).append('<audio id="czmSound" src="' + settings.sound + '" muted></audio>');

                    if ($('#czmSound').length > 0) {

                        var czmSound = document.getElementById('czmSound');

                        if (czmSound !== undefined) {

                            czmSound.play();
                            czmSound.muted = false;
                        }
                    }

                }, 4000);
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** CHANGE BROWSER TITLE **********/

            if ((settings.changeBrowserTitle !== false) && (buttonOnline == true)) {

                var faviconSelect = false;

                if (document.querySelector('link[rel="shortcut icon"]') !== null) {

                    faviconSelect = 'shortcut icon';

                } else if (document.querySelector('link[rel="icon"]') !== null) {

                    faviconSelect = 'icon';
                }

                var isOldTitle = true;
                var changeTitle;
                var oldTitle = $('title').text();

                if (faviconSelect !== false) {

                    var oldFavicon = $('link[rel="' + faviconSelect + '"]').attr('href');
                }

                var newTitle = settings.changeBrowserTitle;
                var newFavicon = getCurrentScriptPath() + 'assets/img/browser-title-number.png';

                $(window).blur(function (e) {

                    $('title').text(newTitle);

                    if (faviconSelect !== false) {

                        $('link[rel="' + faviconSelect + '"]').attr('href', newFavicon);
                    }

                    changeTitle = setInterval(function () {

                        document.title = isOldTitle ? oldTitle : newTitle;

                        if (faviconSelect !== false) {

                            document.querySelector('link[rel="' + faviconSelect + '"]').href = isOldTitle ? oldFavicon : newFavicon;
                        }

                        isOldTitle = !isOldTitle;

                    }, 1000);
                });

                $(window).focus(function (e) {

                    clearInterval(changeTitle);

                    if (faviconSelect !== false) {

                        $('link[rel="' + faviconSelect + '"]').attr('href', oldFavicon);
                    }

                    $('title').text(oldTitle);
                });
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** COOKIE **********/

            if ((settings.cookie !== false) && (buttonOnline == true)) {

                if (getCookie('czmChatSupport') !== 'true') {

                    setCookie('czmChatSupport', true, new Date(new Date().getTime() + (settings.cookie * 60) * 60 * 1000));
                }
            }

            /**************************************************************************************************/
            /**************************************************************************************************/
            /**************************************************************************************************/
            /********** FUNCTION **********/

            function czmHide() {

                $(czmID).toggleClass('czm-popup-show');
            }

            function setCookie(cname, cvalue, exdays) {

                var d = new Date();
                d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
                var expires = "expires=" + d.toUTCString();
                document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
            }

            function getCookie(cname) {

                var name = cname + "=";
                var decodedCookie = decodeURIComponent(document.cookie);
                var ca = decodedCookie.split(';');

                for (var i = 0; i < ca.length; i++) {

                    var c = ca[i];

                    while (c.charAt(0) === ' ') {

                        c = c.substring(1);
                    }

                    if (c.indexOf(name) === 0) {

                        return c.substring(name.length, c.length);
                    }
                }
                return "";
            }

        });
    };

}(jQuery));