mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
searchtab.js
This commit is contained in:
parent
850c2c4baf
commit
5bed7bbf35
1 changed files with 38 additions and 14 deletions
|
@ -1,30 +1,54 @@
|
||||||
define(["searchFields", "searchResults", "events"], function(SearchFields, SearchResults, events) {
|
define(["searchFields", "searchResults", "events"], function (SearchFields, SearchResults, events) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function init(instance, tabContent, options) {
|
function init(instance, tabContent, options) {
|
||||||
tabContent.innerHTML = '<div class="padded-left padded-right searchFields"></div><div class="searchResults padded-top" style="padding-top:1.5em;"></div>', instance.searchFields = new SearchFields({
|
tabContent.innerHTML = '<div class="padded-left padded-right searchFields"></div><div class="searchResults padded-top" style="padding-top:1.5em;"></div>';
|
||||||
|
instance.searchFields = new SearchFields({
|
||||||
element: tabContent.querySelector(".searchFields")
|
element: tabContent.querySelector(".searchFields")
|
||||||
}), instance.searchResults = new SearchResults({
|
});
|
||||||
|
instance.searchResults = new SearchResults({
|
||||||
element: tabContent.querySelector(".searchResults"),
|
element: tabContent.querySelector(".searchResults"),
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
parentId: options.parentId,
|
parentId: options.parentId,
|
||||||
collectionType: options.collectionType
|
collectionType: options.collectionType
|
||||||
}), events.on(instance.searchFields, "search", function(e, value) {
|
});
|
||||||
instance.searchResults.search(value)
|
events.on(instance.searchFields, "search", function (e, value) {
|
||||||
})
|
instance.searchResults.search(value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function SearchTab(view, tabContent, options) {
|
function SearchTab(view, tabContent, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
options = options || {}, init(this, tabContent, options), self.preRender = function() {}, self.renderTab = function() {
|
options = options || {};
|
||||||
|
init(this, tabContent, options);
|
||||||
|
|
||||||
|
self.preRender = function () {};
|
||||||
|
|
||||||
|
self.renderTab = function () {
|
||||||
var searchFields = this.searchFields;
|
var searchFields = this.searchFields;
|
||||||
searchFields && searchFields.focus()
|
|
||||||
}
|
if (searchFields) {
|
||||||
|
searchFields.focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return SearchTab.prototype.destroy = function() {
|
|
||||||
|
SearchTab.prototype.destroy = function () {
|
||||||
var searchFields = this.searchFields;
|
var searchFields = this.searchFields;
|
||||||
searchFields && searchFields.destroy(), this.searchFields = null;
|
|
||||||
|
if (searchFields) {
|
||||||
|
searchFields.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.searchFields = null;
|
||||||
var searchResults = this.searchResults;
|
var searchResults = this.searchResults;
|
||||||
searchResults && searchResults.destroy(), this.searchResults = null
|
|
||||||
}, SearchTab
|
if (searchResults) {
|
||||||
});
|
searchResults.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.searchResults = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
return SearchTab;
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue