Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit 01b14cd

Browse files
committed
Added prompt upon channel removal and added more locales
1 parent 8952108 commit 01b14cd

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

_locales/en/messages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@
199199
"description": "The label for the empty channels subheader",
200200
"message": "Add channel"
201201
},
202+
"settings_remove": {
203+
"description": "The label for the removalToast button",
204+
"message": "Remove"
205+
},
202206
"settingsJs_updating": {
203207
"description": "",
204208
"message": "Updating..."
@@ -235,6 +239,10 @@
235239
"description": "",
236240
"message": "Upload Complete"
237241
},
242+
"settingsJs_removalPrompt": {
243+
"description": "",
244+
"message": "Are you sure you want to remove "
245+
},
238246
"common_published": {
239247
"description": "First letter is capitalized",
240248
"message": "Published"

css/settings.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,4 +597,8 @@ paper-card .content-header {
597597
cursor: default;
598598
}
599599
#version a {color: #3178B1;}
600-
#version a:hover {color: #16334A;}
600+
#version a:hover {color: #16334A;}
601+
602+
paper-menu-button iron-dropdown ::-webkit-scrollbar {
603+
display: none;
604+
}

js/settings_edit.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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,
3334
wyns.importData;
3435
wyns.databaseRequest;
3536
wyns.database;
37+
wyns.currentRemovalId = -1;
3638

3739
var $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

settings_edit.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,16 @@
125125
}
126126

127127
paper-card .card-content {font-size: 13px;}
128+
129+
#removalToast paper-button {
130+
color: var(--primary-color);
131+
}
128132
</style>
129133
<input id="fileUploader" type="file" accept="audio/*" hidden>
130134
<paper-toast text=""></paper-toast>
135+
<paper-toast id="removalToast">
136+
<paper-button i18n="settings_remove"></paper-button>
137+
</paper-toast>
131138
<paper-header-panel mode="waterfall">
132139
<paper-toolbar id="toolbar" class="medium-tall">
133140
<img id="header_img" src="img/yt_logo.png" />

0 commit comments

Comments
 (0)