Skip to content

Commit 4b551bc

Browse files
committed
Improved scoring in github example + added icons.
1 parent e95bf64 commit 4b551bc

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

examples/github.html

+18-4
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,27 @@
6969
right: 34px;
7070
width: 16px;
7171
height: 16px;
72-
background: url(spinner.gif);
72+
background: url(images/spinner.gif);
7373
background-size: 16px 16px;
7474
opacity: 0;
7575
}
7676
.selectize-control.repositories.loading::before {
7777
opacity: 0.4;
7878
}
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+
}
7993
</style>
8094
</head>
8195
<body>
@@ -101,12 +115,12 @@ <h2>&lt;select&gt; (async)</h2>
101115
option: function(item) {
102116
return '<div>' +
103117
'<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>' +
105119
'<span class="by">' + item.username + '</span>' +
106120
'</span>' +
107121
'<span class="description">' + item.description + '</span>' +
108122
'<ul class="meta">' +
109-
'<li class="language">' + item.language + '</li>' +
123+
(item.language ? '<li class="language">' + item.language + '</li>' : '') +
110124
'<li class="watchers"><span>' + item.watchers + '</span> watchers</li>' +
111125
'<li class="forks"><span>' + item.forks + '</span> forks</li>' +
112126
'</ul>' +
@@ -116,7 +130,7 @@ <h2>&lt;select&gt; (async)</h2>
116130
score: function(search) {
117131
var score = this.getScoreFunction(search);
118132
return function(item) {
119-
return score(item) * (item.watchers + 1);
133+
return score(item) * (1 + Math.min(item.watchers / 100, 1));
120134
};
121135
},
122136
load: function(query, callback) {

examples/images/repo-forked.png

3.35 KB
Loading

examples/images/repo-source.png

3.33 KB
Loading
File renamed without changes.

examples/movies.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
right: 34px;
9393
width: 16px;
9494
height: 16px;
95-
background: url(spinner.gif);
95+
background: url(images/spinner.gif);
9696
background-size: 16px 16px;
9797
opacity: 0;
9898
}

src/selectize.jquery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var defaults = {
2626
hideSelected: null,
2727

2828
scrollDuration: 60,
29-
loadThrottle: 250,
29+
loadThrottle: 300,
3030

3131
dataAttr: 'data-data',
3232
sortField: null,

0 commit comments

Comments
 (0)