jQuery(document).ready(function($) {
    // Shortcode kopieren
    $('#simpbook-copy-shortcode').on('click', function() {
        var shortcode = $('#simpbook-shortcode-text').text();
        var $temp = $('<input>');
        $('body').append($temp);
        $temp.val(shortcode).select();
        document.execCommand('copy');
        $temp.remove();

        // Feedback
        var $btn = $(this);
        var originalText = $btn.html();
        $btn.html('<span class="dashicons dashicons-yes"></span> ' + simpbookDashboard.translations.copied);
        $btn.addClass('button-success');

        setTimeout(function() {
            $btn.html(originalText);
            $btn.removeClass('button-success');
        }, 2000);
    });
});
