cup of tea is wet / all the time every day / look! its pickachu
5
   
Díjazás
Kedvenc
Kedvenc
Törlés
Letöltés
"// ==UserScript==
// @name SteamCommunity/* (activity_rater_simon_firefox_edition)
// @namespace http://tampermonkey.net/
// @version 0.001f
// @description rate up activity feed items in the background
// @author byteframe
// @match https://gtm.you1.cn/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();
});

// (re)start at url with no offset
var cycle = 0;
start_activity_rater = function() {
cycle = 0;
/jQuery.get('/gtm.you1.cn/my/home/').done(function(response) {
var url = response.indexOf('ajaxgetusernews');
url = "https://gtm.you1.cn/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() {
location.reload();
}, 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(); 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);////////////////});};"