From 8f88dbebe7fa2872c865da661dc741afcf263d5a Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Mon, 25 Jul 2022 21:44:14 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8D=99=20little=20bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/ytContent.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/scripts/ytContent.tsx b/src/scripts/ytContent.tsx index bc8e9e6..65c2b5f 100644 --- a/src/scripts/ytContent.tsx +++ b/src/scripts/ytContent.tsx @@ -174,7 +174,7 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa const params: Parameters[0] = sources.map((source) => ({ id: source.id, type: source.type })) const platform = targetPlatformSettings[settings.targetPlatform] - const results = await requestResolveById(params) + const results = await requestResolveById(params) ?? [] const targets: Record = Object.fromEntries( sources.map((source) => { const result = results[source.id] @@ -259,8 +259,6 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa document.querySelector(source.platform.htmlQueries.videoDescription) : source.platform.htmlQueries.channelLinks ? document.querySelector(source.platform.htmlQueries.channelLinks) : null - console.log(linksContainer) - if (linksContainer) { const anchors = Array.from(linksContainer.querySelectorAll('a')) From de43b990f2c7e633080db67ac887515c67e703fc Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Mon, 25 Jul 2022 23:25:33 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8D=A3=20button=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/ytContent.tsx | 51 ++++++++++++++++++++++++++------------- src/settings/index.ts | 6 ++--- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/scripts/ytContent.tsx b/src/scripts/ytContent.tsx index 65c2b5f..aad404f 100644 --- a/src/scripts/ytContent.tsx +++ b/src/scripts/ytContent.tsx @@ -38,31 +38,37 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa if (!target || !source) return null const url = getLbryUrlByTarget(target) - return
+ return
findVideoElementAwait(source).then((videoElement) => { videoElement.pause() })} > - + {target.type === 'channel' ? 'Channel on' : 'Watch on'} {target.platform.button.platformNameText}
@@ -72,17 +78,25 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa if (!target || !source) return null const url = getLbryUrlByTarget(target) - return
+ return @@ -110,16 +123,20 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa null if (!mountPlayerButtonBefore) render(, playerButtonMountPoint) else { - if (mountPlayerButtonBefore.previousSibling !== playerButtonMountPoint) + if (playerButtonMountPoint.getAttribute('data-id') !== params.source.id) { mountPlayerButtonBefore.parentElement?.insertBefore(playerButtonMountPoint, mountPlayerButtonBefore) + playerButtonMountPoint.setAttribute('data-id', params.source.id) + } render(, playerButtonMountPoint) } const mountButtonBefore = document.querySelector(params.source.platform.htmlQueries.mountPoints.mountButtonBefore[params.source.type]) if (!mountButtonBefore) render(, playerButtonMountPoint) else { - if (mountButtonBefore.previousSibling !== buttonMountPoint) + if (buttonMountPoint.getAttribute('data-id') !== params.source.id) { mountButtonBefore.parentElement?.insertBefore(buttonMountPoint, mountButtonBefore) + buttonMountPoint.setAttribute('data-id', params.source.id) + } render(, buttonMountPoint) } } diff --git a/src/settings/index.ts b/src/settings/index.ts index e71dd40..2ea575a 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -84,7 +84,7 @@ export const targetPlatformSettings = { icon: chrome.runtime.getURL('assets/icons/lbry/madiator-logo.svg'), style: { button: { flexDirection: 'row-reverse' }, - icon: { transform: 'scale(1.2)' } + icon: { } } } }), @@ -137,9 +137,9 @@ export const sourcePlatfromSettings = { mountPoints: { mountButtonBefore: { video: 'ytd-video-owner-renderer~#subscribe-button', - channel: '#channel-header-container #buttons' + channel: '#channel-header-container #buttons #subscribe-button' }, - mountPlayerButtonBefore: 'ytd-player .ytp-right-controls', + mountPlayerButtonBefore: 'ytd-watch-flexy ytd-player .ytp-right-controls', }, videoPlayer: '#ytd-player video', videoDescription: 'ytd-video-secondary-info-renderer #description',