improved color and zoom parameters reading

This commit is contained in:
e7d 2017-05-14 11:32:59 +02:00
parent 8a1a661c3b
commit ea65dac594

View File

@ -41,6 +41,12 @@ class Gamepad {
window.addEventListener("keydown", this.onKeyDown.bind(this)); window.addEventListener("keydown", this.onKeyDown.bind(this));
window.setInterval(this.scanGamepads.bind(this), this.scanGamepadsDelay); window.setInterval(this.scanGamepads.bind(this), this.scanGamepadsDelay);
this.params = {
gamepadColor: $.urlParam('color') || $.urlParam('c') || null,
zoom: $.urlParam('zoom') || $.urlParam('z') || null
};
this.displayGamepadHelp(); this.displayGamepadHelp();
} }
@ -177,18 +183,11 @@ class Gamepad {
).done((template) => { ).done((template) => {
this.$gamepad.html(template); this.$gamepad.html(template);
if ($.urlParam('color')) { if (this.params.gamepadColor) {
this.changeGamepadColor($.urlParam('color')); this.changeGamepadColor(this.params.gamepadColor);
} }
if ($.urlParam('c')) { if (this.params.zoom) {
this.changeGamepadColor($.urlParam('c')); this.changeZoom(this.params.zoom);
}
if ($.urlParam('zoom')) {
this.changeZoom($.urlParam('zoom'));
}
if ($.urlParam('z')) {
this.changeZoom($.urlParam('z'));
} }
this.mapping.buttons = []; this.mapping.buttons = [];