Workshop Sub Presser lol

Subs to every steam addon on the current workshop page

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Workshop Sub Presser lol
// @namespace    https://steamcommunity.com/workshop/browse/?*
// @version      0.1
// @description  Subs to every steam addon on the current workshop page
// @author       GEGAKE
// @match        https://steamcommunity.com/workshop/browse/?*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var url = location.href
    var splited = url.split("&p=")

    var pageNum = parseInt(splited[1])

    // alert("After this Message the Workshop Sub Presser lol will begin to press da buttons " + splited[0]);

    function sub() {
        var buttons = document.getElementsByClassName("general_btn subscribe");

        for(var i = 0; i < buttons.length; i++) {
            buttons[i].click()
            console.log(buttons[i])
        }
    }

    function nextPage(){
       location.href = splited[0] + "&p=" + Math.floor(pageNum + 1).toString();
    }


    sub();
    setTimeout(nextPage, 2000);

    // alert("next")
})();