Hover over this
tooltip text
+----------------------------------------------------------------------+ */ $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","_begin","/\\(:tooltips (.*?):\\)/se", "CSSToolTipsToGoDefine('$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 div.P@CLASS@ {display:block;position:absolute;z-index:1001; @POPUP@} span.L@CLASS@ {@ASPECT@} div.P@CLASS@ {display:none;} "; if ($t['css']!='') $css=$t['css']; $css=$css.$t['add']."\n"; reset($t); while(list($k,$v) = each($t)) { if (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, # Markup("CSSTTTG", "_begin", "/\\[\\|(.*?)\\|\\|(.*?)\\|\\|(.*?)\\|\\]/se", "Keep(CSSToolTipsToGo('$1',PSS('$2'),PSS('$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.div 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 div, 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; $htext=MarkupToHTML($pagename,$text); # elimina

que engloben l'html $htext=preg_replace('/^

/','',$htext); $htext=preg_replace('/<\/p>$/','',$htext); $htool=MarkupToHTML($pagename,$tool); 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(''); # #