1
Y = YUI().use("node", "io-base", "anim");
1
3
var global_timeout_id = null;
2
4
var global_search_request = null;
4
window.addEvent('domready', function()
6
var search_box = $('q');
7
if ($defined(search_box))
10
var search_box = Y.get('#q');
11
if (!Y.Lang.isNull(search_box))
9
search_box.removeEvents();
14
if($('q').value == '')
16
$('search_terms').setStyle('display','none');
20
if (null != global_timeout_id)
22
clearTimeout(global_timeout_id);
24
global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
28
search: function(query)
30
url = global_path + 'search?query=' + query;
32
if ($defined(global_search_request))
34
global_search_request.cancel();
36
global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
38
cool_search(response,query);
41
global_search_request.send('');
42
var posicion = search_box.getPosition();
43
var size = search_box.getSize();
45
$('search_terms').setStyle('position','absolute');
46
$('search_terms').setStyle('left',posicion.x);
47
$('search_terms').setStyle('top',posicion.y + size.y);
48
$('search_terms').setStyle('display','block');
49
$('search_terms').set('html','Loading...');
51
new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
13
function get_suggestions() {
14
var query = search_box.get('value');
15
var url = global_path + 'search?query=' + query;
17
if (!Y.Lang.isNull(global_search_request))
19
global_search_request.abort();
21
global_search_request = Y.io(
24
on: {complete: cool_search},
29
var region = search_box.get('region');
30
var current_query = search_box.get('value');
32
Y.get('#search_terms').setStyle('display', 'block');
33
Y.get('#search_terms').setStyle('position', 'absolute');
34
Y.get('#search_terms').setStyle('left', region.left);
35
Y.get('#search_terms').setStyle('top', region.bottom);
36
Y.get('#search_terms').set('innerHTML','Loading...');
42
if(search_box.get('value') == '')
44
Y.get('#search_terms').setStyle('display', 'none');
48
if (null != global_timeout_id)
50
clearTimeout(global_timeout_id);
52
global_timeout_id = setTimeout(get_suggestions, 200);
59
function cool_search(response, query)
58
function cool_search(tid, response, query)
61
var posicion = $('q').getPosition();
62
var size = $('q').getSize();
63
var current_query = $('q').get('value');
64
if (current_query == query)
66
$('search_terms').set('html',response);
67
$('search_terms').setStyle('display','block');
68
$('search_terms').setStyle('position','absolute');
69
$('search_terms').setStyle('left',posicion.x);
70
$('search_terms').setStyle('top',posicion.y + size.y);
61
var region = q.get('region');
62
var current_query = q.get('value');
63
if (current_query == query)
65
Y.get('#search_terms').set('innerHTML', response.responseText);
66
Y.get('#search_terms').setStyle('display', 'block');
67
Y.get('#search_terms').setStyle('position', 'absolute');
68
Y.get('#search_terms').setStyle('left', region.left);
69
Y.get('#search_terms').setStyle('top', region.bottom);
74
73
function hide_search()
76
hide_div = setTimeout("$('search_terms').setStyle('display','none')", 300);
78
var Colapsable = new Class({
79
initialize: function(item,expand_icon,open_content,close_content,is_open)
82
if ($defined(is_open))
84
this.is_open = is_open;
87
item.set('colapsable',this);
88
this.open_content = open_content;
89
this.close_content = close_content;
90
this.expand_icon = expand_icon;
92
var expander = new Fx.Slide(this.item, { duration: 200 } );
96
if ($defined(this.expand_icon))
98
this.expand_icon.set('src',this.expand_icon.title);
103
if ($defined(this.expand_icon))
105
this.expand_icon.set('src',this.expand_icon.alt);
112
this.item.setStyle('display', 'block');
113
var expander = this.item.get('slide');
115
if ($defined(this.open_content))
117
for (var i=0;i<this.open_content.length;++i)
119
this.open_content[i].setStyle('display','block');
123
if ($defined(this.close_content))
125
for (var i=0;i<this.close_content.length;++i)
127
this.close_content[i].setStyle('display','none');
131
if ($defined(this.expand_icon))
133
this.expand_icon.set('src',this.expand_icon.alt);
140
var expander = this.item.get('slide');
142
if ($defined(this.open_content))
144
for (var i=0;i<this.open_content.length;++i)
146
this.open_content[i].setStyle('display','none');
150
if ($defined(this.close_content))
152
for (var i=0;i<this.close_content.length;++i)
154
this.close_content[i].setStyle('display','block');
157
if ($defined(this.expand_icon))
159
this.expand_icon.set('src',this.expand_icon.title);
161
this.is_open = false;
183
window.addEvent('domready', function()
185
$$('.revision_log').each(function(item, i)
187
var item_slide = item.getElement('.revisioninfo');
188
var open_content = new Array();
189
var close_content = new Array();
190
open_content.push(item.getElement('.long_description'));
191
close_content.push(item.getElement('.short_description'));
192
var expand_icon = item.getElement('.expand_icon');
193
var colapsable = new Colapsable(item_slide,expand_icon,open_content,close_content);
195
item.getElement('.expand_revisioninfo').addEvent('click',function(){colapsable.toggle();});
196
item.colapsable = colapsable;
199
$$('.diffBox').each(function(item, i)
201
var item_slide = item.getNext('.diffinfo');
202
var expand_icon = item.getElement( '.expand_diff' );
203
var colapsable = new Colapsable(item_slide,expand_icon,null,null,true);
204
item.getElement( '.expand_diff' ).addEvent( 'click', function(){colapsable.toggle();});
205
item.colapsable=colapsable;
209
function toggle_expand_all(action)
211
$$('.revision_log').each(function(item, i)
213
var colapsable = item.colapsable;
214
if(action == 'close')
216
$('expand_all').setStyle('display','block');
217
$('collapse_all').setStyle('display','none');
220
else if(action == 'open')
222
$('expand_all').setStyle('display','none');
223
$('collapse_all').setStyle('display','block');
229
function toggle_expand_all_revisionview(action)
231
$$('.diffBox').each(function(item, i)
233
var colapsable = item.colapsable;
234
if(action == 'close')
236
$('expand_all').setStyle('display','block');
237
$('collapse_all').setStyle('display','none');
240
else if(action == 'open')
242
$('expand_all').setStyle('display','none');
243
$('collapse_all').setStyle('display','block');
75
setTimeout("Y.get('#search_terms').setStyle('display','none')", 300);
78
function Collapsable(item, expand_icon, open_content, close_content, is_open)
80
this.is_open = is_open;
82
this.open_content = open_content;
83
this.close_content = close_content;
84
this.expand_icon = expand_icon;
87
this.height = item.get('region').height;
93
//var expander = new Fx.Slide(this.item, { duration: 200 } );
96
this.expand_icon.set('src',this.expand_icon.get('title'));
100
this.expand_icon.set('src',this.expand_icon.get('alt'));
104
function get_height(node) {
105
node.setStyle('position', 'absolute');
106
node.setStyle('top', -1000000000);
107
node.setStyle('display', 'block');
108
var height = node.get('region').height;
109
node.setStyle('display', 'none');
110
node.setStyle('position', 'static');
111
node.setStyle('top', 'auto');
115
Collapsable.prototype.open = function()
117
if (this.height == null) {
118
this.height = get_height(this.item);
121
var anim = new Y.Anim(
132
anim.on('end', this.openComplete, this);
133
this.item.setStyle('height', 0);
134
this.item.setStyle('display', 'block');
138
Collapsable.prototype.openComplete = function()
140
for (var i=0;i<this.open_content.length;++i)
142
this.open_content[i].setStyle('display','block');
145
for (var i=0;i<this.close_content.length;++i)
147
this.close_content[i].setStyle('display','none');
150
this.expand_icon.set('src',this.expand_icon.get('alt'));
154
Collapsable.prototype.close = function()
156
var item = this.item;
157
var anim = new Y.Anim(
168
anim.on("end", this.closeComplete, this);
172
Collapsable.prototype.closeComplete = function () {
173
this.item.setStyle('display', 'none');
175
for (i=0;i<this.open_content.length;++i)
177
this.open_content[i].setStyle('display','none');
180
for (i=0;i<this.close_content.length;++i)
182
this.close_content[i].setStyle('display','block');
184
this.expand_icon.set('src',this.expand_icon.get('title'));
185
this.is_open = false;
188
Collapsable.prototype.isOpen = function()
193
Collapsable.prototype.toggle = function()