Fixbug under MacOS

(Omar Boumeddane)
This commit is contained in:
bgigon 2004-09-28 12:33:22 +00:00
parent eb72210527
commit 1aaeda43be

View File

@ -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
<tr>
<td style="background:buttonface" valign=center><div style="background-color: #000000; padding: 1; height: 21px; width: 50px"><div id="ColorPreview" style="height: 100%; width: 100%"></div></div></td>
<td style="background:buttonface" valign=center><input type="text" name="ColorHex"
id="ColorHex" value="" size=15 style="font-size: 12px"></td>
id="ColorHex" value="" size=15 style="font-size: 12px"></td>
<td style="background:buttonface" width=100%></td>
</tr>
</table>
</form>
<table border="0" cellspacing="1px" cellpadding="0px" width="100%" bgcolor="#000000" style="cursor: hand;">
<table border="0" cellspacing="0px" cellpadding="0px" width="100%" bgcolor="#000000" style="cursor: hand;">
<tr>
<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>
<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>