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

Commit

Permalink
v1.2.4.1 Release
Browse files Browse the repository at this point in the history
Fixed bug where the bell click event would remove the notification.
Added syncWithYoutube background method call to manual refresh and upon enabling the bell
  • Loading branch information
Wassup789 committed Nov 18, 2017
1 parent 502b4c9 commit 587ac6e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Changelog
=====
## v1.2.4.0 (2017-11-17)
## v1.2.4.1 (2017-11-17)
* Added synchronization with YouTube's notification bell
* New installs will have this feature automatically enabled
* Current users must enable it from the settings
Expand Down
2 changes: 1 addition & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
"settings_editSettings_sync": {
"description": "The label for the sync button",
"message": "Synchronize with YouTube"
"message": "Synchronize with YouTube's bell"
},
"settings_vertSettings_viewChangelog": {
"description": "The label for the view changelog button",
Expand Down
3 changes: 3 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ $(function(){
case "onSettingsOpen":
sendResponse(resetChannelsHasNewVideo(true));
break;
case "syncWithYoutube":
sendResponse(syncWithYoutube());
break;
}
});

Expand Down
47 changes: 24 additions & 23 deletions js/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ window.onload = function(){
$(document).on("click", "#notification-button", function(){
if(!this.hasAttribute("data-channelId"))
return;
var status = $(this).find("button").attr("aria-pressed") === "true",
var status = $(this).find("yt-icon-button").attr("aria-pressed") === "true",
channelId = this.getAttribute("data-channelId");

if(status)
Expand Down Expand Up @@ -89,7 +89,6 @@ $(function(){
}
});
}

});
function onMessageResponse(type, id){
awaitingResponse.forEach(function(item, i) {
Expand Down Expand Up @@ -193,7 +192,7 @@ function launchLegacy(){
return;
}

var elem = '<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-has-icon no-icon-markup hover-enabled ytn-btn" type="button" style="margin-left: 5px;float: initial;">\
var elemContent = '<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-has-icon no-icon-markup hover-enabled ytn-btn" type="button" style="margin-left: 5px;float: initial;">\
<span class="yt-uix-button-content">\
<span class="subscribe-label" aria-label="' + getString("addChannel") + '">' + getString("addChannel") + '</span>\
<span class="subscribed-label" aria-label="' + getString("channelAdded") + '">' + getString("channelAdded") + '</span>\
Expand All @@ -202,7 +201,7 @@ function launchLegacy(){
</button>';

if(slashes.indexOf("subscription_manager") > -1 && $(".ytn-btn").length == 0){// If is on page: https://www.youtube.com/subscription_manager
var elems = $(elem).insertBefore(".yt-uix-overlay");
var elems = $(elemContent).insertBefore(".yt-uix-overlay");
for(var i = 0; i < elems.length; i++){
var channelId = $($(".yt-uix-overlay")[i]).parent().children(".yt-uix-button").attr("data-channel-external-id");
$(elems[i]).attr("data-channelId", channelId);
Expand All @@ -213,33 +212,35 @@ function launchLegacy(){
$(elems[response.index]).addClass("yt-uix-button-subscribe-branded").removeClass("yt-uix-button-subscribed-branded");
});
}
}else if($(".ytn-btn").length < 1){// For everything else
}else{// For everything else
$(".yt-uix-overlay").each(function(){
var $this = $(this);
if(
$this.hasClass("channel-settings-overlay") ||
$this.hasClass("featured-content-picker-overlay") ||
$this.hasClass("settings-dialog-container") ||
$(".about-metadata-container").find(this).length > 0 ||
$this.parent().hasClass("channel-header-flagging-menu-container") ||
var $this = $(this),
elem = null;
if($this.is(".channel-settings-overlay, .featured-content-picker-overlay, .settings-dialog-container") ||
$this.parents(".about-metadata-container, .channel-header-flagging-menu-container").length > 0 ||
$this.parents(".primary-header-actions").find(".ytn-btn").length > 0)
return;
else{
elem = $(elemContent);
if($this.parents(".primary-header-actions").length > 0){
var elem2 = elem.replace("float: initial", "float: right");
$this.parents(".primary-header-actions").prepend(elem2);
elem[0].style.float = "right";
$this.parents(".primary-header-actions").prepend(elem);
}else
$(elem).insertBefore($this);
elem.insertBefore($this);
}
});

var channelId = $(".yt-uix-button.yt-uix-subscription-button").attr("data-channel-external-id");
$(".ytn-btn").attr("data-channelId", channelId);
chrome.runtime.sendMessage({type: "doesYoutubeExist", id: channelId}, function(response){
if(response.status)
$(".ytn-btn").removeClass("yt-uix-button-subscribe-branded").addClass("yt-uix-button-subscribed-branded");
else
$(".ytn-btn").addClass("yt-uix-button-subscribe-branded").removeClass("yt-uix-button-subscribed-branded");
if(elem == null)
return true;

var channelId = $(".yt-uix-button.yt-uix-subscription-button").attr("data-channel-external-id");
elem.attr("data-channelId", channelId);
chrome.runtime.sendMessage({type: "doesYoutubeExist", id: channelId}, function(response){
if(response.status)
elem.removeClass("yt-uix-button-subscribe-branded").addClass("yt-uix-button-subscribed-branded");
else
elem.addClass("yt-uix-button-subscribe-branded").removeClass("yt-uix-button-subscribed-branded");
});
});

}
}
6 changes: 6 additions & 0 deletions js/settings_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ function registerListeners(){
});

$("#settings_refresh").on("click", function(){
var settings = JSON.parse(localStorage.getItem("settings"));
chrome.extension.sendMessage({type: "checkYoutubeBatch"});
if(settings.sync.enabled)
chrome.extension.sendMessage({type: "syncWithYoutube"});
createToast(wyns.strings.updating);
});

Expand Down Expand Up @@ -613,6 +616,9 @@ function configureSettings(){
localStorage.setItem("settings", JSON.stringify(settings));
checkAddBtn();
createToast(wyns.strings.saved);

if(settings.sync.enabled)
chrome.extension.sendMessage({type: "syncWithYoutube"});
})[0].active = settings.sync.enabled;
checkAddBtn();

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"version": "1.2.4.0",
"version": "1.2.4.1",
"permissions": [
"notifications",
"unlimitedStorage",
Expand Down
2 changes: 1 addition & 1 deletion settings_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
</paper-card>
<paper-card id="paper_card-changelog" class="floating" data-toggle="false" i18n="settings_changelog_title" image="img/welcome_card.jpg">
<div class="card-content">
<div class="content-header">v1.2.4.0</div>
<div class="content-header">v1.2.4.1</div>
<ul>
<li>Added synchronization with YouTube's notification bell</li>
<ul>
Expand Down

0 comments on commit 587ac6e

Please sign in to comment.