[TASK] Consolidate JSimgCode in TSFE into additionalJavaScript 58/31758/5
authorBenjamin Mack <benni@b13.de>
Thu, 24 Jul 2014 13:29:00 +0000 (15:29 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 9 Sep 2014 14:44:59 +0000 (16:44 +0200)
In order to streamline the javascript variables in
frontend rendering the functionality for using
JSimagecode (used by GMENU) should add its
code to the generic $additionalJavaScript and
not the hardly used "public $JSImgCode".

Releases: 6.3
Resolves: #60523
Change-Id: Iec3b5623348ce448c1827e30a831acb3fb82a415
Reviewed-on: http://review.typo3.org/31758
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/ContentObject/Menu/GraphicalMenuContentObject.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 176a743..787a4cd 100644 (file)
@@ -370,6 +370,9 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                        $this->WMmenuItems = count($this->result['NO']);
                        $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix' => $this->mconf['submenuObjSuffixes']), $this->WMmenuItems);
                        $this->extProc_init();
+                       if (!isset($GLOBALS['TSFE']->additionalJavaScript['JSImgCode'])) {
+                               $GLOBALS['TSFE']->additionalJavaScript['JSImgCode'] = '';
+                       }
                        for ($key = 0; $key < $this->WMmenuItems; $key++) {
                                if ($this->result['NO'][$key]['output_file']) {
                                        // Initialize the cObj with the page record of the menu item
@@ -412,8 +415,8 @@ class GraphicalMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\
                                                $this->I['name'] = ' ' . $this->nameAttribute . '="' . $this->I['theName'] . '"';
                                                $this->I['linkHREF']['onMouseover'] = $this->WMfreezePrefix . 'over(\'' . $this->I['theName'] . '\');';
                                                $this->I['linkHREF']['onMouseout'] = $this->WMfreezePrefix . 'out(\'' . $this->I['theName'] . '\');';
-                                               $GLOBALS['TSFE']->JSImgCode .= LF . $this->I['theName'] . '_n=new Image(); ' . $this->I['theName'] . '_n.src = "' . $GLOBALS['TSFE']->absRefPrefix . $this->I['val']['output_file'] . '"; ';
-                                               $GLOBALS['TSFE']->JSImgCode .= LF . $this->I['theName'] . '_h=new Image(); ' . $this->I['theName'] . '_h.src = "' . $GLOBALS['TSFE']->absRefPrefix . $this->result['RO'][$key]['output_file'] . '"; ';
+                                               $GLOBALS['TSFE']->additionalJavaScript['JSImgCode'] .= LF . $this->I['theName'] . '_n=new Image(); ' . $this->I['theName'] . '_n.src = "' . $GLOBALS['TSFE']->absRefPrefix . $this->I['val']['output_file'] . '"; ';
+                                               $GLOBALS['TSFE']->additionalJavaScript['JSImgCode'] .= LF . $this->I['theName'] . '_h=new Image(); ' . $this->I['theName'] . '_h.src = "' . $GLOBALS['TSFE']->absRefPrefix . $this->result['RO'][$key]['output_file'] . '"; ';
                                                $GLOBALS['TSFE']->imagesOnPage[] = $this->result['RO'][$key]['output_file'];
                                                $GLOBALS['TSFE']->setJS('mouseOver');
                                                $this->extProc_RO($key);
index 1203868..51ea28f 100644 (file)
@@ -460,13 +460,6 @@ class TypoScriptFrontendController {
                'onunload' => array()
        );
 
-       /**
-        * Used to accumulate JavaScript loaded images (by menus)
-        * @var string
-        * @todo Define visibility
-        */
-       public $JSImgCode = '';
-
        /**
         * Used to accumulate DHTML-layers.
         * @var string
@@ -3549,7 +3542,6 @@ class TypoScriptFrontendController {
                $this->additionalFooterData = is_array($this->config['INTincScript_ext']['additionalFooterData']) ? $this->config['INTincScript_ext']['additionalFooterData'] : array();
                $this->additionalJavaScript = $this->config['INTincScript_ext']['additionalJavaScript'];
                $this->additionalCSS = $this->config['INTincScript_ext']['additionalCSS'];
-               $this->JSImgCode = $this->additionalHeaderData['JSImgCode'];
                $this->divSection = '';
                if (!empty($this->config['INTincScript_ext']['pageRenderer'])) {
                        $this->setPageRenderer(unserialize($this->config['INTincScript_ext']['pageRenderer']));
@@ -3663,20 +3655,6 @@ class TypoScriptFrontendController {
         * @todo Define visibility
         */
        public function INTincScript_loadJSCode() {
-               // If any images added, then add them to the javascript section
-               $jsImgCode = trim($this->JSImgCode);
-               if ($jsImgCode !== '') {
-                       $this->additionalHeaderData['JSImgCode'] = '
-<script type="text/javascript">
-       /*<![CDATA[*/
-<!--
-if (version == "n3") {
-' . $jsImgCode . '
-}
-// -->
-       /*]]>*/
-</script>';
-               }
                // Add javascript
                $jsCode = trim($this->JSCode);
                $additionalJavaScript = is_array($this->additionalJavaScript)