Implicit support for initial rgb()-values for the color picker
authorAlexander Ebert <ebert@woltlab.com>
Tue, 27 Feb 2018 11:15:24 +0000 (12:15 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 27 Feb 2018 11:15:24 +0000 (12:15 +0100)
wcfsetup/install/files/js/WCF.ColorPicker.js

index 44324f52f7c9a0f7fcbeb9132efefb9ad2c8f3c2..57e72da0cad96869bb9fcf4537698bc1fb8a51ae 100644 (file)
@@ -182,6 +182,11 @@ if (COMPILER_TARGET_DEFAULT) {
                                this._rgba.a.val(parseInt(element.data('alpha')));
                        }
                        else {
+                               // implicit support for initial rgb()-values
+                               if (element.data('color').match(/^rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)$/)) {
+                                       element.data('color', 'rgba(' + RegExp.$1 + ', ' + RegExp.$2 + ', ' + RegExp.$3 + ', 1)');
+                               }
+                               
                                if (this._rgbaRegExp === null) {
                                        this._rgbaRegExp = new RegExp("^rgba\\((\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3}), ?(1|1\\.00?|0|0?\\.[0-9]{1,2})\\)$");
                                }