|
From: Lo?c C. <lo...@us...> - 2001-06-16 10:20:16
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs
In directory usw-pr-cvs1:/tmp/cvs-serv28407/chat/lib/index_libs
Modified Files:
start_page.lib.js misc.lib.js main_index.lib.php3
do_enter_db_work.lib.php3
Log Message:
Rewrote and improve the work to set the message box size
Index: start_page.lib.js
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/start_page.lib.js,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** start_page.lib.js 2001/06/10 14:57:48 1.12
--- start_page.lib.js 2001/06/16 10:20:14 1.13
***************
*** 51,55 ****
{
var aCell = document.getElementById('testSize');
! var aColWidth = Math.floor(aCell.offsetWidth / aCell.size);
var aRowHeight = Math.floor(aCell.offsetHeight);
}
--- 51,58 ----
{
var aCell = document.getElementById('testSize');
! // IE emphasizes a bit the column with -> handled in a special way
! var aColWidth = (typeof(aCell.clientWidth) != 'undefined')
! ? Math.floor(aCell.clientWidth / aCell.size)
! : (aCell.offsetWidth / aCell.size);
var aRowHeight = Math.floor(aCell.offsetHeight);
}
***************
*** 57,61 ****
{
var aCell = document.all('testSize');
! var aColWidth = Math.floor(aCell.offsetWidth / aCell.size);
var aRowHeight = Math.floor(aCell.offsetHeight);
}
--- 60,64 ----
{
var aCell = document.all('testSize');
! var aColWidth = Math.floor(aCell.clientWidth / aCell.size);
var aRowHeight = Math.floor(aCell.offsetHeight);
}
***************
*** 71,79 ****
with (document.forms['startingForm'])
{
- if (typeof(theWinWidth) != 'undefined')
- {
- elements['winWidth'].value = theWinWidth;
- elements['winHeight'].value = theWinHeight;
- }
if (typeof(aColWidth) != 'undefined')
{
--- 74,77 ----
Index: misc.lib.js
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/misc.lib.js,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** misc.lib.js 2001/05/14 08:50:49 1.14
--- misc.lib.js 2001/06/16 10:20:14 1.15
***************
*** 70,73 ****
--- 70,144 ----
/**
+ * Sets the focus to the message box at the 'input' frame
+ *
+ * @access public
+ */
+ function pmcSetMsgBoxFocus()
+ {
+ var msgBox = pmcGetInputForm('message');
+
+ if (msgBox)
+ {
+ // window.focus() is a js1.1 method
+ if (typeof(window.focus) != 'undefined')
+ window.frames['input'].window.focus();
+ msgBox.focus();
+ }
+ } // end of the function 'pmcSetMsgBoxFocus()'
+
+
+ /**
+ * Defines the size of the message box at the 'input' frame and, if required,
+ * resizes it
+ *
+ * @param integer the default size of the message box
+ * @param integer the computed size of a column of the text box
+ * @param integer the length of the submit button
+ * @param boolean whether to resize the message box or not
+ *
+ * @return mixed the size of the message box if it does not have to be
+ * resized, true else
+ *
+ * @access public
+ */
+ function pmcMsgBoxSize(defaultSize, cellColWidth, submitLength, doResize)
+ {
+ // Get the size of the window
+ var theWinWidth = 0;
+ if (typeof(window.frames['input']) == 'undefined'
+ || typeof(window.frames['input'].window.document) != 'object')
+ {
+ // void;
+ }
+ else if (typeof(document.body) != 'undefined'
+ && typeof(window.frames['input'].window.document.body.clientWidth) != 'undefined')
+ {
+ theWinWidth = window.frames['input'].window.document.body.clientWidth;
+ }
+ else if (typeof(window.innerWidth) != 'undefined')
+ {
+ theWinWidth = window.frames['input'].innerWidth;
+ }
+
+ // Defines the size of the message box
+ theMsgBoxSize = (theWinWidth)
+ ? Math.floor(theWinWidth / cellColWidth) - (submitLength + 2)
+ : defaultSize;
+
+ // Returns the size of the message box or, if required, resizes it
+ if (!doResize)
+ {
+ return theMsgBoxSize;
+ }
+ else
+ {
+ var msgBox = pmcGetInputForm('message');
+ msgBox.size = theMsgBoxSize;
+ return;
+ }
+ } // end of the function 'pmcMsgBoxSize()'
+
+
+ /**
* Automatically submits a command at the 'input' frame
*
***************
*** 131,153 ****
}
} // end of the function 'pmcUserClick()'
-
-
- /**
- * Sets the focus to the message box at the 'input' frame
- *
- * @access public
- */
- function pmcSetMsgBoxFocus()
- {
- var msgBox = pmcGetInputForm('message');
-
- if (msgBox)
- {
- // window.focus() is a js1.1 method
- if (typeof(window.focus) != 'undefined')
- window.frames['input'].window.focus();
- msgBox.focus();
- }
- } // end of the function 'pmcSetMsgBoxFocus()'
--- 202,205 ----
Index: main_index.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/main_index.lib.php3,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** main_index.lib.php3 2001/06/15 21:05:15 1.38
--- main_index.lib.php3 2001/06/16 10:20:14 1.39
***************
*** 801,806 ****
<input type="hidden" name="jsVersion" value="noJs" />
<input type="hidden" name="isJsValidated" value="0" />
- <input type="hidden" name="winWidth" value="800" />
- <input type="hidden" name="winHeight" value="600" />
<input type="hidden" name="colWidth" value="<?php echo(L_FONT_SIZE * 0.85); ?>" />
<input type="hidden" name="rowHeight" value="<?php echo((L_FONT_SIZE * 1.5) + 5); ?>" />
--- 801,804 ----
Index: do_enter_db_work.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_db_work.lib.php3,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** do_enter_db_work.lib.php3 2001/06/10 14:57:48 1.20
--- do_enter_db_work.lib.php3 2001/06/16 10:20:14 1.21
***************
*** 227,234 ****
$keptLang = $dbSessionVars['lang'];
$keptFrom = $dbSessionVars['from'];
! if (!isset($winWidth) && dbSessionIsRegistered('winWidth'))
{
- $winWidth = $dbSessionVars['winWidth'];
- $winHeight = $dbSessionVars['winHeight'];
$colWidth = $dbSessionVars['colWidth'];
$rowHeight = $dbSessionVars['rowHeight'];
--- 227,232 ----
$keptLang = $dbSessionVars['lang'];
$keptFrom = $dbSessionVars['from'];
! if (!isset($colWidth) && dbSessionIsRegistered('colWidth'))
{
$colWidth = $dbSessionVars['colWidth'];
$rowHeight = $dbSessionVars['rowHeight'];
***************
*** 254,259 ****
$dbSessionVars['noKickTest'] = 1;
// some sizes
- $dbSessionVars['winWidth'] = (isset($winWidth)) ? $winWidth : 800;
- $dbSessionVars['winHeight'] = (isset($winHeight)) ? $winHeight : 600;
$dbSessionVars['colWidth'] = (isset($colWidth)) ? $colWidth : (L_FONT_SIZE * 0.85);
$dbSessionVars['rowHeight'] = (isset($rowHeight)) ? $rowHeight : ((L_FONT_SIZE * 1.5) + 5);
--- 252,255 ----
|