/** * Load the JavaScript behavior. * * @param string $group The pane identifier. * @param array $params Array of options. * @return void */ protected static function behavior($group, $params = array()) { static $loaded = array(); if (!array_key_exists($group, $loaded)) { $loaded[$group] = true; $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 = array(); $opt['heightStyle'] = "'content'"; /*$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']) ? JRequest::getInt('jpanesliders_' . $group, $display, 'cookie') : $display; $opt['show'] = (isset($params['useCookie']) && $params['useCookie']) ? JRequest::getInt('jpanesliders_' . $group, $show, 'cookie') : $show; $opt['opacity'] = (isset($params['opacityTransition']) && ($params['opacityTransition'])) ? 'true' : 'false'; $opt['alwaysHide'] = (isset($params['allowAllClose']) && (!$params['allowAllClose'])) ? 'false' : 'true';*/ $options = array(); foreach ($opt as $k => $v) { if ($v) { $options[] = $k . ': ' . $v; } } $options = '{' . implode(',', $options) . '}'; Behavior::framework(true); \App::get('document')->addScriptDeclaration("jQuery(document).ready(function(\$){\n\t\t\t\t\t\$('div#" . $group . "').accordion(" . $options . ");\n\t\t\t\t});"); } }
/** * Load the JavaScript behavior. * * @param string $group The pane identifier. * @param array $params Array of options. * @return void */ protected static function behavior($group, $params = array()) { static $loaded = array(); if (!array_key_exists((string) $group, $loaded)) { $options = array(); $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'"; foreach ($opt as $k => $v) { if ($v) { $options[] = $k . ': ' . $v; } } $options = '{' . implode(',', $options) . '}'; Behavior::framework(true); \App::get('document')->addScriptDeclaration('jQuery(document).ready(function($){ $("dl#' . $group . '.tabs").tabs(); });'); Asset::script('system/jquery.tabs.js', false, true); $loaded[(string) $group] = true; } }