i love, my puppy. / he is so cute, and awesome. / i love, my puppy.
4
   
Award
Favorite
Favorited
Unfavorite
Download
"// ==UserScript==
// @name SteamCommunity/* (activity_rater_simon_chrome)
// @namespace http://tampermonkey.net/
// @version 0.002c
// @description rate up activity feed items in the background
// @author byteframe
// @match *:/steamproxy.com/*
// @grant unsafeWindow
// @grant GM_notification
// @connect *
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// ==/UserScript==

const VOTE_DELAY = 6000;
const SCROLL_DELAY = 90000;
const CYCLES = 20;

unsafeWindow.get_url = function() {
return jQuery("#global_actions").find(".playerAvatar")[0].href;
};

// override vote functions with corrected/condensed code
unsafeWindow.VoteUp = function(item_id) {
jQuery.post('/steamproxy.com/sharedfiles/voteup', {
id: item_id,
sessionid: g_sessionID
}).done(function(response) {
console.log('voted up item: ' + item_id);
}).fail(function(response) {
console.log('ERROR vote item error: ' + item_id);
});
return false;
};
unsafeWindow.VoteUpCommentThread = function(thread) {
thread = thread.split('_');
jQuery.post('/steamproxy.com/comment/' + thread[0] + '/voteup/' + thread[1] +
'/' + thread[2] + "/", {
vote: 1,
count: thread[0] == 'UserReceivedNewGame' ? 3 : 6,
sessionid: g_sessionID,
newestfirstpagination: true
}).fail(function(response) {
console.log('ERROR vote thread error: ' + thread);
}).done(function(response) {
console.log('voted up thread: ' + thread);
});
};
unsafeWindow.RateAnnouncement = function (url, gid, voteup) {
jQuery.post(url + gid, {
voteup: true,
sessionid: g_sessionID
}).fail(function(response) {
console.log('ERROR rate_announcement error: ' + gid);
}).done(function(response) {
console.log('voted announcement: ' + gid);
});
};

// (re)start at url with no offset
var cycle = 0;
unsafeWindow.start_activity_rater = function() {
cycle = 0;
jQuery.get('/steamproxy.com/my/home/'
).done(function(response) {
var url = response.indexOf('ajaxgetusernews');
url = get_url() + response.slice(url, response.indexOf('?', url));

// request url for older content using latest offset
(function request_older_activity(url, delay = 0) {
setTimeout(function() {
cycle++;
if (cycle == CYCLES+1) {
setTimeout(function() {
start_activity_rater();
}, SCROLL_DELAY*8);
return true;
}
jQuery.get(url, function(response) {
if (!response || response.success !== true || !response.blotter_html) {
console.log("ERROR, request_older_activity: " + cycle);
setTimeout(start_activity_rater, SCROLL_DELAY);
} else {
var html = jQuery(response.blotter_html);
url = response.next_request;

// find and vote on new feed items
var total = html.find('[id^="vote_up_"]').add(
html.find('[id^="VoteUpBtn_"]'));
var votes = total.not(".active").not(".btn_active");
console.log('t: ' + total.length + ', u: ' + votes.length +
', c: ' + cycle + ', d: ' + delay + " | " +
url.replace(/.*\?start=/, ''));
var vote = function(i = 0) {
votes.click(); if (i < votes.length-1) { setTimeout(vote, Math.random()*(VOTE_DELAY-VOTE_DELAY/2)+VOTE_DELAY/2, i+1); } else { request_older_activity(url, SCROLL_DELAY); } }; if (!total.length) { if (cycle == 1) { console.log('error: empty activity feed!'); } else { console.log('ERROR empty activity feed: ' + cycle); } setTimeout(function() { start_activity_rater(); }, SCROLL_DELAY); } else { if (votes.length) { vote(); } else { request_older_activity(url, SCROLL_DELAY); } } } }); }, delay); })(url); });};"