Hover over thistooltip text +----------------------------------------------------------------------+ */ $RecipeInfo['CSSToolTipsToGo']['Version'] = '2023-05-22.v0.5'; # dded support for php8 #$RecipeInfo['CSSToolTipsToGo']['Version'] = '2011-01-07.v0.4'; # added support for Markup_e #$RecipeInfo['CSSToolTipsToGo']['Version'] = '2016-04-25.v0.4'; # changed div elements to span to avoid incompatibility converns. #$RecipeInfo['CSSToolTipsToGo']['Version'] = '2014-08-26.v0.3'; # added support for id, idlabel and idpopup params to support assign of individual ids. #$RecipeInfo['CSSToolTipsToGo']['Version'] = '2011-01-01.v0.2'; # $pagename declaration only inside de CSSToolTipsToGo() function #$RecipeInfo['CSSToolTipsToGo']['Version'] = '2010-10-09.v0.1'; # # # CSS Tool Tips To Go # # define a class of tooltips # # (:tooltips class='classname' aspect='css-text' hover='css-hover' popup='css-popup' [add[.*]='extra-css'] :) # Markup("TTTGDEF","fulltext","/\\(:tooltips (.*?):\\)/s", "cttgd"); function cttgd($m) {return CSSToolTipsToGoDefine($m[1]); } # # # to change behaviour of links ( tags) inside the text field use the add.* field(s) notation # ie: # # (:tooltips class=classname # aspect='color: #000;' # hover='background:#ccc;' # popup='left:2em; top:2em; border:solid; background: #fff;' # # add='span.L@CLASS@ a:visited {color: red;}' # add0='span.L@CLASS@ a:link {color: red;}' # add1='span.L@CLASS@ a:active {color: red;}' # add2='span.L@CLASS@ a:hover {color: black; text-decoration: none;}' # # :) # or # (:tooltips class=classname # aspect='color: #000;' # hover='background:#ccc;' # popup='left:2em; top:2em; border:solid; background: #fff;' # # add='span.L@CLASS@ a:visited {color: red;} # span.L@CLASS@ a:link {color: red;} # span.L@CLASS@ a:active {color: red;} # span.L@CLASS@ a:hover {color: black; text-decoration: none;}' # # :) # # (note that markup processing will replace '@CLASS@' with a derivartion of the supplied classname value) # # every '(:tooltips params :)' markup creates/replaces an HTMLStylesFmt['classname'] entry # function CSSToolTipsToGoDefine($str) { global $HTMLStylesFmt; $defaults = array('class'=>'tttg' , 'aspect'=>'', 'hover'=>'' , 'popup'=>'left:1em; top:1em;' , 'css'=>'' , 'add'=>''); $t = array_merge($defaults, ParseArgs($str)); $css=" span.@CLASS@ {position:relative;} span.@CLASS@:hover span.L@CLASS@ {@HOVER@} span.@CLASS@:hover span.P@CLASS@ {display:block;position:absolute;z-index:1001; @POPUP@} span.L@CLASS@ {@ASPECT@} span.P@CLASS@ {display:none;} "; if ($t['css']!='') $css=$t['css']; $css=$css.$t['add']."\n"; foreach($t as $k=>$v) { if ($v!=FALSE && preg_match('/^add/',$k) > 0) $css=$css.$v."\n"; } $class="tttg".trim($t['class']); $css=str_replace("@CLASS@",$class,$css); $css=str_replace("@ASPECT@",$t['aspect'],$css); $css=str_replace("@HOVER@",$t['hover'],$css); $css=str_replace("@POPUP@",$t['popup'],$css); $HTMLStylesFmt[$class]=$css; }; # # create a tooltip of a given class # # [|classname instance-params||text||popup|] # classname is optional, if not defined, the instance belongs to the default (noname=tttg) class. # instance-params is optional. Follows the semantics of (:include :) markup, but restictted to three keys: # aspect='css code' to change/refine the aspect of the text of that instance # popup='css code' to change/refine the aspect of the popup of that instance # absolute=0/1. Defaults to 0 for relative positioning of the tooltip. # set to 1 (not 0) for absolute positioning, # id=str optional global span ID attribute value (without quotes) # idlabel=str optional label span ID attribute value (without quotes) # idpopup=str optional popup span ID attribute value (without quotes) Markup("CSSTTTG", "_begin", "/\\[\\|(.*?)\\|\\|(.*?)\\|\\|(.*?)\\|\\]/s", "cttgww"); function cttgww($m) { return Keep(CSSToolTipsToGo($m[1],PSS($m[2]),PSS($m[3]))); } # # # # Generate html tags from markup : [|classname||text||tooltip|] # the html struct is: # // markup span, class=classname , position=relative/ optionally absolute in if absolute=1 specified in local 'aspect' css param. # // text span, class=Lclassname, on hover changes span.span display to block, and position=absolute (relative to markup span) to show the popup. Each instance optionally modeled by local 'aspect' css param. # text // text area where hover occurs # # // tooltip span, class=Pclassname, display=none invisible. Each instance optionally modeled by local 'popup' css param. # tooltip // popup/tooltip contents # # # # function CSSToolTipsToGo($class='' , $text='', $tool='') { global $pagename; $defaults = array('class'=>'' , 'aspect'=>'', 'popup'=>'' , 'absolute'=>'0'); $t = array_merge($defaults, ParseArgs($class)); $textcss=$t['aspect']; $popupcss=$t['popup']; $classname=trim($t['class']); if ($classname=='') $classname=trim($t[''][0]); $classname="tttg".$classname; $id=""; $idlabel=""; $idpopup=""; if (isset($t['id'])) $id=trim($t['id']); if ($id!='') $id="id=\"$id\""; if (isset($t['idlabel'])) $idlabel=trim($t['idlabel']); if ($idlabel!='') $idlabel="id=\"$idlabel\""; if (isset($t['idpopup'])) $idpopup=trim($t['idpopup']); if ($idpopup!='') $idpopup="id=\"$idpopup\""; $htext=trim(MarkupToHTML($pagename,$text)); $htool=trim(MarkupToHTML($pagename,$tool)); $htext=preg_replace('/^

/','',$htext); $htext=trim(preg_replace('/<\/p>$/','',$htext)); $htool=preg_replace('/^

/','',$htool); $htool=trim(preg_replace('/<\/p>$/','',$htool)); if ($textcss!='') $textcss="style=\"".$textcss."\""; if ($popupcss!='') $popupcss="style=\"".$popupcss."\""; $absolutepos= ($t['absolute']!='0') ? 'style=position:static;' : ''; $out="".$htext."".$htool.""; return $out; }; # # define default class with basic hide/show semantics # you can override those minimal settings by calling (:tooltips params:) without a class param # CSSToolTipsToGoDefine(''); # #