Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
8 lines
No EOL
2.3 KiB
JavaScript
8 lines
No EOL
2.3 KiB
JavaScript
;'use strict';var TitleBar={get view(){return document.getElementById('title');},get titleText(){return document.querySelector('#title-text bdi');},get playerIcon(){return document.getElementById('title-player');},get doneButton(){return document.getElementById('title-done');},get scanProgress(){return document.getElementById('scan-progress');},get scanSpinner(){return document.getElementById('scan-spinner');},get scanCount(){return document.getElementById('scan-count');},get scanArtist(){return document.getElementById('scan-artist');},get scanTitle(){return document.getElementById('scan-title');},init:function tb_init(){this.view.addEventListener('click',this);this.view.addEventListener('action',this.onActionBack);},changeTitleText:function tb_changeTitleText(content){this.titleText.textContent=content;},showBackArrow:function(show){if(show){this.view.setAttribute('action','back');}
|
|
else{this.view.removeAttribute('action');}},onActionBack:function(){if(App.pendingPick){if(ModeManager.currentMode===MODE_PICKER){App.pendingPick.postError('pick cancelled');return;}
|
|
PlayerView.stop();}
|
|
ModeManager.pop();},showScanProgress:function(info){this.scanProgress.classList.remove('hidden');this.scanSpinner.classList.remove('hidden');this.scanCount.textContent=info.count;this.scanArtist.textContent=info.artist||'';this.scanTitle.textContent=info.title||'';},hideScanProgress:function(){this.scanSpinner.classList.add('hidden');setTimeout(function(){this.scanProgress.classList.add('hidden');}.bind(this),100);},handleEvent:function tb_handleEvent(evt){var target=evt.target;function cleanupPick(){PlayerView.stop();}
|
|
switch(evt.type){case'click':if(!target){return;}
|
|
switch(target.id){case'title-player':if(PlayerView.isQueued){ModeManager.push(MODE_PLAYER);}
|
|
break;case'title-done':var currentFileInfo=PlayerView.currentFileInfo;LazyLoader.load('js/metadata/album_art_cache.js').then(()=>{return AlbumArtCache.getThumbnailBlob(currentFileInfo);}).then((picture)=>{var currentMetadata=currentFileInfo.metadata;var playingBlob=PlayerView.playingBlob;App.pendingPick.postResult({type:playingBlob.type,blob:playingBlob,name:currentMetadata.title||'',metadata:{title:currentMetadata.title,artist:currentMetadata.artist,album:currentMetadata.album,picture:picture}});cleanupPick();});break;}
|
|
break;default:return;}}}; |