diff --git a/phpgwapi/js/colorpicker/select_color.html b/phpgwapi/js/colorpicker/select_color.html index 5e2613e3b6..cc3743d1a9 100644 --- a/phpgwapi/js/colorpicker/select_color.html +++ b/phpgwapi/js/colorpicker/select_color.html @@ -23,15 +23,28 @@ function _CloseOnEsc() { var id; function Init() { // run on page load - document.body.onkeypress = _CloseOnEsc; + document.body.onkeypress = _CloseOnEsc; - id = location.search.match(/id=([^&]+)/); - if (id) id = decodeURIComponent(id[1]); - var color = location.search.match(/color=([^&]+)/); - if (color) color = decodeURIComponent(color[1]); - //alert('id='+id+', color='+color); - color = ValidateColor(color) || '000000'; - View(color); // set default color + id = location.search.match(/id=([^&]+)/); + var color = location.search.match(/color=([^&]+)/); + + if ( navigator.userAgent.toLowerCase().indexOf("mac")!=-1 ) + { + if (id) id = id[1] ; + + if (color) color = color[1]; + + } + else + + { + if (id) id = decodeURIComponent(id[1]); + + if (color) color = decodeURIComponent(color[1]); + } + //alert('id='+id+', color='+color); + color = ValidateColor(color) || '000000'; + View(color); // set default color } function View(color) { // preview color @@ -39,12 +52,14 @@ function View(color) { // preview color document.getElementById("ColorHex").value = '#' + color; } -function Set(string) { // select color +function Set(string) { +//alert (Set + // select color var color = ValidateColor(string); if (color == null) { alert("Invalid color code: " + string); } // invalid color else { // valid color View(color); // show selected color - var input=opener.document.getElementById(id); + var input=window.top.opener.document.getElementById(id); if (input) input.value = '#'+color; else alert('id='+id+' is not a valid id in opener !!!'); window.close(); @@ -76,13 +91,13 @@ function ValidateColor(string) { // return valid color code