VK Save+Like

Auto "Like" after click "Save image"

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         VK Save+Like
// @namespace    http://tampermonkey.net/
// @version      2
// @description  Auto "Like" after click "Save image"
// @author       stalkermiha
// @match        https://vk.com/*
// ==/UserScript==

document.addEventListener('click',function(e){
    var img_class_list = e.srcElement.className.split(' ');
    var img_id = e.srcElement.id;
    //console.log(img_class_list[0]);
    //console.log(img_id);
    if(img_class_list[0] == 'page_post_thumb_wrap' || img_id == 'pv_photo'){
        var timerId = setTimeout(function(){
            if(document.querySelector('#layer_wrap a.like_btn.like._like')){
                var onclickButtonStart = document.querySelector('#layer_wrap a.like_btn.like._like').getAttribute('onclick');
                //console.log(onclickButtonStart);
                var onclickButtonEnd = onclickButtonStart+"Photoview.savePhoto();";
                document.querySelector('#layer_wrap #pv_save_to_me').setAttribute('onclick',onclickButtonEnd);
                clearInterval(timerId);
                //console.log('close');
            }else{
                //console.log('search');
            }
        },500);
    }
    //console.log(img_class_list);
});