@@ -222,28 +222,44 @@ OB.Playlist.addedit_type = false;
222222
223223OB . Playlist . addeditTypeChange = function ( ) {
224224 var change_to = $ ( "#playlist_type_input" ) . val ( ) ;
225- if ( change_to == "live_assist" ) change_to = "standard" ;
226225
227226 if ( OB . Playlist . addedit_type == "advanced" ) var has_items = OB . Playlist . advanced_items . length > 0 ;
228227 else var has_items = $ ( ".playlist_addedit_item" ) . length > 0 ;
229228
230- if ( ! has_items || OB . Playlist . addeditTypeChangeConfirm ( ) ) {
231- OB . Playlist . addedit_type = $ ( "#playlist_type_input" ) . val ( ) ;
229+ // early return if we have items and the user doesn't want those to be cleared
230+ if ( has_items && ! OB . Playlist . addeditTypeChangeConfirm ( ) ) {
231+ $ ( "#playlist_type_input" ) . val ( OB . Playlist . addedit_type ) ;
232+ return false ;
233+ }
232234
235+ if ( has_items ) {
233236 OB . Playlist . addeditRemoveAllFromAll ( ) ;
234- $ ( ".playlist_edit_container" ) . hide ( ) ;
235- $ ( "#playlist_edit_" + change_to + "_container" ) . show ( ) ;
236-
237- if ( change_to == "standard" && $ ( "#playlist_type_input" ) . val ( ) == "live_assist" ) {
238- $ ( "#playlist_insert_breakpoint_button" ) . attr ( "hidden" , false ) ;
239- $ ( "#playlist_liveassist_buttons" ) . show ( ) ;
240- $ ( "#playlist_insert_voicetrack_button" ) . hide ( ) ; // no voicetrack for liveassist
241- } else if ( change_to == "standard" ) {
242- $ ( "#playlist_insert_breakpoint_button" ) . attr ( "hidden" , true ) ;
243- $ ( "#playlist_liveassist_buttons" ) . hide ( ) ;
244- $ ( "#playlist_insert_voicetrack_button" ) . show ( ) ; // voicetrack for standard
245- }
246- } else $ ( "#playlist_type_input" ) . val ( OB . Playlist . addedit_type ) ;
237+ }
238+
239+ // set our current type
240+ OB . Playlist . addedit_type = $ ( "#playlist_type_input" ) . val ( ) ;
241+
242+ // update UI
243+ $ ( ".playlist_edit_container" ) . hide ( ) ;
244+ $ ( "#playlist_edit_" + ( change_to == 'live_assist' ? 'standard' : change_to ) + "_container" ) . show ( ) ;
245+
246+ // live assist features
247+ if ( change_to == 'live_assist' ) {
248+ $ ( "#playlist_insert_breakpoint_button" ) . attr ( "hidden" , false ) ;
249+ $ ( "#playlist_liveassist_buttons" ) . show ( ) ;
250+ $ ( "#playlist_last_fadeout_container" ) . hide ( ) ; // no last track fadeout for live assist
251+ } else {
252+ $ ( "#playlist_insert_breakpoint_button" ) . attr ( "hidden" , true ) ;
253+ $ ( "#playlist_liveassist_buttons" ) . hide ( ) ;
254+ $ ( "#playlist_last_fadeout_container" ) . show ( ) ; // last track fadeout for standard/advanced
255+ }
256+
257+ // standard playlist features
258+ if ( change_to == "standard" ) {
259+ $ ( "#playlist_insert_voicetrack_button" ) . show ( ) ;
260+ } else {
261+ $ ( "#playlist_insert_voicetrack_button" ) . hide ( ) ;
262+ }
247263} ;
248264
249265OB . Playlist . addeditTypeChangeConfirm = function ( ) {
0 commit comments