|
From: Lo?c C. <lo...@us...> - 2001-04-21 09:45:38
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv20902 Modified Files: do_enter_js_work.lib.php3 Added Files: msg_colors.lib.js Removed Files: set_msg_color.lib.js Log Message: Rename 'set_msg_color.lib.js' to 'msg_colors.lib.js' --- NEW FILE --- // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html | // +--------------------------------------------------------------------------+ // | Modifies the color picker at the 'input' frame according to the value of | // | the color to be used for messages. | // | | // | This library is called by the 'chat/lib/index_libs/main_index.lib.php3' | // | script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <te...@ph...> | // +--------------------------------------------------------------------------+ // // $Id: msg_colors.lib.js,v 1.1 2001/04/21 09:45:36 loic1 Exp $ // // Handles the color picker. // 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(); jsColorPicker[0] = '<table border="0" cellpadding="0" cellspacing="0">'; jsColorPicker[1] = '<tr>'; 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+2] = '<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) + '" id="C' + (i + 1) + '" border="0" width="2" height="20" /></a></td>'; } jsColorPicker[i+2] = '<\/tr>'; jsColorPicker[i+3] = '<\/table>'; jsTextColors = null; return true; } // end of the 'pmcSetColorPicker()' function /** * Modifies the color picker * * @param string hex value of the selected color * @param string rank of the color inside the color picker * * @return boolean always true * * @access public */ function pmcChangeColor(colorVal, colorRank) { if (jsSelectedColor != colorRank) { var inputDoc = window.frames['input'].window.document; // DOM enabled browser if (typeof(document.getElementById) != 'undefined') { var obj1 = inputDoc.getElementById(jsSelectedColor); var obj2 = inputDoc.getElementById(colorRank); } // IE else if (typeof(document.all) != 'undefined') { var obj1 = inputDoc.all[jsSelectedColor]; var obj2 = inputDoc.all[colorRank]; } // NS else if (typeof(document.images) != 'undefined') { var obj1 = inputDoc.images[jsSelectedColor]; var obj2 = inputDoc.images[colorRank]; } else return false; if (jsSelectedColor != null) { obj1.src = jsImgColor1.src; } jsSelectedColor = colorRank; inputDoc.forms['inputForm'].elements['color'].value = colorVal; obj2.src = jsImgColor2.src; } inputDoc.forms['inputForm'].elements['message'].focus(); return true; } // end of the function 'pmcChangeColor()' Index: do_enter_js_work.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_js_work.lib.php3,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** do_enter_js_work.lib.php3 2001/04/20 19:54:13 1.6 --- do_enter_js_work.lib.php3 2001/04/21 09:45:36 1.7 *************** *** 88,93 **** ! <!-- Gets the library that allows to modify the color picker --> ! <script src="<?php echo(_CHAT_PATH); ?>lib/index_libs/set_msg_color.lib.js" type="text/javascript" language="javascript1.1"></script> --- 88,93 ---- ! <!-- Gets the library that allows to display and modify the color picker --> ! <script src="<?php echo(_CHAT_PATH); ?>lib/index_libs/msg_colors.lib.js" type="text/javascript" language="javascript1.1"></script> --- set_msg_color.lib.js DELETED --- |