How do I beat level 7?

You can get past all the gates using the code below:

if(player.getColor()=='#f00')
   player.setColor('#ff0');
else if(player.getColor()=='#ff0')
   player.setColor('#0f0');
else
   player.setColor('#f00');

Basically, it makes it so every time you hit Q, you change to the color of the next gate.
Green -> Red -> Yellow -> Green

Finish


If you have solved it once, now you can play with it, improving the code. Thinking what else you can do, for example you can do something ugly and funny:

player.setPhoneCallback(function () {
  var i = 66;
  var callback = function(){
    player.setColor("#" + ((--i % 3) > 0 ? 'f' : '0') + ((i + 1) % 3 > 0 ? 'f' : '0') + '0')
  }
  return callback;
}());
(function doNothingHack(){ 
});

Also we can see that f00, ff0 and 0f0 can be represented as 100, 110, and 010, and this, as you can see are just 3 small integers (2, 3, 1) represented as binary. So modulo arithmetic, decimal to binary conversion then replace 1 with f, and we have another such solution.