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,17 +426,19 @@ 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)) | ||||||
|     { |     { | ||||||
|         if (ALBUM_ID) |         return; | ||||||
|         { |     } | ||||||
|             api.albums.add_child(parent_id, child_id, null); |     if (ALBUM_ID) | ||||||
|             api.albums.remove_child(ALBUM_ID, child_id, common.refresh); |     { | ||||||
|         } |         api.albums.add_child(parent_id, child_id, null); | ||||||
|         else |         api.albums.remove_child(ALBUM_ID, child_id, common.refresh); | ||||||
|         { |     } | ||||||
|             api.albums.add_child(parent_id, child_id, common.refresh); |     else | ||||||
|         } |     { | ||||||
|  |         api.albums.add_child(parent_id, child_id, common.refresh); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue