Drive2 Auto Liker

Жму "Нравится" всем подряд.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Drive2 Auto Liker
// @namespace    drive2.ru
// @version      0.3
// @description  Жму "Нравится" всем подряд.
// @author       philins
// @match        https://www.drive2.ru/*
// @grant        none
// ==/UserScript==

var nIntervId;

nIntervId = setInterval(autoClick,1000);

function autoClick(){
    var flag = true;
    var buttons = document.getElementsByClassName("c-like__button");
    for(var i = 0; i < buttons.length; i++){
        //if (noClass(buttons[i]," is-off ") && noClass(buttons[i]," c-button--s ")) {
        var action = buttons[i].getAttribute("data-tt")
        if (action=="Нравится"){
            buttons[i].click();
            flag = false;
        }
    }
    if (flag) {
        clearInterval(nIntervId);
        setTimeout(clickNext, 3000);
    }
}

function clickNext(){
    var nextbutton = document.getElementsByClassName("c-pager__link");
    if(nextbutton.length > 0){
        var nextClicked = false;
        for(var j = 0; j < nextbutton.length; j++){
            if (nextbutton[j].getAttribute('rel')=="next") {
                nextbutton[j].click();
                nextClicked = true;
            }
        }
        if(!nextClicked){
            for(var k = 0; k < nextbutton.length; k++){
                if (nextbutton[k].getAttribute('rel')=="start") {
                    nextbutton[k].click();
                }
            }
        }
    }
}

function noClass(e,c){
    var className = " "+ c +" ";
        if ((" " + e.className + " ").replace(/[\t\r\n\f]/g, " ").indexOf(c) < 0) {
            return true;
        }
}