jellyfin-web/dashboard-ui/scripts/searchpage.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

define([], function () {
2015-09-23 19:31:40 -07:00
function loadSuggestions(page) {
var options = {
2015-09-24 10:08:10 -07:00
SortBy: "IsFavoriteOrLiked,Random",
2015-09-23 19:31:40 -07:00
IncludeItemTypes: "Movie,Series,MusicArtist",
Limit: 20,
Recursive: true,
ImageTypeLimit: 0,
EnableImages: false
};
2015-12-14 08:43:03 -07:00
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
2015-09-23 19:31:40 -07:00
var html = result.Items.map(function (i) {
var href = LibraryBrowser.getHref(i);
2015-09-24 10:08:10 -07:00
var itemHtml = '<div><a style="display:inline-block;padding:.55em 1em;" href="' + href + '">';
2015-09-23 19:31:40 -07:00
itemHtml += i.Name;
2015-09-24 10:08:10 -07:00
itemHtml += '</a></div>';
2015-09-23 19:31:40 -07:00
return itemHtml;
}).join('');
page.querySelector('.searchSuggestions').innerHTML = html;
});
}
2015-09-24 10:08:10 -07:00
pageIdOn('pageshow', "searchPage", function () {
2015-09-23 19:31:40 -07:00
var page = this;
loadSuggestions(page);
Search.showSearchPanel();
});
});