Oh Effie Trinket / Your mahogany is doomed / Beware of Katniss
3
   
Award
Favorite
Favorited
Unfavorite
Download
"

/* XXX FAILURE this is all trying to do it with post request and FIREFOX


// ==UserScript==
// @name SteamCommunity/* (activity_rater_simon_firefox_edition)
// @namespace http://tampermonkey.net/
// @version 0.0025f
// @description rate up activity feed items in the background
// @author byteframe
// @match https://gtm.steamproxy.vip/id/a_t_h_f/home
// @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;

// start script on page load
jQuery(document).ready(function() {
console.log("activity_rater_simon_firefox_edition, starting...");
start_activity_rater();
});

// override vote functions with corrected/condensed code
VoteUp1 = function(item_id) {
console.log(item_id);
jQuery.post('/gtm.steamproxy.vip/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;
};
VoteUpCommentThread1 = function(thread) {
console.log(thread);
thread = thread.split('_');
jQuery.post('/gtm.steamproxy.vip/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);
});
};
RateAnnouncement1 = 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;
start_activity_rater = function() {
cycle = 0;
jQuery.get('/gtm.steamproxy.vip/my/home/').done(function(response) {
var url = response.indexOf('ajaxgetusernews');
url = "https://gtm.steamproxy.vip/id/a_t_h_f/" + 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=/, ''));
vote = function(i = 0) {
//##############################################################################
//votes.click();
//console.log(votes.attributes['onclick'].value.substr(7))
//eval(votes.attributes['onclick'].value.substr(7));
var vote_element = votes.attributes['onclick'].value.substr(7).split("(");
vote_element[1] = vote_element[1].slice(0,-2);
if (vote_element[0] == 'VoteUp') {
console.log(vote_element[1]);
jQuery.post('https://gtm.steamproxy.vip/sharedfiles/voteup', {
id: vote_element[1],
sessionid: g_sessionID
}).always(function(response) {
console.log('voted up item: ' + vote_element[1]);
}).fail(function(response) {
console.log('ERROR vote item error: ' + vote_element[1]);
});
} else if (vote_element[0] == 'VoteUpCommentThread') {
console.log('todo1');
} else if (vote_element[0] == 'RateAnnouncement') {
console.log('todo2');
}
window[vote_element[0]](vote_element[1].slice(0,-2));
// click not actually work no wait it does
//##############################################################################
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!');
setTimeout(function() {
start_activity_rater();
}, SCROLL_DELAY);
} else {
console.log('ERROR empty activity feed: ' + cycle);
}
} else {
if (votes.length) {
vote();
} else {
request_older_activity(url, SCROLL_DELAY);
}
}
}
});
}, delay);
})(url);
});
};*/
"