blob: f11aa1e863c0c704f2c546c75177b119e9194f21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
var ARTIST_AUTOCOMPLETE_URL = 'artist.php?action=autocomplete';
var TAGS_AUTOCOMPLETE_URL = 'torrents.php?action=autocomplete_tags';
var SELECTOR = '[data-gazelle-autocomplete="true"]';
$(document).ready(function() {
var url = new gazURL();
$('#artistsearch' + SELECTOR).autocomplete({
deferRequestBy: 300,
onSelect : function(suggestion) {
window.location = 'artist.php?id=' + suggestion['data'];
},
serviceUrl : ARTIST_AUTOCOMPLETE_URL,
});
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new') || url.path == 'collages') {
$("#artist" + SELECTOR).autocomplete({
deferRequestBy: 300,
serviceUrl : ARTIST_AUTOCOMPLETE_URL
});
$("#artistsimilar" + SELECTOR).autocomplete({
deferRequestBy: 300,
serviceUrl : ARTIST_AUTOCOMPLETE_URL
});
}
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'collages' || url.path == 'requests' || url.path == 'top10' || (url.path == 'requests' && url.query['action'] == 'new')) {
$("#tags" + SELECTOR).autocomplete({
deferRequestBy: 300,
delimiter: ',',
serviceUrl : TAGS_AUTOCOMPLETE_URL
});
$("#tagname" + SELECTOR).autocomplete({
deferRequestBy: 300,
serviceUrl : TAGS_AUTOCOMPLETE_URL,
});
}
});
|