From ee0144c038a473debd07e328147fcc8f885aeb28 Mon Sep 17 00:00:00 2001 From: Wassup789 Date: Mon, 20 Nov 2017 04:02:53 -0800 Subject: [PATCH] v1.2.4.2 Release Fixed issue for legacy layout causing duplicate buttons to show and changed "Add buttons on Youtube" text resource for settings --- _locales/en/messages.json | 2 +- js/background.js | 15 ++++++++++++++- js/content_script.js | 5 +++-- manifest.json | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 04b9c22..85c3762 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -53,7 +53,7 @@ }, "settings_editSettings_addButtons": { "description": "The label for the enable add buttons checkbox", - "message": "Enable add buttons on YouTube" + "message": "Add buttons on YouTube" }, "settings_editSettings_addButtonsSubs": { "description": "The label for the view subscriptions button", diff --git a/js/background.js b/js/background.js index b01bfb2..1fe1f99 100644 --- a/js/background.js +++ b/js/background.js @@ -361,7 +361,8 @@ chrome.runtime.onInstalled.addListener(function(details){ wyn.firstLaunch(); }else if(details.reason == "update"){ var thisVersion = chrome.runtime.getManifest().version; - if(details.previousVersion != thisVersion){ + // Ignore for same base version + if(details.previousVersion != thisVersion && extractBaseVersion(thisVersion) != extractBaseVersion(details.previousVersion)){ console.log("Updated from " + details.previousVersion + " to " + thisVersion); chrome.browserAction.setBadgeText({text: "new"}); @@ -1543,4 +1544,16 @@ function resetChannelHasNewVideo(num, updateSettingsBadge) { if(updateSettingsBadge) updateBadge(); +} + +/** + * Extracts the base version of the extension + * Ex: 1.2.3.4 -> 1.2.3 + * + * @param version The version of the extension + */ +function extractBaseVersion(version){ + var arr = version.split("."); + arr.pop(); + return arr.join("."); } \ No newline at end of file diff --git a/js/content_script.js b/js/content_script.js index 8b22703..feedca2 100644 --- a/js/content_script.js +++ b/js/content_script.js @@ -212,13 +212,14 @@ function launchLegacy(){ $(elems[response.index]).addClass("yt-uix-button-subscribe-branded").removeClass("yt-uix-button-subscribed-branded"); }); } - }else{// For everything else + }else if(slashes.indexOf("subscription_manager") < 0){// For everything else $(".yt-uix-overlay").each(function(){ 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) + $this.parents(".primary-header-actions").find(".ytn-btn").length > 0 || + $this.parent().find(".ytn-btn").length > 0) return; else{ elem = $(elemContent); diff --git a/manifest.json b/manifest.json index de26b53..94792b0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ }, "name": "__MSG_appName__", "description": "__MSG_appDesc__", - "version": "1.2.4.1", + "version": "1.2.4.2", "permissions": [ "notifications", "unlimitedStorage",