69
69
right : 34px ;
70
70
width : 16px ;
71
71
height : 16px ;
72
- background : url (spinner.gif);
72
+ background : url (images/ spinner.gif);
73
73
background-size : 16px 16px ;
74
74
opacity : 0 ;
75
75
}
76
76
.selectize-control .repositories .loading ::before {
77
77
opacity : 0.4 ;
78
78
}
79
+ .icon {
80
+ width : 16px ;
81
+ height : 16px ;
82
+ display : inline-block;
83
+ vertical-align : middle;
84
+ background-size : 16px 16px ;
85
+ margin : 0 3px 0 0 ;
86
+ }
87
+ .icon .fork {
88
+ background-image : url (images/repo-fork.png);
89
+ }
90
+ .icon .source {
91
+ background-image : url (images/repo-source.png);
92
+ }
79
93
</ style >
80
94
</ head >
81
95
< body >
@@ -101,12 +115,12 @@ <h2><select> (async)</h2>
101
115
option : function ( item ) {
102
116
return '<div>' +
103
117
'<span class="title">' +
104
- '<span class="name">' + item . name + '</span>' +
118
+ '<span class="name"><i class="icon ' + ( item . fork ? 'fork' : 'source' ) + '"></i> ' + item . name + '</span>' +
105
119
'<span class="by">' + item . username + '</span>' +
106
120
'</span>' +
107
121
'<span class="description">' + item . description + '</span>' +
108
122
'<ul class="meta">' +
109
- '<li class="language">' + item . language + '</li>' +
123
+ ( item . language ? '<li class="language">' + item . language + '</li>' : '' ) +
110
124
'<li class="watchers"><span>' + item . watchers + '</span> watchers</li>' +
111
125
'<li class="forks"><span>' + item . forks + '</span> forks</li>' +
112
126
'</ul>' +
@@ -116,7 +130,7 @@ <h2><select> (async)</h2>
116
130
score : function ( search ) {
117
131
var score = this . getScoreFunction ( search ) ;
118
132
return function ( item ) {
119
- return score ( item ) * ( item . watchers + 1 ) ;
133
+ return score ( item ) * ( 1 + Math . min ( item . watchers / 100 , 1 ) ) ;
120
134
} ;
121
135
} ,
122
136
load : function ( query , callback ) {
0 commit comments