public function addJS ($strJS, $bolStatic=true)
	{
		if ($strJS == '')
		{
			return;
		}
		
		if (!$bolStatic)
		{
			$strKey = substr(md5('js' . $strJS), 0, 12);
			$strPath = 'assets/js/' . $strKey . '.js';
			
			// Write to a temporary file in the assets folder
			if (!file_exists($strPath))
			{
				$objFile = new File($strPath, true);
				$objFile->write($strCSS);
				$objFile->close();
			}
			
			// Add the file path to TL_USER_CSS
			$GLOBALS[TL_JAVASCRIPT][] = $strPath;
		
			return;
		}
		// Add to the combined CSS string
		$GLOBALS['TL_CTB_JS'] .= $strJS;
	}
public function addJS ($strJS, $bolStatic=true)
	{
		if ($strJS == '')
		{
			return;
		}
		
		if (!$bolStatic)
		{
			$strKey = substr(md5('js' . $strJS), 0, 12);
			$strPath = 'assets/js/' . $strKey . '.js';
			
			// Write to a temporary file in the assets folder
			if (!file_exists($strPath))
			{
				$objFile = new File($strPath, true);
				$objFile->write($strCSS);
				$objFile->close();
			}
			
			// Add the file path to TL_USER_CSS
			$GLOBALS[TL_JAVASCRIPT][] = $strPath;
		
			return;
		}
		// Add to the combined CSS string
		$GLOBALS['TL_CTB_JS'] .= $strJS;
	}
public function addJS ( $ strJS , $ bolStatic = true ) { if ( $ strJS == '' ) { return ; } if ( ! $ bolStatic ) { $ strKey = substr ( md5 ( 'js' . $ strJS ) , 0 , 12 ) ; $ strPath = 'assets/js/' . $ strKey . '.js' ; // Write to a temporary file in the assets folder if ( ! file_exists ( $ strPath ) ) { $ objFile = new File ( $ strPath , true ) ; $ objFile -> write ( $ strCSS ) ; $ objFile -> close ( ) ; } // Add the file path to TL_USER_CSS $ GLOBALS [ TL_JAVASCRIPT ] [ ] = $ strPath ; return ; } // Add to the combined CSS string $ GLOBALS [ 'TL_CTB_JS' ] .= $ strJS ; }
Add Javascript to the page

@param string  $strJS     The javascript content
@param boolean $bolStatic Set false to add the content in an extra file
Add Javascript to the page