Steam Community - All Greenlight Items Voter

Votes yes or no to all greenlight items (you can set your own filters)

As of 2016-06-20. See the latest version.

Author
Revadike
Ratings
0 0 0
Version
0.1
Created
2016-06-20
Updated
2016-06-20
License
N/A
Applies to

// ==UserScript==
// @name Steam Community - All Greenlight Items Voter
// @namespace Royalgamer06
// @version 0.1
// @description Votes yes or no to all greenlight items (you can set your own filters)
// @author Royalgamer06
// @include *://steamcommunity.com/workshop/browse/?appid=765*
// @grant none
// ==/UserScript==

function voteAll(method) {
var modal = ShowBlockingWaitDialog("Executing…", "Please wait until all requests finish. \nThe page will automatically reload when it is finished.");
var appid = location.href.split("appid=")[1].split("&")[0];
var sessionid = g_sessionID;
var pageinfo = jQuery(".workshopBrowsePagingInfo").text().replace(",", "");
var split = pageinfo.split(" ");
var total = 0;
for (var i = 0; i < split.length; i++) {
if (split[i].match(/^[0-9]+$/) !== null) {
total = parseInt(split[i]);
}
}
var loaded = 1;
var lastpage = Math.ceil(total/30);
for (var p = 1; p <= lastpage; p++) {
var url = location.href;
if (url.indexOf("p=") > -1) {
url = url.split("p=")[0] + "p=" + p + url.split("p=")[1].replace(url.split("p=")[1].split("&")[0], "");
} else {
url = url + "&p=" + p;
}
jQuery.get(url, function(data) {
var s = jQuery(data).find(".workshopItemPreviewHolder");
for (var i = 0; i < s.length; i++) {
var wsid = s[i].getAttribute("id").replace("sharedfile_","");
jQuery.post("http://steamcommunity.com/sharedfiles/" + method, { id: wsid, sessionid: sessionid }).always(function() {
loaded++;
modal.Dismiss();
if( loaded >= total ) {
location.reload();
} else {
modal = ShowBlockingWaitDialog( 'Executing…', 'Loaded ' + loaded + '/' + total + '.' );
}
});
}
});
}
}

jQuery(document).ready(function() {
var html = '

Greenlight Items:


';
jQuery(".panel:first").prepend(html);
document.getElementById("allyes").onclick = function() { voteAll("voteup"); };
document.getElementById("allno").onclick = function() { voteAll("votedown"); };
});