// source --> https://noixdecocon.com/wp-content/plugins/to-top/public/js/to-top-public.js?ver=3.1 
(function($) {
    "use strict";
    $(function() {
        var container = $("#to_top_scrollup").css({
            'opacity': 0
        });
        var data = to_top_options;

        var mouse_over = false;
        var hideEventID = 0;

        var fnHide = function() {
            clearTimeout(hideEventID);
            if (container.is(":visible")) {
                container.stop().fadeTo(200, 0, function() {
                    container.hide();
                    mouse_over = false;
                });
            }
        };

        var fnHideEvent = function() {
            if (!mouse_over && data.enable_autohide == 1 ) {
                clearTimeout(hideEventID);
                hideEventID = setTimeout(function() {
                    fnHide();
                }, data.autohide_time * 1000);
            }
        };

        var scrollHandled = false;
        var fnScroll = function() {
            if (scrollHandled)
                return;

            scrollHandled = true;

            if ($(window).scrollTop() > data.scroll_offset) {
                container.stop().css("opacity", mouse_over ? 1 : parseFloat(data.icon_opacity/100)).show();

                    fnHideEvent();

            } else {
                fnHide();
            }

            scrollHandled = false;
        };

        if ("undefined" != typeof to_top_options.enable_hide_small_device && "1" == to_top_options.enable_hide_small_device) {
            if ($(window).width() > to_top_options.small_device_max_width) {
                $(window).on( "scroll", fnScroll);
                $(document).on( "scroll", fnScroll);
            }
        }else{
            $(window).on( "scroll", fnScroll);
            $(document).on( "scroll", fnScroll);
        }

        container.on( "hover", function() {
                clearTimeout(hideEventID);
                mouse_over = true;
                $(this).css("opacity", 1);
            }, function() {
                $(this).css("opacity", parseFloat(data.icon_opacity/100));
                mouse_over = false;
                fnHideEvent();
            })
            .on( "click", function() {
                $("html, body").animate({
                    scrollTop: 0
                }, 400);
                return false;
            });
    });
})(jQuery);
// source --> https://noixdecocon.com/wp-content/plugins/email-encoder-bundle/assets/js/custom.js?ver=2c542c9989f589cd5318f5cef6a9ecd7 
/* Email Encoder */
/*global jQuery, window*/
jQuery(function ($) {

    'use strict';

    // encoding method
    function rot13(s) {
        // source: http://jsfromhell.com/string/rot13
        return s.replace(/[a-zA-Z]/g, function (c) {
            return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
        });
    }

    /**
     * EMAIL RELATED LOGIC
     */

    // fetch email from data attribute
    function fetchEmail(el) {
        var email = el.getAttribute('data-enc-email');

        if (!email) {
            return null;
        }

        // replace [at] sign
        email = email.replace(/\[at\]/g, '@');

        // encode
        email = rot13(email);

        return email;
    }

    // replace email in title attribute
    function parseTitle(el) {
        var title = el.getAttribute('title');
        var email = fetchEmail(el);

        if (title && email) {
            title = title.replace('{{email}}', email);
            el.setAttribute('title', title);
        }
    }

    // set input value attribute
    function setInputValue(el) {
        var email = fetchEmail(el);

        if (email) {
            el.setAttribute('value', email);
        }
    }

    // open mailto link
    function mailto(el) {
        var email = fetchEmail(el);

        if (email) {
            window.location.href = 'mailto:' + email;
        }
    }
    
    // revert
    function revert(el, rtl) {
        var email = fetchEmail(el);

        if (email) {
           rtl.text(email);
           rtl.removeClass('eeb-rtl');
        }
    }

    // prepare for copying email
    document.addEventListener('copy', function(e){
        $('a[data-enc-email]').each(function () {
            var rtl = $(this).find('.eeb-rtl');

            if (rtl.text()) {
                revert(this, rtl);
            }
        });
        console.log('copy');
    });

    // set mailto click
    $('body').on('click', 'a[data-enc-email]', function () {
        mailto(this);
    });

    // parse title attirbute
    $('a[data-enc-email]').each(function () {
        parseTitle(this);
    });

    // parse input fields
    $('input[data-enc-email]').each(function () {
        setInputValue(this);
    });

});