/** * Load the JavaScript behavior. * * @param string $group The pane identifier. * @param array $params Array of options. * * @return void * * @since 11.1 */ protected static function _loadBehavior($group, $params = array()) { static $loaded = array(); if (!array_key_exists((string) $group, $loaded)) { // Include MooTools framework Html::_('behavior.framework', true); $opt['onActive'] = isset($params['onActive']) ? '\\' . $params['onActive'] : null; $opt['onBackground'] = isset($params['onBackground']) ? '\\' . $params['onBackground'] : null; $opt['display'] = isset($params['startOffset']) ? (int) $params['startOffset'] : null; $opt['useStorage'] = isset($params['useCookie']) && $params['useCookie'] ? 'true' : 'false'; $opt['titleSelector'] = "dt.tabs"; $opt['descriptionSelector'] = "dd.tabs"; $options = Html::getJSObject($opt); $js = ' window.addEvent(\'domready\', function(){ $$(\'dl#' . $group . '.tabs\').each(function(tabs){ new JTabs(tabs, ' . $options . '); }); });'; $document = Factory::getDocument(); $document->addScriptDeclaration($js); Html::_('script', 'system/tabs.js', false, true); $loaded[(string) $group] = true; } }
/** * Internal method to get a JavaScript object notation string from an array * * @param array $array The array to convert to JavaScript object notation * * @return string JavaScript object notation representation of the array * * @since 11.1 * @deprecated 13.3 Use JHtml::getJSObject() instead. */ protected static function _getJSObject($array = array()) { Log::add('JHtmlBehavior::_getJSObject() is deprecated. JHtml::getJSObject() instead..', Log::WARNING, 'deprecated'); Html::getJSObject($array); }
/** * Load the JavaScript behavior. * * @param string $group The pane identifier. * @param array $params Array of options. * * @return void * * @since 11.1 */ protected static function _loadBehavior($group, $params = array()) { static $loaded = array(); if (!array_key_exists($group, $loaded)) { // Get the JInput object $input = Factory::getApplication()->input; $loaded[$group] = true; // Include mootools framework. Html::_('behavior.framework', true); $document = Factory::getDocument(); $display = isset($params['startOffset']) && isset($params['startTransition']) && $params['startTransition'] ? (int) $params['startOffset'] : null; $show = isset($params['startOffset']) && !(isset($params['startTransition']) && $params['startTransition']) ? (int) $params['startOffset'] : null; $opt['onActive'] = "\\function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_" . $group . "',\$\$('div#" . $group . ".pane-sliders > .panel > h3').indexOf(toggler));}"; $opt['onBackground'] = "\\function(toggler, i) {toggler.addClass('pane-toggler');" . "toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if(\$\$('div#" . $group . ".pane-sliders > .panel > h3').length==\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_" . $group . "',-1);}"; $opt['duration'] = isset($params['duration']) ? (int) $params['duration'] : 300; $opt['display'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $display, 'integer') : $display; $opt['show'] = isset($params['useCookie']) && $params['useCookie'] ? $input->cookie->get('jpanesliders_' . $group, $show, 'integer') : $show; $opt['opacity'] = isset($params['opacityTransition']) && $params['opacityTransition'] ? 'true' : 'false'; $opt['alwaysHide'] = isset($params['allowAllClose']) && !$params['allowAllClose'] ? 'false' : 'true'; $options = Html::getJSObject($opt); $js = "window.addEvent('domready', function(){ new Fx.Accordion(\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler'), \$\$('div#" . $group . ".pane-sliders > .panel > div.pane-slider'), " . $options . "); });"; $document->addScriptDeclaration($js); } }