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

Commit

Permalink
Added prompt upon channel removal and added more locales
Browse files Browse the repository at this point in the history
  • Loading branch information
Wassup789 committed Sep 17, 2016
1 parent 8952108 commit 01b14cd
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -597,4 +597,8 @@ paper-card .content-header {
cursor: default;
}
#version a {color: #3178B1;}
#version a:hover {color: #16334A;}
#version a:hover {color: #16334A;}

paper-menu-button iron-dropdown ::-webkit-scrollbar {
display: none;
}
31 changes: 23 additions & 8 deletions js/settings_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -33,6 +34,7 @@ wyns.apiKey = chrome.extension.getBackgroundPage().wyn.apiKey,
wyns.importData;
wyns.databaseRequest;
wyns.database;
wyns.currentRemovalId = -1;

var $Poly;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1289,6 +1303,7 @@ function createSnackbar(text){
$("paper-toast")[0].show({
text: text
});
$("paper-toast")[0].refit();
}

// SHADOW TRANSITION
Expand Down
7 changes: 7 additions & 0 deletions settings_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,16 @@
}

paper-card .card-content {font-size: 13px;}

#removalToast paper-button {
color: var(--primary-color);
}
</style>
<input id="fileUploader" type="file" accept="audio/*" hidden>
<paper-toast text=""></paper-toast>
<paper-toast id="removalToast">
<paper-button i18n="settings_remove"></paper-button>
</paper-toast>
<paper-header-panel mode="waterfall">
<paper-toolbar id="toolbar" class="medium-tall">
<img id="header_img" src="img/yt_logo.png" />
Expand Down

0 comments on commit 01b14cd

Please sign in to comment.