1
var global_timeout_id = null;
2
var global_search_request = null;
4
window.addEvent('domready', function()
6
var search_box = $('q');
7
search_box.removeEvents();
12
if($('q').value == '')
14
$('search_terms').setStyle('display','none');
18
if (null != global_timeout_id)
20
clearTimeout(global_timeout_id);
22
global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
26
search: function(query)
28
url = global_path + 'search?query=' + query;
30
if ($defined(global_search_request))
32
global_search_request.cancel();
34
global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
36
cool_search(response,query);
39
global_search_request.send('');
40
var posicion = search_box.getPosition();
41
var size = search_box.getSize();
43
$('search_terms').setStyle('position','absolute');
44
$('search_terms').setStyle('left',posicion.x);
45
$('search_terms').setStyle('top',posicion.y + size.y);
46
$('search_terms').setStyle('display','block');
47
$('search_terms').set('html','Loading...');
49
new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
56
function cool_search(response, query)
58
var posicion = $('q').getPosition();
59
var size = $('q').getSize();
60
var current_query = $('q').get('value');
61
if (current_query == query)
63
$('search_terms').set('html',response);
64
$('search_terms').setStyle('display','block');
65
$('search_terms').setStyle('position','absolute');
66
$('search_terms').setStyle('left',posicion.x);
67
$('search_terms').setStyle('top',posicion.y + size.y);
71
function hide_search()
73
hide_div = setTimeout("$('search_terms').setStyle('display','none')", 300);
75
var Colapsable = new Class({
76
initialize: function(item,expand_icon,open_content,close_content,is_open)
79
if ($defined(is_open))
81
this.is_open = is_open;
84
item.set('colapsable',this);
85
this.open_content = open_content;
86
this.close_content = close_content;
87
this.expand_icon = expand_icon;
89
var expander = new Fx.Slide(this.item, { duration: 200 } );
93
if ($defined(this.expand_icon))
95
this.expand_icon.set('src',this.expand_icon.title);
100
if ($defined(this.expand_icon))
102
this.expand_icon.set('src',this.expand_icon.alt);
109
this.item.setStyle('display', 'block');
110
var expander = this.item.get('slide');
112
if ($defined(this.open_content))
114
for (var i=0;i<this.open_content.length;++i)
116
this.open_content[i].setStyle('display','block');
120
if ($defined(this.close_content))
122
for (var i=0;i<this.close_content.length;++i)
124
this.close_content[i].setStyle('display','none');
128
if ($defined(this.expand_icon))
130
this.expand_icon.set('src',this.expand_icon.alt);
137
var expander = this.item.get('slide');
139
if ($defined(this.open_content))
141
for (var i=0;i<this.open_content.length;++i)
143
this.open_content[i].setStyle('display','none');
147
if ($defined(this.close_content))
149
for (var i=0;i<this.close_content.length;++i)
151
this.close_content[i].setStyle('display','block');
154
if ($defined(this.expand_icon))
156
this.expand_icon.set('src',this.expand_icon.title);
158
this.is_open = false;
180
window.addEvent('domready', function()
182
$$('.revision_log').each(function(item, i)
184
var item_slide = item.getElement('.revisioninfo');
185
var open_content = new Array();
186
var close_content = new Array();
187
open_content.push(item.getElement('.long_description'));
188
close_content.push(item.getElement('.short_description'));
189
var expand_icon = item.getElement('.expand_icon');
190
var colapsable = new Colapsable(item_slide,expand_icon,open_content,close_content);
192
item.getElement('.expand_revisioninfo').addEvent('click',function(){colapsable.toggle();});
193
item.colapsable = colapsable;
196
$$('.diffBox').each(function(item, i)
198
var item_slide = item.getNext('.diffinfo');
199
var expand_icon = item.getElement( '.expand_diff' );
200
var colapsable = new Colapsable(item_slide,expand_icon,null,null,true);
201
item.getElement( '.expand_diff' ).addEvent( 'click', function(){colapsable.toggle();});
202
item.colapsable=colapsable;
206
function toggle_expand_all(action)
208
$$('.revision_log').each(function(item, i)
210
var colapsable = item.colapsable;
211
if(action == 'close')
213
$('expand_all').setStyle('display','block');
214
$('collapse_all').setStyle('display','none');
217
else if(action == 'open')
219
$('expand_all').setStyle('display','none');
220
$('collapse_all').setStyle('display','block');
226
function toggle_expand_all_revisionview(action)
228
$$('.diffBox').each(function(item, i)
230
var colapsable = item.colapsable;
231
if(action == 'close')
233
$('expand_all').setStyle('display','block');
234
$('collapse_all').setStyle('display','none');
237
else if(action == 'open')
239
$('expand_all').setStyle('display','none');
240
$('collapse_all').setStyle('display','block');