vic4884
9/4/2019 - 8:17 AM

Take a screenshot and copy to clipboard

Take a screenshot and copy to clipboard

jQuery(document).ready(function(){
    
    //активация первого пункта контета
    $('.w--tab-active .w-dyn-item:first-child a').addClass('active');
    
    $('.thumb-core a').attr("id", "target")
    
    let tab_link_attr = $('a[data-w-tab]').attr('data-w-tab');
    
    let link_first_block = $('div[data-w-tab="' + tab_link_attr + '"] .w-dyn-item:first-child a.active').attr("href");
            
    $('.thumb-core a').attr("href", "https://www.thomassantos.com" + link_first_block).css("background","transparent");
    
    let image_first_block = $('div[data-w-tab="' + tab_link_attr + '"] .w-dyn-item:first-child a.active img').attr("src");
    
    $('.thumb-core a').append("<img src='" + image_first_block + "'>").css({
        "border-radius": "5px",
        "overflow": "hidden"
    });
    
    
     $(".thumb-core a").on("click",function(e){
            e.preventDefault();
        });
    
    $('a[data-w-tab]').each(function(){
        
        $(this).on("click", function(){
           
            $('.w-tab-content a').each(function(){
               $(this).removeClass('active');
            });
             
            let tab_link_attr = $(this).attr('data-w-tab');
            
            $('div[data-w-tab="' + tab_link_attr + '"] .w-dyn-item:first-child a').addClass('active');
            
            
            let link_first_block = $('div[data-w-tab="' + tab_link_attr + '"] .w-dyn-item:first-child a.active').attr("href");
            
            $('.thumb-core a').attr("href", "https://www.thomassantos.com" + link_first_block).css("background","transparent");;
            
            let image_first_block = $('div[data-w-tab="' + tab_link_attr + '"] .w-dyn-item:first-child a.active img').attr("src");
            
            $('.thumb-core a').empty();
    
            $('.thumb-core a').append("<img class='img_content' src='" + image_first_block + "'>").css({
                "border-radius": "5px",
                "overflow": "hidden"
            });
        });
    });
    
    $("a.tab-card").each(function(){
        $(this).on("click", function(e){
            
            e.preventDefault();
             
            let current_link = $(this).attr("href");
            
            $('.thumb-core a').attr("href", "https://www.thomassantos.com" + current_link);
            
            let current_image_link = $(this).find("img").attr("src");
            
             $('.thumb-core a').empty();
            
             $('.thumb-core a').append("<img class='img_content' src='" + current_image_link + "'>").css({
                "border-radius": "5px",
                "overflow": "hidden"
            });
            
        });
    });
    
    
    //вешаем на кнопку цель
    $('.thumb-img-button').attr("data-clipboard-target", "#target").addClass('clipboard');
    
    $('.thumb-img-button div:first-child').on("click", function(){
        $(this).text("Done!");
        setTimeout(function(){
            $('.thumb-img-button div:first-child').text("Copy to clipboard");
        }, 2000);
    });
    
    
    var clipboard = new ClipboardJS('.clipboard');
                clipboard.on('success', function(e) {
                    console.log(e);
                });
                clipboard.on('error', function(e) {
                    console.log(e);
            });
    
});