1
Y = YUI().use("node", "io-base", "io-queue", "anim");
1
5
var global_timeout_id = null;
2
6
var global_search_request = null;
4
window.addEvent('domready', function()
6
var search_box = $('q');
7
search_box.removeEvents();
12
var search_box = Y.get('#q');
13
if (!Y.Lang.isNull(search_box))
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('');
15
function get_suggestions() {
16
var query = search_box.get('value');
17
var url = global_path + 'search?query=' + query;
19
if (!Y.Lang.isNull(global_search_request))
21
global_search_request.abort();
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);
23
global_search_request = Y.io(
26
on: {complete: cool_search},
31
var region = search_box.get('region');
32
var current_query = search_box.get('value');
34
Y.get('#search_terms').setStyle('display', 'block');
35
Y.get('#search_terms').setStyle('position', 'absolute');
36
Y.get('#search_terms').setStyle('left', region.left);
37
Y.get('#search_terms').setStyle('top', region.bottom);
38
Y.get('#search_terms').set('innerHTML','Loading...');
44
if(search_box.get('value') == '')
46
Y.get('#search_terms').setStyle('display', 'none');
50
if (null != global_timeout_id)
52
clearTimeout(global_timeout_id);
54
global_timeout_id = setTimeout(get_suggestions, 200);
60
function cool_search(tid, response, query)
63
var region = q.get('region');
64
var current_query = q.get('value');
65
if (current_query == query)
67
Y.get('#search_terms').set('innerHTML', response.responseText);
68
Y.get('#search_terms').setStyle('display', 'block');
69
Y.get('#search_terms').setStyle('position', 'absolute');
70
Y.get('#search_terms').setStyle('left', region.left);
71
Y.get('#search_terms').setStyle('top', region.bottom);
71
75
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');
77
setTimeout("Y.get('#search_terms').setStyle('display','none')", 300);
80
function Collapsable(config)
82
this.is_open = config.is_open;
83
this.source_target = config.source_target;
84
this.open_node = config.open_node;
85
this.close_node = config.close_node;
86
this.expand_icon = config.expand_icon;
87
this.source = config.source;
88
this.loading = config.loading;
89
this.node_process = config.node_process;
92
function get_height(node) {
93
node.setStyle('position', 'absolute');
94
node.setStyle('top', -1000000000);
95
node.setStyle('display', 'block');
96
var height = node.get('region').height;
97
node.setStyle('display', 'none');
98
node.setStyle('position', 'static');
99
node.setStyle('top', 'auto');
103
Collapsable.prototype._load_finished = function(tid, res, args)
105
var newNode = Y.Node.create(res.responseText.split('\n').splice(1).join(''));
106
if (this.node_process)
107
this.node_process(newNode);
108
this.source_target.ancestor().replaceChild(newNode, this.source_target);
109
this.source_target = null;
111
this.loading.setStyle('display', 'none');
115
Collapsable.prototype.open = function(callback)
118
this.loading.setStyle('display', 'block');
122
on: {complete: this._load_finished},
123
arguments: [callback],
129
var open_height = get_height(this.open_node);
132
if (this.close_node) {
133
close_height = this.close_node.get('region').height;
139
var container = this.open_node.ancestor('.container');
141
var anim = new Y.Anim(
145
marginBottom: close_height - open_height
153
anim.on('end', this.openComplete, this, callback);
154
container.setStyle('marginBottom', close_height - open_height);
155
if (this.close_node) {
156
this.close_node.setStyle('display', 'none');
158
this.open_node.setStyle('display', 'block');
159
this.expand_icon.set('src', this.expand_icon.get('alt'));
163
Collapsable.prototype.openComplete = function(evt, callback)
165
if (callback) callback();
169
Collapsable.prototype.close = function()
171
var container = this.open_node.ancestor('.container');
173
var open_height = this.open_node.get('region').height;
176
if (this.close_node) {
177
close_height = get_height(this.close_node);
183
var anim = new Y.Anim(
190
marginBottom: close_height - open_height
194
anim.on("end", this.closeComplete, this);
198
Collapsable.prototype.closeComplete = function () {
199
this.open_node.setStyle('display', 'none');
200
if (this.close_node) {
201
this.close_node.setStyle('display', 'block');
203
this.open_node.ancestor('.container').setStyle('marginBottom', 0);
204
this.expand_icon.set('src', this.expand_icon.get('title'));
205
this.is_open = false;
208
Collapsable.prototype.toggle = function()