events.diff

Administrator Admin, 2007-02-03 14:01

Download (3.25 KB)

View differences:

class.tslib_pagegen.php 2007-02-03 13:50:40.000000000 +0100
2 2
/***************************************************************
3 3
*  Copyright notice
4 4
*
5
*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
5
*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 6
*  All rights reserved
7 7
*
8 8
*  This script is part of the TYPO3 project. The TYPO3 project is
......
284 284
	 * @return	array		Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
285 285
	 */
286 286
	function JSeventFunctions()	{
287
		$functions=array();
288
		$setEvents=array();
289
		$setBody=array();
290

  
291
		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']))	{
292
			$functions[]='	function T3_onmousemoveWrapper(e)	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']).'	}';
293
			$setEvents[]='	document.onmousemove=T3_onmousemoveWrapper;';
294
		}
295
		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']))	{
296
			$functions[]='	function T3_onmouseupWrapper(e)	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']).'	}';
297
			$setEvents[]='	document.onmouseup=T3_onmouseupWrapper;';
298
		}
299
		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onload']))	{
300
			$functions[]='	function T3_onloadWrapper()	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onload']).'	}';
301
			$setEvents[]='	document.onload=T3_onloadWrapper;';
302
			$setBody[]='onload="T3_onloadWrapper();"';
287
		$functions = array();
288
		$setEvents = array();
289
		$setBody = array();
290

  
291
		foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers)	{
292
			if (count($handlers))	{
293
				$functions[] = '	function T3_'.$event.'Wrapper(e)	{	'.implode('   ',$handlers).'	}';
294
				$setEvents[] = '	document.'.$event.'=T3_'.$event.'Wrapper;';
295
				if ($event == 'onload')	{
296
					$setBody[]='onload="T3_onloadWrapper();"';	// dubiuos double setting breaks on some browser - do we need it?
297
				}
298
			}
303 299
		}
304 300

  
305 301
		return Array(count($functions)?'
306
-- class.tslib_fe.php.orig	2007-02-03 13:54:08.000000000 +0100
302
++ class.tslib_fe.php	2007-02-03 13:31:18.000000000 +0100
......
2 2
/***************************************************************
3 3
*  Copyright notice
4 4
*
5
*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
5
*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 6
*  All rights reserved
7 7
*
8 8
*  This script is part of the TYPO3 project. The TYPO3 project is
......
284 284
	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
285 285
		'onmousemove' => array(),
286 286
		'onmouseup' => array(),
287
		'onmousemove' => array(),
288
		'onkeydown' => array(),
289
		'onkeyup' => array(),
290
		'onkeypress' => array(),
287 291
		'onload' => array(),
292
		'onunload' => array(),
288 293
	);
289 294
	var $JSCode='';						// Deprecated, use additionalJavaScript instead.
290 295
	var $JSImgCode='';					// Used to accumulate JavaScript loaded images (by menus)