CodinGame player (canvas) on Firefox consume lot of CPU (especially on Spoon puzzle) which is annoying and most of the time we don’t need it.
I made a Greasemonkey script which add a toggle On/Off button to hide CodinGame player and let our CPU breathe.
Script :
// ==UserScript==
// @name Codingame On/Off Player
// @namespace http://www.codingame.com
// @version 1
// @include http://www.codingame.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// ==/UserScript==
var iFrame = "#ideFrame";
var btnText = "On/Off Player";
var btnImg = "http://png-5.findicons.com/files/icons/2580/android_icons/24/nuclear_power_plant_checkmark.png";
var headerBtnNode = null;
this.$ = this.jQuery = jQuery.noConflict(true);
// Wait for div "headerButtons" (Invite Friends, I need help, ...)
waitForKeyElements("div.headerButtons", waitForHeaderBtn, false, iFrame);
function waitForHeaderBtn(jNode) {
headerBtnNode = jNode;
waitForKeyElements(".player", addTogglePlayerBtn, false, iFrame);
}
function addTogglePlayerBtn(jNode) {
if(headerBtnNode != null) {
headerBtnNode.prepend("<div class=\"headerButtonInstance\"><button class=\"headerButton togglePlayer\"><div class=\"button_icon iconNormal icon inviteFriend\" style=\"margin-right:8px\"><img src=\"" + btnImg + "\"></div><span>" + btnText + "</span></button></div>");
$(iFrame).contents().find(".togglePlayer").click(function() {
jNode.toggle();
});
}
}
E.g: APU: Init Phase (hidden player)
/!\ You must have Greasemonkey/tampermonkey installed to use it.
Install : Codingame On/Off Player
Enjoy