From 1e764c1c1ddf1232f8728ee65c5dbfa7acb672c0 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 8 May 2013 20:24:29 +0200 Subject: [PATCH] Colorpicker improvement --- wcfsetup/install/files/js/WCF.ColorPicker.js | 30 ++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.ColorPicker.js b/wcfsetup/install/files/js/WCF.ColorPicker.js index e9134ecb40..4ddf1c7c87 100644 --- a/wcfsetup/install/files/js/WCF.ColorPicker.js +++ b/wcfsetup/install/files/js/WCF.ColorPicker.js @@ -237,17 +237,37 @@ WCF.ColorPicker = Class.extend({ this._hex = $('').appendTo($hex.find('label')); // bind event listener - this._rgba.r.blur($.proxy(this._blurRgba, this)); - this._rgba.g.blur($.proxy(this._blurRgba, this)); - this._rgba.b.blur($.proxy(this._blurRgba, this)); - this._rgba.a.blur($.proxy(this._blurRgba, this)); - this._hex.blur($.proxy(this._blurHex, this)); + this._rgba.r.blur($.proxy(this._blurRgba, this)).keyup($.proxy(this._keyUpRGBA, this)); + this._rgba.g.blur($.proxy(this._blurRgba, this)).keyup($.proxy(this._keyUpRGBA, this)); + this._rgba.b.blur($.proxy(this._blurRgba, this)).keyup($.proxy(this._keyUpRGBA, this)); + this._rgba.a.blur($.proxy(this._blurRgba, this)).keyup($.proxy(this._keyUpRGBA, this)); + this._hex.blur($.proxy(this._blurHex, this)).keyup($.proxy(this._keyUpHex, this)); // submit button var $submitForm = $('
').appendTo(this._dialog); $('').appendTo($submitForm).click($.proxy(this._submit, this)); }, + /** + * Submits form on enter. + */ + _keyUpRGBA: function(event) { + if (event.which == 13) { + this._blurRgba(); + this._submit(); + } + }, + + /** + * Submits form on enter. + */ + _keyUpHex: function(event) { + if (event.which == 13) { + this._blurHex(); + this._submit(); + } + }, + /** * Assigns the new color for active element. */ -- 2.20.1