Gazelle/static/functions/autocomplete.js

33 lines
976 B
JavaScript
Raw Normal View History

2013-07-01 08:01:00 +00:00
var ARTIST_AUTOCOMPLETE_URL = 'artist.php?action=autocomplete';
var TAGS_AUTOCOMPLETE_URL = 'torrents.php?action=autocomplete_tags';
2011-09-30 08:00:12 +00:00
2013-07-01 08:01:00 +00:00
$(document).ready(function() {
var url = new URL();
2011-09-30 08:00:12 +00:00
2013-07-01 08:01:00 +00:00
$('#artistsearch').autocomplete({
serviceUrl : ARTIST_AUTOCOMPLETE_URL,
onSelect : function(suggestion) {
window.location = 'artist.php?id=' + suggestion['data'];
},
});
2011-09-30 08:00:12 +00:00
2013-07-01 08:01:00 +00:00
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist') {
$("#artist").autocomplete({
serviceUrl : ARTIST_AUTOCOMPLETE_URL
});
$("#artistsimilar").autocomplete({
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").autocomplete({
serviceUrl : TAGS_AUTOCOMPLETE_URL,
delimiter: ','
});
$("#tagname").autocomplete({
serviceUrl : TAGS_AUTOCOMPLETE_URL,
2011-09-30 08:00:12 +00:00
});
}
2013-07-02 08:01:37 +00:00
2013-07-01 08:01:00 +00:00
});