##// END OF EJS Templates
added author to main page tooltip
marcink -
r1458:9d9e491e beta
parent child Browse files
Show More
@@ -1,150 +1,150 b''
1 /**
1 /**
2 RhodeCode JS Files
2 RhodeCode JS Files
3 **/
3 **/
4
4
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
6 console = { log: function() {} }
6 console = { log: function() {} }
7 }
7 }
8
8
9
9
10 function str_repeat(i, m) {
10 function str_repeat(i, m) {
11 for (var o = []; m > 0; o[--m] = i);
11 for (var o = []; m > 0; o[--m] = i);
12 return o.join('');
12 return o.join('');
13 }
13 }
14
14
15 /**
15 /**
16 * INJECT .format function into String
16 * INJECT .format function into String
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
18 * Return "My name is Johny Bravo"
18 * Return "My name is Johny Bravo"
19 * Inspired by https://gist.github.com/1049426
19 * Inspired by https://gist.github.com/1049426
20 */
20 */
21 String.prototype.format = function() {
21 String.prototype.format = function() {
22
22
23 function format() {
23 function format() {
24 var str = this;
24 var str = this;
25 var len = arguments.length+1;
25 var len = arguments.length+1;
26 var safe = undefined;
26 var safe = undefined;
27 var arg = undefined;
27 var arg = undefined;
28
28
29 // For each {0} {1} {n...} replace with the argument in that position. If
29 // For each {0} {1} {n...} replace with the argument in that position. If
30 // the argument is an object or an array it will be stringified to JSON.
30 // the argument is an object or an array it will be stringified to JSON.
31 for (var i=0; i < len; arg = arguments[i++]) {
31 for (var i=0; i < len; arg = arguments[i++]) {
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
34 }
34 }
35 return str;
35 return str;
36 }
36 }
37
37
38 // Save a reference of what may already exist under the property native.
38 // Save a reference of what may already exist under the property native.
39 // Allows for doing something like: if("".format.native) { /* use native */ }
39 // Allows for doing something like: if("".format.native) { /* use native */ }
40 format.native = String.prototype.format;
40 format.native = String.prototype.format;
41
41
42 // Replace the prototype property
42 // Replace the prototype property
43 return format;
43 return format;
44
44
45 }();
45 }();
46
46
47 /**
47 /**
48 * GLOBAL YUI Shortcuts
48 * GLOBAL YUI Shortcuts
49 */
49 */
50 var YUC = YAHOO.util.Connect;
50 var YUC = YAHOO.util.Connect;
51 var YUD = YAHOO.util.Dom;
51 var YUD = YAHOO.util.Dom;
52 var YUE = YAHOO.util.Event;
52 var YUE = YAHOO.util.Event;
53 var YUQ = YAHOO.util.Selector.query;
53 var YUQ = YAHOO.util.Selector.query;
54
54
55 // defines if push state is enabled for this browser ?
55 // defines if push state is enabled for this browser ?
56 var push_state_enabled = Boolean(
56 var push_state_enabled = Boolean(
57 window.history && window.history.pushState && window.history.replaceState
57 window.history && window.history.pushState && window.history.replaceState
58 && !( /* disable for versions of iOS before version 4.3 (8F190) */
58 && !( /* disable for versions of iOS before version 4.3 (8F190) */
59 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
59 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
60 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
60 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
61 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
61 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
62 )
62 )
63 )
63 )
64
64
65 /**
65 /**
66 * Partial Ajax Implementation
66 * Partial Ajax Implementation
67 *
67 *
68 * @param url: defines url to make partial request
68 * @param url: defines url to make partial request
69 * @param container: defines id of container to input partial result
69 * @param container: defines id of container to input partial result
70 * @param s_call: success callback function that takes o as arg
70 * @param s_call: success callback function that takes o as arg
71 * o.tId
71 * o.tId
72 * o.status
72 * o.status
73 * o.statusText
73 * o.statusText
74 * o.getResponseHeader[ ]
74 * o.getResponseHeader[ ]
75 * o.getAllResponseHeaders
75 * o.getAllResponseHeaders
76 * o.responseText
76 * o.responseText
77 * o.responseXML
77 * o.responseXML
78 * o.argument
78 * o.argument
79 * @param f_call: failure callback
79 * @param f_call: failure callback
80 * @param args arguments
80 * @param args arguments
81 */
81 */
82 function ypjax(url,container,s_call,f_call,args){
82 function ypjax(url,container,s_call,f_call,args){
83 var method='GET';
83 var method='GET';
84 if(args===undefined){
84 if(args===undefined){
85 args=null;
85 args=null;
86 }
86 }
87
87
88 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
88 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
89 YUC.initHeader('X-PARTIAL-XHR',true);
89 YUC.initHeader('X-PARTIAL-XHR',true);
90
90
91 // wrapper of passed callback
91 // wrapper of passed callback
92 var s_wrapper = (function(o){
92 var s_wrapper = (function(o){
93 return function(o){
93 return function(o){
94 YUD.get(container).innerHTML=o.responseText;
94 YUD.get(container).innerHTML=o.responseText;
95 YUD.setStyle(container,'opacity','1.0');
95 YUD.setStyle(container,'opacity','1.0');
96 //execute the given original callback
96 //execute the given original callback
97 if (s_call !== undefined){
97 if (s_call !== undefined){
98 s_call(o);
98 s_call(o);
99 }
99 }
100 }
100 }
101 })()
101 })()
102 YUD.setStyle(container,'opacity','0.3');
102 YUD.setStyle(container,'opacity','0.3');
103 YUC.asyncRequest(method,url,{
103 YUC.asyncRequest(method,url,{
104 success:s_wrapper,
104 success:s_wrapper,
105 failure:function(o){
105 failure:function(o){
106 //failure
106 //failure
107 window.location = url;
107 window.location = url;
108 }
108 }
109 },args);
109 },args);
110
110
111 }
111 }
112
112
113 /**
113 /**
114 * tooltip activate
114 * tooltip activate
115 */
115 */
116 function tooltip_activate(){
116 var tooltip_activate = function(){
117 function toolTipsId(){
117 function toolTipsId(){
118 var ids = [];
118 var ids = [];
119 var tts = YUQ('.tooltip');
119 var tts = YUQ('.tooltip');
120 for (var i = 0; i < tts.length; i++) {
120 for (var i = 0; i < tts.length; i++) {
121 // if element doesn't not have and id
121 // if element doesn't not have and id
122 // autogenerate one for tooltip
122 // autogenerate one for tooltip
123 if (!tts[i].id){
123 if (!tts[i].id){
124 tts[i].id='tt'+((i*100)+tts.length);
124 tts[i].id='tt'+((i*100)+tts.length);
125 }
125 }
126 ids.push(tts[i].id);
126 ids.push(tts[i].id);
127 }
127 }
128 return ids
128 return ids
129 };
129 };
130 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
130 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
131 context: [[toolTipsId()],"tl","bl",null,[0,5]],
131 context: [[toolTipsId()],"tl","bl",null,[0,5]],
132 monitorresize:false,
132 monitorresize:false,
133 xyoffset :[0,0],
133 xyoffset :[0,0],
134 autodismissdelay:300000,
134 autodismissdelay:300000,
135 hidedelay:5,
135 hidedelay:5,
136 showdelay:20,
136 showdelay:20,
137 });
137 });
138 }
138 }
139
139
140 /**
140 /**
141 * show more
141 * show more
142 */
142 */
143 function show_more_event(){
143 var show_more_event = function(){
144 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
144 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
145 var el = e.target;
145 var el = e.target;
146 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
146 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
147 YUD.setStyle(el.parentNode,'display','none');
147 YUD.setStyle(el.parentNode,'display','none');
148 });
148 });
149 }
149 }
150
150
@@ -1,246 +1,246 b''
1 <%page args="parent" />
1 <%page args="parent" />
2 <%def name="get_sort(name)">
2 <%def name="get_sort(name)">
3 <%name_slug = name.lower().replace(' ','_') %>
3 <%name_slug = name.lower().replace(' ','_') %>
4
4
5 %if name_slug == c.sort_slug:
5 %if name_slug == c.sort_slug:
6 %if c.sort_by.startswith('-'):
6 %if c.sort_by.startswith('-'):
7 <a href="?sort=${name_slug}">${name}&uarr;</a>
7 <a href="?sort=${name_slug}">${name}&uarr;</a>
8 %else:
8 %else:
9 <a href="?sort=-${name_slug}">${name}&darr;</a>
9 <a href="?sort=-${name_slug}">${name}&darr;</a>
10 %endif:
10 %endif:
11 %else:
11 %else:
12 <a href="?sort=${name_slug}">${name}</a>
12 <a href="?sort=${name_slug}">${name}</a>
13 %endif
13 %endif
14 </%def>
14 </%def>
15
15
16 <div class="box">
16 <div class="box">
17 <!-- box / title -->
17 <!-- box / title -->
18 <div class="title">
18 <div class="title">
19 <h5><input class="top-right-rounded-corner top-left-rounded-corner
19 <h5><input class="top-right-rounded-corner top-left-rounded-corner
20 bottom-left-rounded-corner bottom-right-rounded-corner"
20 bottom-left-rounded-corner bottom-right-rounded-corner"
21 id="q_filter" size="15" type="text" name="filter"
21 id="q_filter" size="15" type="text" name="filter"
22 value="${_('quick filter...')}"/>
22 value="${_('quick filter...')}"/>
23 ${parent.breadcrumbs()} <span id="repo_count"></span> ${_('repositories')}
23 ${parent.breadcrumbs()} <span id="repo_count"></span> ${_('repositories')}
24 </h5>
24 </h5>
25 %if c.rhodecode_user.username != 'default':
25 %if c.rhodecode_user.username != 'default':
26 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
26 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
27 <ul class="links">
27 <ul class="links">
28 <li>
28 <li>
29 <span>${h.link_to(_('ADD NEW REPOSITORY'),h.url('admin_settings_create_repository'))}</span>
29 <span>${h.link_to(_('ADD NEW REPOSITORY'),h.url('admin_settings_create_repository'))}</span>
30 </li>
30 </li>
31 </ul>
31 </ul>
32 %endif
32 %endif
33 %endif
33 %endif
34 </div>
34 </div>
35 <!-- end box / title -->
35 <!-- end box / title -->
36 <div class="table">
36 <div class="table">
37 % if c.groups:
37 % if c.groups:
38 <table>
38 <table>
39 <thead>
39 <thead>
40 <tr>
40 <tr>
41 <th class="left"><a href="#">${_('Group name')}</a></th>
41 <th class="left"><a href="#">${_('Group name')}</a></th>
42 <th class="left"><a href="#">${_('Description')}</a></th>
42 <th class="left"><a href="#">${_('Description')}</a></th>
43 ##<th class="left"><a href="#">${_('Number of repositories')}</a></th>
43 ##<th class="left"><a href="#">${_('Number of repositories')}</a></th>
44 </tr>
44 </tr>
45 </thead>
45 </thead>
46
46
47 ## REPO GROUPS
47 ## REPO GROUPS
48
48
49 % for gr in c.groups:
49 % for gr in c.groups:
50 <tr>
50 <tr>
51 <td>
51 <td>
52 <div style="white-space: nowrap">
52 <div style="white-space: nowrap">
53 <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
53 <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
54 ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
54 ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
55 </div>
55 </div>
56 </td>
56 </td>
57 <td>${gr.group_description}</td>
57 <td>${gr.group_description}</td>
58 ##<td><b>${gr.repositories.count()}</b></td>
58 ##<td><b>${gr.repositories.count()}</b></td>
59 </tr>
59 </tr>
60 % endfor
60 % endfor
61
61
62 </table>
62 </table>
63 <div style="height: 20px"></div>
63 <div style="height: 20px"></div>
64 % endif
64 % endif
65 <div id="welcome" style="display:none;text-align:center">
65 <div id="welcome" style="display:none;text-align:center">
66 <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
66 <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
67 </div>
67 </div>
68 <table id="repos_list">
68 <table id="repos_list">
69 <thead>
69 <thead>
70 <tr>
70 <tr>
71 <th class="left"></th>
71 <th class="left"></th>
72 <th class="left">${get_sort(_('Name'))}</th>
72 <th class="left">${get_sort(_('Name'))}</th>
73 <th class="left">${get_sort(_('Description'))}</th>
73 <th class="left">${get_sort(_('Description'))}</th>
74 <th class="left">${get_sort(_('Last change'))}</th>
74 <th class="left">${get_sort(_('Last change'))}</th>
75 <th class="left">${get_sort(_('Tip'))}</th>
75 <th class="left">${get_sort(_('Tip'))}</th>
76 <th class="left">${get_sort(_('Owner'))}</th>
76 <th class="left">${get_sort(_('Owner'))}</th>
77 <th class="left">${_('RSS')}</th>
77 <th class="left">${_('RSS')}</th>
78 <th class="left">${_('Atom')}</th>
78 <th class="left">${_('Atom')}</th>
79 </tr>
79 </tr>
80 </thead>
80 </thead>
81 <tbody>
81 <tbody>
82 %for cnt,repo in enumerate(c.repos_list):
82 %for cnt,repo in enumerate(c.repos_list):
83 <tr class="parity${cnt%2}">
83 <tr class="parity${cnt%2}">
84 <td class="quick_repo_menu">
84 <td class="quick_repo_menu">
85 <ul class="menu_items hidden">
85 <ul class="menu_items hidden">
86 <li>
86 <li>
87 <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=repo['name'])}">
87 <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=repo['name'])}">
88 <span class="icon">
88 <span class="icon">
89 <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
89 <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
90 </span>
90 </span>
91 <span>${_('Summary')}</span>
91 <span>${_('Summary')}</span>
92 </a>
92 </a>
93 </li>
93 </li>
94 <li>
94 <li>
95 <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=repo['name'])}">
95 <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=repo['name'])}">
96 <span class="icon">
96 <span class="icon">
97 <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
97 <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
98 </span>
98 </span>
99 <span>${_('Changelog')}</span>
99 <span>${_('Changelog')}</span>
100 </a>
100 </a>
101 </li>
101 </li>
102 <li>
102 <li>
103 <a title="${_('Files')}" href="${h.url('files_home',repo_name=repo['name'])}">
103 <a title="${_('Files')}" href="${h.url('files_home',repo_name=repo['name'])}">
104 <span class="icon">
104 <span class="icon">
105 <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
105 <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
106 </span>
106 </span>
107 <span>${_('Files')}</span>
107 <span>${_('Files')}</span>
108 </a>
108 </a>
109 </li>
109 </li>
110 </ul>
110 </ul>
111 </td>
111 </td>
112 <td>
112 <td>
113 ## TYPE OF REPO
113 ## TYPE OF REPO
114 <div style="white-space: nowrap">
114 <div style="white-space: nowrap">
115 %if repo['dbrepo']['repo_type'] =='hg':
115 %if repo['dbrepo']['repo_type'] =='hg':
116 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
116 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
117 %elif repo['dbrepo']['repo_type'] =='git':
117 %elif repo['dbrepo']['repo_type'] =='git':
118 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
118 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
119 %endif
119 %endif
120
120
121 ##PRIVATE/PUBLIC
121 ##PRIVATE/PUBLIC
122 %if repo['dbrepo']['private']:
122 %if repo['dbrepo']['private']:
123 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
123 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
124 %else:
124 %else:
125 <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
125 <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
126 %endif
126 %endif
127
127
128 ##NAME
128 ##NAME
129 ${h.link_to(repo['name'],
129 ${h.link_to(repo['name'],
130 h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
130 h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
131 %if repo['dbrepo_fork']:
131 %if repo['dbrepo_fork']:
132 <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}">
132 <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}">
133 <img class="icon" alt="${_('fork')}"
133 <img class="icon" alt="${_('fork')}"
134 title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}"
134 title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}"
135 src="${h.url('/images/icons/arrow_divide.png')}"/></a>
135 src="${h.url('/images/icons/arrow_divide.png')}"/></a>
136 %endif
136 %endif
137 </div>
137 </div>
138 </td>
138 </td>
139 ##DESCRIPTION
139 ##DESCRIPTION
140 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
140 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
141 ${h.truncate(repo['description'],60)}</span>
141 ${h.truncate(repo['description'],60)}</span>
142 </td>
142 </td>
143 ##LAST CHANGE
143 ##LAST CHANGE
144 <td>
144 <td>
145 <span class="tooltip" title="${repo['last_change']}">
145 <span class="tooltip" title="${repo['last_change']}">
146 ${h.age(repo['last_change'])}</span>
146 ${h.age(repo['last_change'])}</span>
147 </td>
147 </td>
148 <td>
148 <td>
149 %if repo['rev']>=0:
149 %if repo['rev']>=0:
150 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
150 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
151 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
151 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
152 class_="tooltip",
152 class_="tooltip",
153 title=h.tooltip(repo['last_msg']))}
153 title=h.tooltip('%s\n%s' % (repo['author'],repo['last_msg'])))}
154 %else:
154 %else:
155 ${_('No changesets yet')}
155 ${_('No changesets yet')}
156 %endif
156 %endif
157 </td>
157 </td>
158 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
158 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
159 <td>
159 <td>
160 %if c.rhodecode_user.username != 'default':
160 %if c.rhodecode_user.username != 'default':
161 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
161 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
162 %else:
162 %else:
163 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
163 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
164 %endif:
164 %endif:
165 </td>
165 </td>
166 <td>
166 <td>
167 %if c.rhodecode_user.username != 'default':
167 %if c.rhodecode_user.username != 'default':
168 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
168 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
169 %else:
169 %else:
170 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
170 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
171 %endif:
171 %endif:
172 </td>
172 </td>
173 </tr>
173 </tr>
174 %endfor
174 %endfor
175
175
176 </tbody>
176 </tbody>
177 </table>
177 </table>
178 </div>
178 </div>
179 </div>
179 </div>
180
180
181
181
182 <script type="text/javascript">
182 <script type="text/javascript">
183 var D = YAHOO.util.Dom;
183 var D = YAHOO.util.Dom;
184 var E = YAHOO.util.Event;
184 var E = YAHOO.util.Event;
185 var S = YAHOO.util.Selector;
185 var S = YAHOO.util.Selector;
186
186
187 var q_filter = D.get('q_filter');
187 var q_filter = D.get('q_filter');
188 var F = YAHOO.namespace('q_filter');
188 var F = YAHOO.namespace('q_filter');
189
189
190 E.on(q_filter,'click',function(){
190 E.on(q_filter,'click',function(){
191 q_filter.value = '';
191 q_filter.value = '';
192 });
192 });
193
193
194 F.filterTimeout = null;
194 F.filterTimeout = null;
195
195
196 function set_count(count){
196 function set_count(count){
197
197
198 if(count == 0){
198 if(count == 0){
199 YUD.setStyle('repos_list','display','none');
199 YUD.setStyle('repos_list','display','none');
200 YUD.setStyle('welcome','display','');
200 YUD.setStyle('welcome','display','');
201 }
201 }
202 else{
202 else{
203 YUD.setStyle('repos_list','display','');
203 YUD.setStyle('repos_list','display','');
204 YUD.setStyle('welcome','display','none');
204 YUD.setStyle('welcome','display','none');
205 }
205 }
206 YUD.get('repo_count').innerHTML = count;
206 YUD.get('repo_count').innerHTML = count;
207
207
208 }
208 }
209
209
210
210
211 //set initial count for repos
211 //set initial count for repos
212 var nodes = S.query('div.table tr td div a.repo_name');
212 var nodes = S.query('div.table tr td div a.repo_name');
213
213
214 set_count(nodes.length)
214 set_count(nodes.length)
215 F.updateFilter = function() {
215 F.updateFilter = function() {
216 // Reset timeout
216 // Reset timeout
217 F.filterTimeout = null;
217 F.filterTimeout = null;
218
218
219 var obsolete = [];
219 var obsolete = [];
220 nodes = S.query('div.table tr td div a.repo_name');
220 nodes = S.query('div.table tr td div a.repo_name');
221 var req = q_filter.value.toLowerCase();
221 var req = q_filter.value.toLowerCase();
222 for (n in nodes){
222 for (n in nodes){
223 D.setStyle(nodes[n].parentNode.parentNode.parentNode,'display','')
223 D.setStyle(nodes[n].parentNode.parentNode.parentNode,'display','')
224 }
224 }
225 if (req){
225 if (req){
226 for (n in nodes){
226 for (n in nodes){
227 if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
227 if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) {
228 obsolete.push(nodes[n]);
228 obsolete.push(nodes[n]);
229 }
229 }
230 }
230 }
231 if(obsolete){
231 if(obsolete){
232 for (n in obsolete){
232 for (n in obsolete){
233 D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none');
233 D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none');
234 }
234 }
235 }
235 }
236 }
236 }
237 // set new count into dashboard
237 // set new count into dashboard
238 set_count(nodes.length - obsolete.length)
238 set_count(nodes.length - obsolete.length)
239 }
239 }
240
240
241 E.on(q_filter,'keyup',function(e){
241 E.on(q_filter,'keyup',function(e){
242 clearTimeout(F.filterTimeout);
242 clearTimeout(F.filterTimeout);
243 F.filterTimeout = setTimeout(F.updateFilter,600);
243 F.filterTimeout = setTimeout(F.updateFilter,600);
244 });
244 });
245
245
246 </script>
246 </script>
General Comments 0
You need to be logged in to leave comments. Login now