📄 gmenu_layers.php
字号:
* @return string The modified version of $item, going back into $this->I['theItem'] */ function extProc_beforeAllWrap($item,$key) { if ($this->mconf['relativeToTriggerItem']) { $item = '<div id="anchorID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'" style="position:absolute;visibility:hidden;"></div><div id="itemID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'" style="width:100%; height:100%;">'.$item.'</div>'; } return $item; } /** * Returns true if different from '' OR if intval()!=0 * * @param string Value to evaluate * @return boolean true if $in is different from '' OR if intval()!=0 */ function isSetIntval($in) { return $this->mconf['blankStrEqFalse'] ? strcmp($in,'') : intval($in); } /** * Putting things together, in particular the JavaScript code needed for the DHTML menu. * * @return mixed Returns the value of a call to the parent function, parent::extProc_finish(); */ function extProc_finish () { $dirL = $this->mconf['directionLeft'] ? '-GL_getObj(id).width' : ''; $dirU = $this->mconf['directionUp'] ? '-GL_getObj(id).height' : ''; $parentLayerId = end($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']); $DoTop=array(); $GLV_menuOn=array(); $relCode=array(); $relFlag=0; if ($this->mconf['relativeToParentLayer'] && $parentLayerId) { $relCode['X'].='GLV_curLayerX["'.$parentLayerId.'"]+'; $relCode['Y'].='GLV_curLayerY["'.$parentLayerId.'"]+'; if ($this->mconf['relativeToParentLayer.']['addWidth']) { $relCode['X'].='GLV_curLayerWidth["'.$parentLayerId.'"]+'; } if ($this->mconf['relativeToParentLayer.']['addHeight']) { $relCode['Y'].='GLV_curLayerHeight["'.$parentLayerId.'"]+'; } } if ($this->mconf['relativeToTriggerItem']) { $DoTop[]=' var parentObject = GL_getObj(GLV_menuXY[WMid][id][2]); var TI_width = parentObject.width; var TI_height = parentObject.height; var anchorObj = GL_getObj(GLV_menuXY[WMid][id][3]); var TI_x = anchorObj.x; var TI_y = anchorObj.y; '; $relCode['X'].='TI_x+'; $relCode['Y'].='TI_y+'; if ($this->mconf['relativeToTriggerItem.']['addWidth']) { $relCode['X'].='TI_width+'; } if ($this->mconf['relativeToTriggerItem.']['addHeight']) { $relCode['Y'].='TI_height+'; } $relFlag=1; } if ($relFlag) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";'; $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";'; } else { // X position (y is fixed) if (!strcmp($this->mconf['lockPosition'],'x')) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].'GLV_menuXY["'.$this->WMid.'"][id][0]-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";'; if ($this->isSetIntval($this->mconf['topOffset'])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";'; } } elseif ($this->isSetIntval($this->mconf['xPosOffset'])) { $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = (GLV_x-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";'; if ($this->isSetIntval($this->mconf['topOffset'])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";'; } } // Y position (x is fixed) if (!strcmp($this->mconf['lockPosition'],'y')) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].'GLV_menuXY["'.$this->WMid.'"][id][1]-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";'; if ($this->isSetIntval($this->mconf['leftOffset'])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";'; } } elseif ($this->isSetIntval($this->mconf['yPosOffset'])) { $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = (GLV_y-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";'; if ($this->isSetIntval($this->mconf['leftOffset'])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";'; } } } // BordersWithIn: $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[0]); $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[1]); $DoTop[]=$this->extCalcBorderWithin('right',$this->WMbordersWithin[2]); $DoTop[]=$this->extCalcBorderWithin('bottom',$this->WMbordersWithin[3]); $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[4]); $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[5]); if ($this->mconf['freezeMouseover'] && !$this->mconf['freezeMouseover.']['alwaysKeep']) { $this->WMhideCode.='GL'.$this->WMid.'_out("");'; } $TEST=''; if (count($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) { reset($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']); while(list(,$mIdStr)=each($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) { $this->WMhideCode.='GL_hideAll("'.$mIdStr.'");'; $this->WMrestoreScript.='GL_restoreMenu("'.$mIdStr.'");'; $this->WMresetSubMenus.='if (!GLV_doReset["'.$mIdStr.'"] && GLV_currentLayer["'.$mIdStr.'"]!=null) resetSubMenu=0;'; } } // IESelectFix - Adds IFRAME tag to HTML, Hides IFRAME layer below menu if ($this->mconf['ieSelectFix']) { $this->WMhideCode.= ' GL_iframer(\''.$this->WMid.'\',\'\',false);'; $this->divLayers['iframe'] = '<iframe id="Iframe'.$this->WMid.'" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; background-color:transparent; layer-background-color:transparent; display:none;"></iframe>'; } $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array_merge($this->WMtempStore,$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']); $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared']='<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('cms').'tslib/media/scripts/jsfunc.layermenu.js"></script>'; $GLOBALS['TSFE']->JSCode.= 'GLV_curLayerWidth["'.$this->WMid.'"]=0;GLV_curLayerHeight["'.$this->WMid.'"]=0;GLV_curLayerX["'.$this->WMid.'"]=0;GLV_curLayerY["'.$this->WMid.'"]=0;GLV_menuOn["'.$this->WMid.'"] = null;GLV_gap["'.$this->WMid.'"]='.t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'],0,600).';GLV_currentLayer["'.$this->WMid.'"] = null;GLV_currentROitem["'.$this->WMid.'"] = null;GLV_hasBeenOver["'.$this->WMid.'"]=0;GLV_doReset["'.$this->WMid.'"]=false;GLV_lastKey["'.$this->WMid.'"] = "'.$this->WMlastKey.'";GLV_onlyOnLoad["'.$this->WMid.'"] = '.($this->WMonlyOnLoad?1:0).';GLV_dontHideOnMouseUp["'.$this->WMid.'"] = '.($this->mconf['dontHideOnMouseUp']?1:0).';GLV_dontFollowMouse["'.$this->WMid.'"] = '.($this->mconf['dontFollowMouse']?1:0).';GLV_date = new Date();GLV_timeout["'.$this->WMid.'"] = GLV_date.getTime();GLV_timeoutRef["'.$this->WMid.'"] = '.t3lib_div::intInRange($this->mconf['hideMenuTimer'],0,20000).';GLV_menuXY["'.$this->WMid.'"] = new Array();'.implode(chr(10),$this->WMxyArray).''.$this->WMrestoreVars; if ($this->mconf['freezeMouseover']) { $GLOBALS['TSFE']->JSCode.= '// Alternative rollover/out functions for use with GMENU_LAYERfunction GL'.$this->WMid.'_over(mitm_id) { GL'.$this->WMid.'_out(""); // removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers. switch(mitm_id) {'.implode(chr(10),$this->VMmouseoverActions).' } GLV_currentROitem["'.$this->WMid.'"]=mitm_id;}function GL'.$this->WMid.'_out(mitm_id) { if (!mitm_id) mitm_id=GLV_currentROitem["'.$this->WMid.'"]; switch(mitm_id) {'.implode(chr(10),$this->VMmouseoutActions).' }}'; } $GLOBALS["TSFE"]->JSCode.= 'function GL'.$this->WMid.'_getMouse(e) { if (GLV_menuOn["'.$this->WMid.'"]!=null && !GLV_dontFollowMouse["'.$this->WMid.'"]){'.implode(chr(10),$GLV_menuOn).' } GL_mouseMoveEvaluate("'.$this->WMid.'");}function GL'.$this->WMid.'_hideCode() {'.$this->WMhideCode.'}function GL'.$this->WMid.'_doTop(WMid,id) {'.trim(implode(chr(10),$DoTop)).'}function GL'.$this->WMid.'_restoreMenu() {'.$this->WMrestoreScript.'}function GL'.$this->WMid.'_resetSubMenus() { var resetSubMenu=1;'.$this->WMresetSubMenus.' return resetSubMenu;}GLV_timeout_pointers[GLV_timeout_count] = "'.$this->WMid.'";GLV_timeout_count++;'; $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GL_initLayers()']= 'GL_initLayers();'; $GLOBALS['TSFE']->JSeventFuncCalls['onload'][$this->WMid]= 'GL_restoreMenu("'.$this->WMid.'");'; $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GL_getMouse(e)']= 'GL_getMouse(e);'; // Should be called BEFORE any of the 'local' getMouse functions! $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'][$this->WMid]= 'GL'.$this->WMid.'_getMouse(e);'; $GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'][$this->WMid]= 'GL_mouseUp(\''.$this->WMid.'\',e);'; $GLOBALS['TSFE']->divSection.=implode($this->divLayers,chr(10)).chr(10); return parent::extProc_finish(); } /** * Creates a JavaScript line which corrects the position of the layer based on the constraints in TypoScript property 'bordersWithin' * * @param string Direction to test. * @param integer The boundary limit in the direction set by $kind. If set then a value is returned, otherwise blank. * @return string JavaScript string for correction of the layer position (if $integer is true) * @see extProc_finish(), extProc_init() */ function extCalcBorderWithin($kind,$integer) { if ($integer) { switch($kind) { case 'right': case 'bottom': $add=''; if ($kind=='right') {$add='GL_getObj(id).width'; $key = 'left';} if ($kind=='bottom') {$add='GL_getObj(id).height'; $key = 'top';} $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';'; break; default: $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';'; break; } } return $str; }}// FULL DUPLICATE TO tmenu_layers END:$GLOBALS['TSFE']->tmpl->menuclasses.=',gmenu_layers';if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/gmenu_layers.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/gmenu_layers.php']);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -