2015-09-23 19:31:40 -07:00
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})();
|