Last active
December 9, 2024 08:38
-
-
Save Gesugao-san/cb54425552680333b8eabe52e5be6143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name steam_workshop_subscribe_page_v1.js | |
// @namespace Violentmonkey Scripts | |
// @match https://steamcommunity.com/workshop/browse/* | |
// @grant none | |
// @version 1.0 | |
// @author Gesugao-san | |
// @description huh | |
// ==/UserScript== | |
'use strict'; | |
(function () { | |
console.log('Match!'); | |
})(); | |
//if (window.location.hostname != 'steamcommunity.com') throw "Wrong page."; | |
//if (window.location.pathname != '/workshop/browse/') throw "Wrong path."; | |
const sleep = sec => new Promise(r => setTimeout(r, sec*1000)); | |
const subs_get = () => document.querySelectorAll('span.general_btn.subscribe:not(.toggled)'); | |
const subs_count = () => subs_get().length; // [...subs_get()] | |
async function subs_set() { | |
console.log("Subs available:", subs_count()); | |
await subs_get().forEach(async (button) => { | |
var sleep_var = Number((Math.random()).toFixed(5))*4+1 | |
await sleep(sleep_var); | |
console.log("Subscribing to:", button.id.split('Btn')[1], "sleeping:", sleep_var); | |
button.click(); | |
}); | |
} | |
const scrolls_get = () => document.querySelectorAll('a.pagebtn:not(.disabled)'); | |
var scrolls = scrolls_get(); | |
const scrolls_count = () => scrolls.length; | |
const scrolls_set = () => { | |
scrolls_get().forEach((button, index) => { | |
scrolls[index].innerHTML == '>' ? scrolls[index].click() : null | |
}) | |
}; | |
async function main() { | |
await subs_set(); | |
await sleep(15); | |
await subs_set(); | |
scrolls_set(); | |
} | |
HTMLDocument.prototype.ready = new Promise((r) => { | |
if (document.readyState != "loading") return main(); | |
else document.addEventListener("DOMContentLoaded", () => {return main()}); | |
}); | |
document.ready.then(() => {console.log("document ready")}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.location.hostname != 'steamcommunity.com') return console.error("Wrong page."); | |
if (window.location.pathname != '/workshop/browse/') return console.error("Wrong path."); | |
var inputs = document.querySelectorAll('[data-publishedfileid]'); | |
for (var i = 0; i < inputs.length; i++) { | |
var id_str = inputs[i].dataset.publishedfileid; | |
var id_int = parseInt(id_str); | |
var is_faved = (inputs[i].parentElement.getElementsByClassName('user_action_history_icon favorited').length == 1); | |
VoteUp(id_int); | |
if (!is_faved) FavoriteItem(id_int); | |
SubscribeItem(id_str, '294100'); | |
} | |
var nextp = document.querySelectorAll('a.pagebtn:not(.disabled)'); // https://stackoverflow.com/a/38788621/8175291 | |
if (nextp.lenght != 1) return console.log(nextp); | |
nextp[0].click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment