sliders.php
4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for Sliders elements
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
abstract class JHtmlSliders
{
/**
* Creates a panes and loads the javascript behavior for it.
*
* @param string $group The pane identifier.
* @param array $params An array of options.
*
* @return string
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
public static function start($group = 'sliders', $params = array())
{
static::loadBehavior($group, $params);
return '<div id="' . $group . '" class="pane-sliders"><div style="display:none;"><div>';
}
/**
* Close the current pane.
*
* @return string hTML to close the pane
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
public static function end()
{
return '</div></div></div>';
}
/**
* Begins the display of a new panel.
*
* @param string $text Text to display.
* @param string $id Identifier of the panel.
*
* @return string HTML to start a panel
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
public static function panel($text, $id)
{
return '</div></div><div class="panel"><h3 class="pane-toggler title" id="' . $id . '"><a href="javascript:void(0);"><span>' . $text
. '</span></a></h3><div class="pane-slider content">';
}
/**
* Load the JavaScript behavior.
*
* @param string $group The pane identifier.
* @param array $params Array of options.
*
* @return void
*
* @since 1.6
* @deprecated 3.7.0 These helpers are dependent on the deprecated MooTools support
*/
protected static function loadBehavior($group, $params = array())
{
static $loaded = array();
if (!array_key_exists($group, $loaded))
{
// Get the JInput object
$input = JFactory::getApplication()->input;
$loaded[$group] = true;
// Include mootools framework.
JHtml::_('behavior.framework', true);
$document = JFactory::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 = JHtml::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);
}
}
}