MonkeyMan / IA Q1-Q2 Auto food eaten

// ==UserScript==
// @name         IA Q1-Q2 Auto food eaten
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Auto eater Q1-Q2 food to IA game By "El Mono" :D
// @match      http://*ice-apple.com/*
// @exclude    http://ice-apple.com/*/profile/*
// @exclude    http://www.ice-apple.com/*/profile/*
// @author       MonoIA
// @match        
// ==/UserScript==

(function() {
    'use strict';

    // 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/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/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;
    }

})();