diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d1a09cf..b316cfd 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -199,6 +199,10 @@ "description": "The label for the empty channels subheader", "message": "Add channel" }, + "settings_remove": { + "description": "The label for the removalToast button", + "message": "Remove" + }, "settingsJs_updating": { "description": "", "message": "Updating..." @@ -235,6 +239,10 @@ "description": "", "message": "Upload Complete" }, + "settingsJs_removalPrompt": { + "description": "", + "message": "Are you sure you want to remove " + }, "common_published": { "description": "First letter is capitalized", "message": "Published" diff --git a/css/settings.css b/css/settings.css index 96ba211..ab018a5 100644 --- a/css/settings.css +++ b/css/settings.css @@ -597,4 +597,8 @@ paper-card .content-header { cursor: default; } #version a {color: #3178B1;} -#version a:hover {color: #16334A;} \ No newline at end of file +#version a:hover {color: #16334A;} + +paper-menu-button iron-dropdown ::-webkit-scrollbar { + display: none; +} \ No newline at end of file diff --git a/js/settings_edit.js b/js/settings_edit.js index f6496a0..e4f8f21 100644 --- a/js/settings_edit.js +++ b/js/settings_edit.js @@ -10,6 +10,7 @@ wyns.apiKey = chrome.extension.getBackgroundPage().wyn.apiKey, "add_channels_failed": getString("addChannelsFailed"), "please_wait": getString("pleaseWait"), "please_wait_while": getString("pleaseWaitWhile"), + "removalPrompt": getString("removalPrompt"), "info_published": getCommonString("published"), "info_subscribers": getCommonString("subscribers"), "info_views": getCommonString("views"), @@ -33,6 +34,7 @@ wyns.apiKey = chrome.extension.getBackgroundPage().wyn.apiKey, wyns.importData; wyns.databaseRequest; wyns.database; +wyns.currentRemovalId = -1; var $Poly; @@ -378,18 +380,30 @@ function registerListeners(){ $("body").on("click", ".channel_remove_btn", function(){ if(sortable.option("disabled")){ - var id = parseInt($(this).parent().parent().attr("data-id")); - var channels = JSON.parse(localStorage.getItem("channels")), - name = channels[id].name; - channels.splice(id, 1); - localStorage.setItem("channels", JSON.stringify(channels)); + wyns.currentRemovalId = parseInt($(this).parent().parent().attr("data-id")); - getVideoList(); + var channels = JSON.parse(localStorage.getItem("channels")), + name = channels[wyns.currentRemovalId].name; - createSnackbar(wyns.strings.user_remove_channel + "\"" + name + "\""); - console.log(wyns.strings.user_remove_channel + name); + $("paper-toast")[0].opened = false; + $("#removalToast")[0].show({text: wyns.strings.removalPrompt + "\"" + name + "\"?", duration: 7000}); + $("#removalToast")[0].refit(); } }); + $("#removalToast paper-button").on("click", function(){ + if(wyns.currentRemovalId == -1) + return; + + var channels = JSON.parse(localStorage.getItem("channels")), + name = channels[wyns.currentRemovalId].name; + channels.splice(wyns.currentRemovalId, 1); + localStorage.setItem("channels", JSON.stringify(channels)); + + getVideoList(); + + createSnackbar(wyns.strings.user_remove_channel + "\"" + name + "\""); + console.log(wyns.strings.user_remove_channel + name); + }); $("body").on("click", ".channel_info_btn", function(){ var id = parseInt($(this).parent().parent().attr("data-index")); displayPopupCard(id); @@ -1289,6 +1303,7 @@ function createSnackbar(text){ $("paper-toast")[0].show({ text: text }); + $("paper-toast")[0].refit(); } // SHADOW TRANSITION diff --git a/settings_edit.html b/settings_edit.html index 56f37a4..e1436f8 100644 --- a/settings_edit.html +++ b/settings_edit.html @@ -125,9 +125,16 @@ } paper-card .card-content {font-size: 13px;} + + #removalToast paper-button { + color: var(--primary-color); + } + + +