75
75
setTimeout("Y.get('#search_terms').setStyle('display','none')", 300);
78
function Collapsable(item, expand_icon, open_content, close_content, is_open)
78
function Collapsable(config)
80
this.is_open = is_open;
82
this.open_content = open_content;
83
this.close_content = close_content;
84
this.expand_icon = expand_icon;
89
this.height = item.get('region').height;
95
//var expander = new Fx.Slide(this.item, { duration: 200 } );
98
this.expand_icon.set('src',this.expand_icon.get('title'));
102
this.expand_icon.set('src',this.expand_icon.get('alt'));
80
this.is_open = config.is_open;
81
this.source_target = config.source_target;
82
this.open_node = config.open_node;
83
this.close_node = config.close_node;
84
this.expand_icon = config.expand_icon;
85
this.source = config.source;
106
88
function get_height(node) {
117
99
Collapsable.prototype._load_finished = function(tid, res)
101
var newNode = Y.Node.create(res.responseText.split('\n').splice(1).join(''));
102
this.source_target.ancestor().replaceChild(newNode, this.source_target);
103
this.source_target = null;
119
104
this.source = null;
120
var newNode = this.item.create(res.responseText.split('\n').splice(1).join(''));
121
this.item.ancestor().replaceChild(newNode, this.item);
138
if (this.height == null) {
139
this.height = get_height(this.open_content[0]);
142
var clo_height = this.close_content[0].get('region').height;
144
this.anim = new Y.Anim(
120
var open_height = get_height(this.open_node);
123
if (this.close_node) {
124
close_height = this.close_node.get('region').height;
130
var container = this.open_node.ancestor('.container');
132
var anim = new Y.Anim(
146
node: this.item.ancestor('.container'),
148
marginBottom: clo_height - this.height
136
marginBottom: close_height - open_height
155
this.anim.on('end', this.openComplete, this);
156
this.close_content[0].setStyle('display', 'none');
157
this.open_content[0].setStyle('display', 'block');
144
anim.on('end', this.openComplete, this);
145
container.setStyle('marginBottom', close_height - this.height);
146
if (this.close_node) {
147
this.close_node.setStyle('display', 'none');
149
this.open_node.setStyle('display', 'block');
158
150
this.expand_icon.set('src',this.expand_icon.get('alt'));
159
this.item.ancestor('.container').setStyle('marginBottom', clo_height - this.height);
160
this.item.setStyle('display', 'block');
164
154
Collapsable.prototype.openComplete = function()
166
156
this.is_open = true;
170
159
Collapsable.prototype.close = function()
172
var item = this.item;
161
var container = this.open_node.ancestor('.container');
163
var open_height = this.open_node.get('region').height;
166
if (this.close_node) {
167
close_height = get_height(this.close_node);
173
173
var anim = new Y.Anim(
175
node: this.item.ancestor('.container'),
180
marginBottom: get_height(this.close_content[0]) - this.height
180
marginBottom: close_height - open_height
188
188
Collapsable.prototype.closeComplete = function () {
189
189
//this.item.setStyle('display', 'none');
190
this.open_content[0].setStyle('display', 'none');
191
this.close_content[0].setStyle('display', 'block');
192
this.item.ancestor('.container').setStyle('marginBottom', 0);
190
this.open_node.setStyle('display', 'none');
191
if (this.close_node) {
192
this.close_node.setStyle('display', 'block');
194
this.open_node.ancestor('.container').setStyle('marginBottom', 0);
193
195
this.expand_icon.set('src', this.expand_icon.get('title'));
194
196
this.is_open = false;