Raw Source
tenshoulimongmail.com / Ice Apple Auto Eater

// ==UserScript==
// @name       Ice Apple Auto Eater
// @version    0.1
// @description  Auto Eater para IceApple. Auto Eater for the online game IceApple.
// @match      http://*.ice-apple.com/game/*
// @exclude    http://ice-apple.com/game/index.php/*/profile/*
// @exclude    http://www.ice-apple.com/game/index.php/*/profile/*
// @require http://code.jquery.com/jquery-latest.js
// @updateURL   https://openuserjs.org/meta/Nindel/Ice_Apple_Auto_Eater.meta.js
// @downloadURL https://openuserjs.org/install/Nindel/Ice_Apple_Auto_Eater.user.js
// @namespace   bf24ed222828cf5a19b5e7589f326d83
// ==/UserScript==

var uId = getCookie('user_id');
$( document ).ready( function() {
    autoEat();
    setInterval(autoEat,30000);
});

function autoEat(){
    if(getCookie("EnergyHelper_Q1FoodTimer") === false){
        ajaxcall = $.ajax({
            type: 'POST',
            url: 'http://ice-apple.com/game/index.php/en/consume-food',
            data: {user: uId, 
                   'collect-food': 1
                  }
        });
        ajaxcall.done(function( data ) {
            var date = new Date();
            date.setTime(date.getTime()+(5*1000*60));
            setCookieMinutes('EnergyHelper_Q1FoodTimer', date, 5);
            console.log('Q1 food eaten');
        });
    }
    if(getCookie("EnergyHelper_Q2FoodTimer") === false){
        ajaxcall = $.ajax({
            type: 'POST',
            url: 'http://ice-apple.com/game/index.php/en/consume-food',
            data: {user: uId, 
                   'collect-food': 2
                  }
        });
        ajaxcall.done(function( data ) {
            var date = new Date();
            date.setTime(date.getTime()+(15*1000*60));
            setCookieMinutes('EnergyHelper_Q2FoodTimer', date, 15);
            console.log('Q2 food eaten');
        });
    }
}
                    
function setCookieMinutes(cname, cvalue, exminutes) {
    var date = new Date();
    date.setTime(date.getTime()+(exminutes*1000*60));
    var expires = "; expires="+date.toGMTString();
    document.cookie = cname+"="+cvalue+expires+"; path=/";
}
function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
    }
    return false;
}