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

1 line
24 KiB
JavaScript
Raw Normal View History

2017-04-17 13:33:07 -07:00
define(["playbackManager","dom","inputmanager","datetime","itemHelper","mediaInfo","focusManager","imageLoader","scrollHelper","events","connectionManager","browser","globalize","apphost","layoutManager","scrollStyles","emby-slider","paper-icon-button-light","css!css/videoosd"],function(playbackManager,dom,inputManager,datetime,itemHelper,mediaInfo,focusManager,imageLoader,scrollHelper,events,connectionManager,browser,globalize,appHost,layoutManager){"use strict";function seriesImageUrl(item,options){if("Episode"!==item.Type)return null;if(options=options||{},options.type=options.type||"Primary","Primary"===options.type&&item.SeriesPrimaryImageTag)return options.tag=item.SeriesPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if("Thumb"===options.type){if(item.SeriesThumbImageTag)return options.tag=item.SeriesThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId,options);if(item.ParentThumbImageTag)return options.tag=item.ParentThumbImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId,options)}return null}function imageUrl(item,options){return options=options||{},options.type=options.type||"Primary",item.ImageTags&&item.ImageTags[options.type]?(options.tag=item.ImageTags[options.type],connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId||item.Id,options)):"Primary"===options.type&&item.AlbumId&&item.AlbumPrimaryImageTag?(options.tag=item.AlbumPrimaryImageTag,connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId,options)):null}function logoImageUrl(item,apiClient,options){return options=options||{},options.type="Logo",item.ImageTags&&item.ImageTags.Logo?(options.tag=item.ImageTags.Logo,apiClient.getScaledImageUrl(item.Id,options)):item.ParentLogoImageTag?(options.tag=item.ParentLogoImageTag,apiClient.getScaledImageUrl(item.ParentLogoItemId,options)):null}return function(view,params){function onVerticalSwipe(e,elem,data){var player=currentPlayer;if(player){var windowSize=dom.getWindowSize();if(supportsBrightnessChange&&data.clientX<windowSize.innerWidth/2)return void doBrightnessTouch(data.deltaY,player,windowSize.innerHeight);doVolumeTouch(data.deltaY,player,windowSize.innerHeight)}}function doBrightnessTouch(deltaY,player,viewHeight){var delta=-(deltaY/viewHeight*100),newValue=playbackManager.getBrightness(player)+delta;newValue=Math.min(newValue,100),newValue=Math.max(newValue,0),playbackManager.setBrightness(newValue,player)}function doVolumeTouch(deltaY,player,viewHeight){var delta=-(deltaY/viewHeight*100),newValue=playbackManager.getVolume(player)+delta;newValue=Math.min(newValue,100),newValue=Math.max(newValue,0),playbackManager.setVolume(newValue,player)}function initSwipeEvents(){require(["touchHelper"],function(TouchHelper){self.touchHelper=new TouchHelper(view,{swipeYThreshold:30,triggerOnMove:!0,preventDefaultOnMove:!0,ignoreTagNames:["BUTTON","INPUT","TEXTAREA"]}),events.on(self.touchHelper,"swipeup",onVerticalSwipe),events.on(self.touchHelper,"swipedown",onVerticalSwipe)})}function getDisplayItem(item){if("TvChannel"===item.Type){var apiClient=connectionManager.getApiClient(item.ServerId);return apiClient.getItem(apiClient.getCurrentUserId(),item.Id).then(function(refreshedItem){return{originalItem:refreshedItem,displayItem:refreshedItem.CurrentProgram}})}return Promise.resolve({originalItem:item})}function updateRecordingButton(item){return"Program"!==item.Type?(recordingButtonManager&&(recordingButtonManager.destroy(),recordingButtonManager=null),void view.querySelector(".btnRecord").classList.add("hide")):recordingButtonManager?void recordingButtonManager.refreshItem(item):void connectionManager.getApiClient(item.ServerId).getCurrentUser().then(function(user){user.Policy.EnableLiveTvManagement&&require(["recordingButton"],function(RecordingButton){recordingButtonManager=new RecordingButton({item:item,button:view.querySelector(".btnRecord")}),view.querySelector(".btnRecord").classList.remove("hide")})})}function updat