/** settings **/
window.onload = function() {
    if (window.jQuery) {
        jQuery(document).ready(function($) {

          	// settings
            var $colorPicker = $('.daily-readings-color-picker-field');
            if ($colorPicker && $colorPicker.length > 0) {
                $colorPicker.wpColorPicker();
            }

            // settings
            $('#daily-readings-shortcode').on("click", function() {

                copyToClipboard();

                $('#daily-readings-snackbar').addClass("show");
                setTimeout(function(){ 
                    $('#daily-readings-snackbar').removeClass("show");
                }, 3000);
            });

            function copyToClipboard() {
                var $temp = $("<input>");
                $("body").append($temp);
                $temp.val($('#daily-readings-shortcode').text()).select();
                document.execCommand("copy");
                $temp.remove();
            }

        });

    }
}
