mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-30 05:13:00 +00:00 
			
		
		
		
	[Issue 128] Current track in page title
This commit is contained in:
		| @@ -528,7 +528,7 @@ function webSocketConnect() { | ||||
|                         socket.send('MPD_API_GET_QUEUE,'+pagination); | ||||
|                     break; | ||||
|                 case 'song_change': | ||||
|  | ||||
|                     updatePageTitle(obj.data); | ||||
|                     $('#album').text(""); | ||||
|                     $('#artist').text(""); | ||||
|  | ||||
| @@ -553,7 +553,6 @@ function webSocketConnect() { | ||||
|                             message:{html: notification}, | ||||
|                             type: "info", | ||||
|                         }).show();         | ||||
|                          | ||||
|                     break; | ||||
|                 case 'mpdhost': | ||||
|                     $('#mpdhost').val(obj.data.host); | ||||
| @@ -667,6 +666,20 @@ var updatePlayIcon = function(state) | ||||
|     } | ||||
| } | ||||
|  | ||||
| var updatePageTitle = function(songInfo) { | ||||
|     if(!songInfo || (!songInfo.artist && !songInfo.title)) { | ||||
|         document.title = 'ympd'; | ||||
|         return; | ||||
|     } | ||||
|     if(songInfo.artist) { | ||||
|         if(songInfo.title) { | ||||
|             document.title = songInfo.artist + ' - ' + songInfo.title; | ||||
|         } | ||||
|     } else { | ||||
|         document.title = songInfo.title; | ||||
|     } | ||||
| } | ||||
|  | ||||
| function updateDB() { | ||||
|     socket.send('MPD_API_UPDATE_DB'); | ||||
|     $('.top-right').notify({ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 andreevksya
					andreevksya