--- class.tslib_pagegen.php.bak 2006-09-02 12:36:03.000000000 +0200 +++ class.tslib_pagegen.php 2007-02-03 13:50:40.000000000 +0100 @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) +* (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -284,22 +284,18 @@ * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag. */ function JSeventFunctions() { - $functions=array(); - $setEvents=array(); - $setBody=array(); - - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'])) { - $functions[]=' function T3_onmousemoveWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']).' }'; - $setEvents[]=' document.onmousemove=T3_onmousemoveWrapper;'; - } - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'])) { - $functions[]=' function T3_onmouseupWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']).' }'; - $setEvents[]=' document.onmouseup=T3_onmouseupWrapper;'; - } - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onload'])) { - $functions[]=' function T3_onloadWrapper() { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onload']).' }'; - $setEvents[]=' document.onload=T3_onloadWrapper;'; - $setBody[]='onload="T3_onloadWrapper();"'; + $functions = array(); + $setEvents = array(); + $setBody = array(); + + foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) { + if (count($handlers)) { + $functions[] = ' function T3_'.$event.'Wrapper(e) { '.implode(' ',$handlers).' }'; + $setEvents[] = ' document.'.$event.'=T3_'.$event.'Wrapper;'; + if ($event == 'onload') { + $setBody[]='onload="T3_onloadWrapper();"'; // dubiuos double setting breaks on some browser - do we need it? + } + } } return Array(count($functions)?' --- class.tslib_fe.php.orig 2007-02-03 13:54:08.000000000 +0100 +++ class.tslib_fe.php 2007-02-03 13:31:18.000000000 +0100 @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) +* (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -284,7 +284,12 @@ var $JSeventFuncCalls = array( // you can add JavaScript functions to each entry in these arrays. Please see how this is done in the GMENU_LAYERS script. The point is that many applications on a page can set handlers for onload, onmouseover and onmouseup 'onmousemove' => array(), 'onmouseup' => array(), + 'onmousemove' => array(), + 'onkeydown' => array(), + 'onkeyup' => array(), + 'onkeypress' => array(), 'onload' => array(), + 'onunload' => array(), ); var $JSCode=''; // Deprecated, use additionalJavaScript instead. var $JSImgCode=''; // Used to accumulate JavaScript loaded images (by menus)