From: Lo?c C. <lo...@us...> - 2001-04-17 19:45:56
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv8302/chat/lib/index_libs Modified Files: set_msg_color.lib.js Log Message: The color picker has been rewritten in JavaScript Index: set_msg_color.lib.js =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/set_msg_color.lib.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** set_msg_color.lib.js 2001/04/03 20:15:39 1.1 --- set_msg_color.lib.js 2001/04/17 19:45:53 1.2 *************** *** 24,32 **** var jsImgColor1 = new Image(4,20); jsImgColor1.src = jsChatPath + 'images/unsel_color.gif'; var jsImgColor2 = new Image(4,20); jsImgColor2.src = jsChatPath + 'images/sel_color.gif'; ! var jsSelectedColor = null; --- 24,89 ---- + var jsSelectedColor = null; var jsImgColor1 = new Image(4,20); jsImgColor1.src = jsChatPath + 'images/unsel_color.gif'; var jsImgColor2 = new Image(4,20); jsImgColor2.src = jsChatPath + 'images/sel_color.gif'; ! ! ! /** ! * Prepares the color picker ! * ! * @param string hex value of the current color ! * ! * @return boolean always true ! * ! * @access public ! */ ! function pmcSetColorPicker(theCurrentColor) ! { ! var jsTextColors = new Array('#000000', '#ffffff'); ! var i = 1; ! ! // Defines the list of available colors (red ones are only valid for the ! // administrator or the moderators of the current room) ! for (var x = 0; x < 360; x += 6) ! { ! var redDec = Math.ceil(126 * (Math.cos((x * 2 * Math.PI) / 360) + 1)); ! var greenDec = Math.ceil(126 * (Math.cos(((x + 240) * 2 * Math.PI) / 360) + 1)); ! var blueDec = Math.ceil(126 * (Math.cos(((x + 120) * 2 * Math.PI) / 360) + 1)); ! if (!(redDec > 128 && greenDec < 128 && blueDec < 128 ! && !jsIsModerator)) ! { ! var redHex = '0' + redDec.toString(16); ! var greenHex = '0' + greenDec.toString(16); ! var blueHex = '0' + blueDec.toString(16); ! i++; ! jsTextColors[i] = '#' ! + redHex.substr(redHex.length - 2) ! + greenHex.substr(greenHex.length - 2) ! + blueHex.substr(blueHex.length - 2); ! } ! } ! ! // Buffers the color picker ! jsColorPicker = new Array(); ! for (var i = 0; i < jsTextColors.length; i++) ! { ! if (theCurrentColor == jsTextColors[i]) ! { ! var jsWichImage = 'sel_color.gif'; ! jsSelectedColor = 'C' + (i + 1); ! } ! else ! { ! var jsWichImage = 'unsel_color.gif'; ! } ! jsColorPicker[i] = '<td bgcolor="' + jsTextColors[i] + '"><a href="#" onclick="window.parent.pmcChangeColor(\'' + jsTextColors[i] + '\', \'C' + (i + 1) + '\'); return false"><img src="images/' + jsWichImage + '" alt="' + jsTextColors[i] + '" name="C' + (i + 1) + '" border="0" width="2" height="20" /></a></td>'; ! } ! jsTextColors = null; ! ! return true; ! } // end of the 'pmcSetColorPicker()' function ! *************** *** 37,40 **** --- 94,99 ---- * @param string rank of the color inside the color picker * + * @return boolean always true + * * @access public */ *************** *** 64,68 **** obj2.src = jsImgColor2.src; } - inputDoc.forms['inputForm'].elements['message'].focus(); } // end of the function 'pmcChangeColor()' --- 123,128 ---- obj2.src = jsImgColor2.src; } inputDoc.forms['inputForm'].elements['message'].focus(); + + return true; } // end of the function 'pmcChangeColor()' |