Mercurial > kallithea
comparison rhodecode/templates/base/base.html @ 1653:b1e1dffd595c beta
one generic qfilter function.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 04 Nov 2011 21:18:46 +0200 |
parents | 0069657aaf42 |
children | 8cb7f5c4d494 |
comparison
equal
deleted
inserted
replaced
1652:8384eaabeb19 | 1653:b1e1dffd595c |
---|---|
254 </li> | 254 </li> |
255 </ul> | 255 </ul> |
256 <script type="text/javascript"> | 256 <script type="text/javascript"> |
257 YUE.on('repo_switcher','mouseover',function(){ | 257 YUE.on('repo_switcher','mouseover',function(){ |
258 function qfilter(){ | 258 function qfilter(){ |
259 var S = YAHOO.util.Selector; | 259 var nodes = YUQ('ul#repo_switcher_list li a.repo_name'); |
260 | 260 var target = 'q_filter_rs'; |
261 var q_filter = YUD.get('q_filter_rs'); | 261 var func = function(node){ |
262 var F = YAHOO.namespace('q_filter_rs'); | 262 return node.parentNode; |
263 | 263 } |
264 YUE.on(q_filter,'click',function(){ | 264 q_filter(target,nodes,func); |
265 q_filter.value = ''; | 265 } |
266 }); | |
267 | |
268 F.filterTimeout = null; | |
269 | |
270 F.updateFilter = function() { | |
271 // Reset timeout | |
272 F.filterTimeout = null; | |
273 | |
274 var obsolete = []; | |
275 var nodes = S.query('ul#repo_switcher_list li a.repo_name'); | |
276 var req = YUD.get('q_filter_rs').value.toLowerCase(); | |
277 for (n in nodes){ | |
278 YUD.setStyle(nodes[n].parentNode,'display','') | |
279 } | |
280 if (req){ | |
281 for (n in nodes){ | |
282 if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) { | |
283 obsolete.push(nodes[n]); | |
284 } | |
285 } | |
286 if(obsolete){ | |
287 for (n in obsolete){ | |
288 YUD.setStyle(obsolete[n].parentNode,'display','none'); | |
289 } | |
290 } | |
291 } | |
292 } | |
293 | |
294 YUE.on(q_filter,'keyup',function(e){ | |
295 clearTimeout(F.filterTimeout); | |
296 F.filterTimeout = setTimeout(F.updateFilter,600); | |
297 }); | |
298 } | |
299 var loaded = YUD.hasClass('repo_switcher','loaded'); | 266 var loaded = YUD.hasClass('repo_switcher','loaded'); |
300 if(!loaded){ | 267 if(!loaded){ |
301 YUD.addClass('repo_switcher','loaded'); | 268 YUD.addClass('repo_switcher','loaded'); |
302 ypjax("${h.url('repo_switcher')}",'repo_switcher_list', | 269 ypjax("${h.url('repo_switcher')}",'repo_switcher_list', |
303 function(o){qfilter();}, | 270 function(o){qfilter();}, |
305 ,null); | 272 ,null); |
306 } | 273 } |
307 return false; | 274 return false; |
308 }); | 275 }); |
309 | 276 |
310 YUE.on('branch_tag_switcher','mouseover',function(){ | 277 YUE.on('branch_tag_switcher','mouseover',function(){ |
311 var loaded = YUD.hasClass('branch_tag_switcher','loaded'); | 278 var loaded = YUD.hasClass('branch_tag_switcher','loaded'); |
312 if(!loaded){ | 279 if(!loaded){ |
313 YUD.addClass('branch_tag_switcher','loaded'); | 280 YUD.addClass('branch_tag_switcher','loaded'); |
314 ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list', | 281 ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list', |
315 function(o){}, | 282 function(o){}, |
316 function(o){YUD.removeClass('branch_tag_switcher','loaded');} | 283 function(o){YUD.removeClass('branch_tag_switcher','loaded');} |
317 ,null); | 284 ,null); |
318 } | 285 } |
319 return false; | 286 return false; |
320 }); | 287 }); |
321 </script> | 288 </script> |
322 %else: | 289 %else: |
323 ##ROOT MENU | 290 ##ROOT MENU |
324 <ul id="quick"> | 291 <ul id="quick"> |
325 <li> | 292 <li> |