G.Leo.Li / Clicky PageView For Platform

// ==UserScript==
// @name         Clicky PageView For Platform
// @namespace    https://clicky.com/
// @version      0.1
// @description  get the sum of actions
// @author       Guang Li
// @match        https://clicky.com/stats/platforms?*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    $(document).ready(function(){
        window.go = function(url,hash_set_func){
            location.href=url;
        };
    });

    var actions_amount = 0;
    var done = false;
    $('#main-ajax #graphy tbody tr').each(function(){
        if (done) {
            return true;
        }
        var tds = $('td', this);
        if (tds.length < 5) {
            tds.eq(2).html('Actions: ' + Math.round(actions_amount));
            done = true;
        } else {
            var visitors = parseFloat(tds.eq(2).text().replace(',','')) || 0;
            var avg_actions = parseFloat(tds.eq(4).text()) || 0;
            actions_amount = actions_amount + (visitors * avg_actions);
//            console.log(visitors + avg_actions + actions_amount);
        }
    });
})();