@@ -10,6 +10,7 @@ wyns.apiKey = chrome.extension.getBackgroundPage().wyn.apiKey,
1010 "add_channels_failed" : getString ( "addChannelsFailed" ) ,
1111 "please_wait" : getString ( "pleaseWait" ) ,
1212 "please_wait_while" : getString ( "pleaseWaitWhile" ) ,
13+ "removalPrompt" : getString ( "removalPrompt" ) ,
1314 "info_published" : getCommonString ( "published" ) ,
1415 "info_subscribers" : getCommonString ( "subscribers" ) ,
1516 "info_views" : getCommonString ( "views" ) ,
@@ -33,6 +34,7 @@ wyns.apiKey = chrome.extension.getBackgroundPage().wyn.apiKey,
3334wyns . importData ;
3435wyns . databaseRequest ;
3536wyns . database ;
37+ wyns . currentRemovalId = - 1 ;
3638
3739var $Poly ;
3840
@@ -378,18 +380,30 @@ function registerListeners(){
378380
379381 $ ( "body" ) . on ( "click" , ".channel_remove_btn" , function ( ) {
380382 if ( sortable . option ( "disabled" ) ) {
381- var id = parseInt ( $ ( this ) . parent ( ) . parent ( ) . attr ( "data-id" ) ) ;
382- var channels = JSON . parse ( localStorage . getItem ( "channels" ) ) ,
383- name = channels [ id ] . name ;
384- channels . splice ( id , 1 ) ;
385- localStorage . setItem ( "channels" , JSON . stringify ( channels ) ) ;
383+ wyns . currentRemovalId = parseInt ( $ ( this ) . parent ( ) . parent ( ) . attr ( "data-id" ) ) ;
386384
387- getVideoList ( ) ;
385+ var channels = JSON . parse ( localStorage . getItem ( "channels" ) ) ,
386+ name = channels [ wyns . currentRemovalId ] . name ;
388387
389- createSnackbar ( wyns . strings . user_remove_channel + "\"" + name + "\"" ) ;
390- console . log ( wyns . strings . user_remove_channel + name ) ;
388+ $ ( "paper-toast" ) [ 0 ] . opened = false ;
389+ $ ( "#removalToast" ) [ 0 ] . show ( { text : wyns . strings . removalPrompt + "\"" + name + "\"?" , duration : 7000 } ) ;
390+ $ ( "#removalToast" ) [ 0 ] . refit ( ) ;
391391 }
392392 } ) ;
393+ $ ( "#removalToast paper-button" ) . on ( "click" , function ( ) {
394+ if ( wyns . currentRemovalId == - 1 )
395+ return ;
396+
397+ var channels = JSON . parse ( localStorage . getItem ( "channels" ) ) ,
398+ name = channels [ wyns . currentRemovalId ] . name ;
399+ channels . splice ( wyns . currentRemovalId , 1 ) ;
400+ localStorage . setItem ( "channels" , JSON . stringify ( channels ) ) ;
401+
402+ getVideoList ( ) ;
403+
404+ createSnackbar ( wyns . strings . user_remove_channel + "\"" + name + "\"" ) ;
405+ console . log ( wyns . strings . user_remove_channel + name ) ;
406+ } ) ;
393407 $ ( "body" ) . on ( "click" , ".channel_info_btn" , function ( ) {
394408 var id = parseInt ( $ ( this ) . parent ( ) . parent ( ) . attr ( "data-index" ) ) ;
395409 displayPopupCard ( id ) ;
@@ -1289,6 +1303,7 @@ function createSnackbar(text){
12891303 $ ( "paper-toast" ) [ 0 ] . show ( {
12901304 text : text
12911305 } ) ;
1306+ $ ( "paper-toast" ) [ 0 ] . refit ( ) ;
12921307}
12931308
12941309// SHADOW TRANSITION
0 commit comments