EmbyCrackedClient/web/modules/tabbedview/itemstab.js
2025-06-25 11:46:04 +08:00

1 line
No EOL
2.7 KiB
JavaScript

import BaseTab from"./basetab.js";import connectionManager from"./../emby-apiclient/connectionmanager.js";import ListController from"./listcontroller.js";function ItemsTab(view,params,options){BaseTab.apply(this,arguments),ListController.apply(this,arguments),this.view=view,(this.params=params).serverId&&(this.apiClient=connectionManager.getApiClient(params.serverId))}function convertTemplateToHorizontal(html){return Emby.importModule("./modules/tabbedview/viewhelper.js").then(function(viewHelper){return viewHelper.convertTemplateToHorizontal(html)})}Object.assign(ItemsTab.prototype,BaseTab.prototype),Object.assign(ItemsTab.prototype,ListController.prototype),ItemsTab.prototype.onTemplateLoaded=function(){BaseTab.prototype.onTemplateLoaded.apply(this,arguments);var params=this.params;this.initItemsContainer(),this.addFocusBehavior(this.itemsContainer),params.parentId&&!this.isGlobalQuery()&&this.itemsContainer.setAttribute("data-parentid",params.parentId),this.initButtons()},ItemsTab.prototype.getSettingsKey=function(){return this.params.parentId+"-1"},ItemsTab.prototype.isRecursiveQuery=function(){return!0},ItemsTab.prototype.onResume=function(options){BaseTab.prototype.onResume.apply(this,arguments),ListController.prototype.resume.apply(this,arguments),options&&options.refresh&&this.updateSortText(),this.supportsAlphaPicker()&&this.initAlphaPicker();var alphaNumericShortcuts=this.alphaNumericShortcuts;alphaNumericShortcuts&&alphaNumericShortcuts.resume();let instance=this,autoFocus=options.autoFocus;return this.itemsContainer.resume(options).then(function(result){autoFocus&&instance.autoFocus()})},ItemsTab.prototype.loadItemsTemplate=function(){var promise=require(["text!modules/tabbedview/itemstab.template.html"]);return"y"===this.scrollDirection()?promise:promise.then(function(responses){return convertTemplateToHorizontal(responses[0]).then(function(html){return responses[0]=html,responses})})},ItemsTab.prototype.getFocusContainerElement=function(){var scroller=this.scroller;if(scroller===this.view){scroller=scroller?.querySelector(".scrollSlider");if(scroller)return scroller}return BaseTab.prototype.getFocusContainerElement.apply(this,arguments)},ItemsTab.prototype.supportsAlphaPicker=function(){return!1},ItemsTab.prototype.refresh=function(options){let instance=this,autoFocus=options.autoFocus;this.itemsContainer.refreshItems(options).then(function(result){autoFocus&&instance.autoFocus()})},ItemsTab.prototype.onPause=function(){BaseTab.prototype.onPause.apply(this,arguments),ListController.prototype.pause.apply(this,arguments)},ItemsTab.prototype.destroy=function(){BaseTab.prototype.destroy.apply(this,arguments),ListController.prototype.destroy.apply(this,arguments),this.options=null};export default ItemsTab;