From 8347cb389df3985c79b2f0e7c3c74afb0aaf707b Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Tue, 8 Jun 2021 14:32:55 -0400 Subject: [PATCH 1/6] properly open urls from firefox reader mode page --- background.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/background.js b/background.js index 7c57bda..56acd08 100644 --- a/background.js +++ b/background.js @@ -74,6 +74,9 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) { } else if (id.endsWith('-link')) { url = info.linkUrl; } + + if (url.startsWith("about:reader?url=") + url = decodeURIcomponent(url.replace("about:reader?url=", "")) if (id.startsWith('resurrect-google-')) { goToUrl(genGoogleUrl(url), openIn, tab.id); From fd4b2ddd1c671b5380a5651c7b0fe3abc05f2eb7 Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Sat, 3 Jul 2021 16:11:18 -0400 Subject: [PATCH 2/6] fix syntax, styling --- background.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index 56acd08..aba276a 100644 --- a/background.js +++ b/background.js @@ -74,9 +74,10 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) { } else if (id.endsWith('-link')) { url = info.linkUrl; } - - if (url.startsWith("about:reader?url=") - url = decodeURIcomponent(url.replace("about:reader?url=", "")) + + if (url.startsWith('about:reader?url=')) { + url = decodeURIComponent(url.replace('about:reader?url=', '')) + } if (id.startsWith('resurrect-google-')) { goToUrl(genGoogleUrl(url), openIn, tab.id); From 76ca53ca4e5af4b3a2a7c5ae841a398b37a157b5 Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Sat, 3 Jul 2021 16:14:45 -0400 Subject: [PATCH 3/6] open about:reader links correctly from popup --- popup.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/popup.js b/popup.js index 879da25..63ab8d4 100644 --- a/popup.js +++ b/popup.js @@ -18,6 +18,11 @@ function resurrect(gen) { chrome.tabs.query({active: true, currentWindow: true}, tabObj => { logLastError(); let url = gen(tabObj[0].url); + + if (url.startsWith('about:reader?url=')) { + url = decodeURIComponent(url.replace('about:reader?url=', '')); + } + console.info('Resurrecting via URL', url); goToUrl(url, openIn, tabObj[0].id); window.close(); From 18f57f666d7307eb452e12338dc07374c885806e Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Sat, 3 Jul 2021 16:15:06 -0400 Subject: [PATCH 4/6] semicolon --- background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/background.js b/background.js index aba276a..ed7cf7d 100644 --- a/background.js +++ b/background.js @@ -76,7 +76,7 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) { } if (url.startsWith('about:reader?url=')) { - url = decodeURIComponent(url.replace('about:reader?url=', '')) + url = decodeURIComponent(url.replace('about:reader?url=', '')); } if (id.startsWith('resurrect-google-')) { From 65a0c900471f91f98cc71b4522d412ac95d96fdf Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Sat, 21 Jan 2023 08:19:27 -0500 Subject: [PATCH 5/6] not applicable in background / contextmenu --- background.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/background.js b/background.js index ed7cf7d..7c57bda 100644 --- a/background.js +++ b/background.js @@ -75,10 +75,6 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) { url = info.linkUrl; } - if (url.startsWith('about:reader?url=')) { - url = decodeURIComponent(url.replace('about:reader?url=', '')); - } - if (id.startsWith('resurrect-google-')) { goToUrl(genGoogleUrl(url), openIn, tab.id); } else if (id.startsWith('resurrect-googletext-')) { From 0fd8a3d7fca709a7e2e108cdc1320bb296168e20 Mon Sep 17 00:00:00 2001 From: Wes <5124946+wesinator@users.noreply.github.com> Date: Sat, 21 Jan 2023 08:31:17 -0500 Subject: [PATCH 6/6] fix code --- popup.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/popup.js b/popup.js index 63ab8d4..bd06a83 100644 --- a/popup.js +++ b/popup.js @@ -17,11 +17,12 @@ function resurrect(gen) { return function() { chrome.tabs.query({active: true, currentWindow: true}, tabObj => { logLastError(); - let url = gen(tabObj[0].url); - - if (url.startsWith('about:reader?url=')) { - url = decodeURIComponent(url.replace('about:reader?url=', '')); + + var og_url = tabObj[0].url; + if (og_url.startsWith('about:reader?url=')) { + og_url = decodeURIComponent(og_url.replace('about:reader?url=', '')); } + let url = gen(og_url); console.info('Resurrecting via URL', url); goToUrl(url, openIn, tabObj[0].id);