mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-19 03:48:18 -07:00
1 line
1.1 KiB
JavaScript
1 line
1.1 KiB
JavaScript
define(["apphost","globalize","syncJobList","events","localsync","emby-button","paper-icon-button-light"],function(appHost,globalize,syncJobList,events,localSync){"use strict";return function(view,params,tabContent){function isLocalSyncManagement(){return appHost.supports("sync")&&"offline"==mode}function refreshSyncStatus(page){if(isLocalSyncManagement()){var status=localSync.getSyncStatus();"Active"==status?page.querySelector(".btnSyncNow").classList.add("hide"):page.querySelector(".btnSyncNow").classList.remove("hide")}}function syncNow(page){localSync.sync(),require(["toast"],function(toast){toast(Globalize.translate("MessageSyncStarted"))}),refreshSyncStatus(page)}var self=this,mode="offline";tabContent.querySelector(".btnSyncNow").addEventListener("click",function(){syncNow(tabContent)});var mySyncJobList=new syncJobList({isLocalSync:"offline"===mode,serverId:ApiClient.serverId(),userId:"offline"===mode?null:ApiClient.getCurrentUserId(),element:tabContent.querySelector(".syncActivity"),mode:mode});self.renderTab=function(){refreshSyncStatus(tabContent)},self.destroy=function(){mySyncJobList&&(mySyncJobList.destroy(),mySyncJobList=null)}}}); |