Replace nested if with early return.
This commit is contained in:
		
							parent
							
								
									5c4c0a3034
								
							
						
					
					
						commit
						00bc7e6eac
					
				
					 1 changed files with 12 additions and 10 deletions
				
			
		|  | @ -426,8 +426,11 @@ function on_album_drag_drop(event) | ||||||
| 
 | 
 | ||||||
|     const child_title = child.querySelector('.album_card_title').textContent.trim(); |     const child_title = child.querySelector('.album_card_title').textContent.trim(); | ||||||
|     const parent_title = parent.querySelector('.album_card_title').textContent.trim(); |     const parent_title = parent.querySelector('.album_card_title').textContent.trim(); | ||||||
|     if (confirm(`Move\n${child_title}\ninto\n${parent_title}?`)) |     const prompt = `Move\n${child_title}\ninto\n${parent_title}?`; | ||||||
|  |     if (! confirm(prompt)) | ||||||
|     { |     { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|     if (ALBUM_ID) |     if (ALBUM_ID) | ||||||
|     { |     { | ||||||
|         api.albums.add_child(parent_id, child_id, null); |         api.albums.add_child(parent_id, child_id, null); | ||||||
|  | @ -438,6 +441,5 @@ function on_album_drag_drop(event) | ||||||
|         api.albums.add_child(parent_id, child_id, common.refresh); |         api.albums.add_child(parent_id, child_id, common.refresh); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
| </script> | </script> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue