From c295676f0b6cad552dc6ea66bff2cb056ca79e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Tr=C3=A4ger?= Date: Mon, 27 Jun 2016 01:42:36 +0200 Subject: [PATCH 1/2] added color picker --- index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.html b/index.html index e6762ab..e7c02e4 100644 --- a/index.html +++ b/index.html @@ -417,6 +417,18 @@ } else if (input.type === 'color') { element = document.createElement('input'); + //colorPicker + var color = document.createElement('input'); + color.type = 'color'; + color.addEventListener('change', function(elem){ + var screen = elem; + return function(e){ + screen.value = e.target.value; + screen.dispatchEvent(new Event('change')); + } + }(element)); + cell.appendChild(color); + //element.addEventListener('click', function(e) { // e = e || window.event; // colorPicker(e); From a470a0f4e336601a6b04a3e347f892f7713ada0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Tr=C3=A4ger?= Date: Mon, 27 Jun 2016 01:45:56 +0200 Subject: [PATCH 2/2] refactored variable in colorpicker --- index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e7c02e4..9283af0 100644 --- a/index.html +++ b/index.html @@ -420,12 +420,11 @@ //colorPicker var color = document.createElement('input'); color.type = 'color'; - color.addEventListener('change', function(elem){ - var screen = elem; + color.addEventListener('change', function(screen){ return function(e){ screen.value = e.target.value; screen.dispatchEvent(new Event('change')); - } + }; }(element)); cell.appendChild(color);