Skip to content

Commit 75c10d6

Browse files
committed
added rendom color to title
1 parent 341f517 commit 75c10d6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎index.html‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ <h5>Search over projects from Github, Bitbucket, Google Code, Codeplex, Sourcefo
6969
crossorigin="anonymous"></script>
7070
<script>
7171
$(function () {
72+
function randomColor() {
73+
var letters = '0123456789ABCDEF'.split('');
74+
var color = '#';
75+
for (var i = 0; i < 6; i++ ) {
76+
color += letters[Math.floor(Math.random() * 16)];
77+
}
78+
return color;
79+
}
80+
7281
function randomList(list, len, verify, ratio) {
7382
var rs = [], _list = list.slice(0);
7483
len = len || _list.length;
@@ -135,6 +144,7 @@ <h5>Search over projects from Github, Bitbucket, Google Code, Codeplex, Sourcefo
135144

136145
var els = {
137146
searchForm: $('.search-form'),
147+
searchTitle: $('.search-form .title h1'),
138148
searchInput: $('.search-form input'),
139149
searchBtn: $('.search-form button'),
140150

@@ -170,6 +180,11 @@ <h5>Search over projects from Github, Bitbucket, Google Code, Codeplex, Sourcefo
170180
renderSearchBtn();
171181
els.searchResultBd.html('Codelf is searching...');
172182
}
183+
renderTitle();
184+
}
185+
186+
function renderTitle(){
187+
els.searchTitle.css({color: randomColor()})
173188
}
174189

175190
function renderSearchResult(data){
@@ -191,6 +206,7 @@ <h5>Search over projects from Github, Bitbucket, Google Code, Codeplex, Sourcefo
191206
}else{
192207
els.searchResultBd.html('Codelf found nothing :(');
193208
}
209+
renderTitle();
194210
}
195211

196212
function renderSearchBtn(){

0 commit comments

Comments
 (0)