EmbyCrackedClient/web/search/search.js

1 line
1.8 KiB
JavaScript
Raw Permalink Normal View History

2025-06-25 11:46:04 +08:00
import"./../modules/emby-elements/emby-scroller/emby-scroller.js";import BaseView from"./../modules/viewmanager/baseview.js";import focusManager from"./../modules/focusmanager.js";import connectionManager from"./../modules/emby-apiclient/connectionmanager.js";import SearchFields from"./searchfields.js";import SearchResults from"./searchresults.js";import events from"./../modules/emby-apiclient/events.js";function SearchView(view,params){BaseView.apply(this,arguments);let self=this;self.searchFields=new SearchFields({serverId:params.serverId||connectionManager.currentApiClient().serverId(),element:view.querySelector(".searchFields")}),self.searchResults=new SearchResults({element:view.querySelector(".searchResults"),serverId:params.serverId||connectionManager.currentApiClient().serverId(),parentId:params.parentId,collectionType:params.collectionType,requestedItemFields:this.getRequestedItemFields()}),events.on(self.searchFields,"search",function(e,value){self.searchResults.search(value)})}Object.assign(SearchView.prototype,BaseView.prototype),SearchView.prototype.onPause=function(){BaseView.prototype.onPause.apply(this,arguments),this.searchFields&&this.searchFields.pause()},SearchView.prototype.onInputCommand=function(e){"search"===e.detail.command?(focusManager.focus(this.view.querySelector(".searchfields-txtSearch")),e.preventDefault()):BaseView.prototype.onInputCommand.apply(this,arguments)},SearchView.prototype.onResume=function(options){BaseView.prototype.onResume.apply(this,arguments),this.searchFields&&this.searchFields.resume(options)},SearchView.prototype.destroy=function(){BaseView.prototype.destroy.apply(this,arguments),this.searchFields&&(this.searchFields.destroy(),this.searchFields=null),this.searchResults&&(this.searchResults.destroy(),this.searchResults=null)};export default SearchView;