$includeMootools = isset ( $includeMootools ) ? ( bool ) $includeMootools : true;
$includeMootoolsJs = '';
$includeTooltipsCss = '';
$includeTooltipsJs = <<
window.addEvent('domready', function(){
var Tooltips = new Tips($$('.tooltips'), {
initialize:function(){
this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 250, wait: false}).set(0);
},
onShow: function(toolTip) {
this.fx.start(1);
},
onHide: function(toolTip) {
this.fx.start(0);
}
});
});
EOT;
$e = &$modx->Event;
$tbl_tips = array();
switch ( $e->name) {
case 'OnLoadWebDocument' :
if (preg_match ( '~\{\=(.*?)\:(.*?)\:(.*?)\=\}~', $modx->documentObject['content'] ) > 0) {
if ($includeMootools)
$modx->regClientStartupScript ( $includeMootoolsJs );
$modx->regClientStartupScript ( $includeTooltipsJs );
$modx->regClientCSS ( $includeTooltipsCss );
}
return;
break;
case 'OnWebPagePrerender' :
if (preg_match_all ( '~\{\=(.*?)\:(.*?)\:(.*?)\=\}~', $modx->documentOutput, $tbl_tips, PREG_PATTERN_ORDER )) {
for($i = 0; $i < count ( $tbl_tips [0] ); $i ++) {
if ($tbl_tips [3] [$i] != '') {
$bubblelink = '' . $tbl_tips [1] [$i] . '';
} else {
$bubblelink = '' . $tbl_tips [1] [$i] . '';
'href="#" onclick="return false;"';
}
$modx->documentOutput = str_replace ( $tbl_tips [0] [$i], $bubblelink, $modx->documentOutput );
}
}
return;
break;
default :
return;
break;
}