From 387213d0634a9264de8659a8ac264f7c0a8053e9 Mon Sep 17 00:00:00 2001 From: blankie Date: Wed, 30 Aug 2023 11:27:05 +1000 Subject: [PATCH] Update Archive Site Links to 1.1.0 - Show archive links even for the same archiver --- Archive Site Links.user.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Archive Site Links.user.js b/Archive Site Links.user.js index 742f555..76b4d8a 100644 --- a/Archive Site Links.user.js +++ b/Archive Site Links.user.js @@ -4,7 +4,7 @@ // @match http*://*/* // @grant GM_openInTab // @grant GM_registerMenuCommand -// @version 1.0.0 +// @version 1.1.0 // @author blankie // @description Adds buttons to the monkey menu to open/archive in the Wayback Machine and archive.today // @inject-into content @@ -72,21 +72,19 @@ for (const ARCHIVE_SITE of ARCHIVE_SITES) { let archiveSites = 0; for (const ARCHIVE_SITE of ARCHIVE_SITES) { - if (onArchiveSite === ARCHIVE_SITE) { - continue; - } - if (archiveSites !== 0) { GM_registerMenuCommand("=".repeat(20) + "\u200B".repeat(archiveSites), function() {}); } archiveSites++; - GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name}`, function() { - window.location.href = ARCHIVE_SITE.getArchivedUrl(url); - }); - GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name} (new tab)`, function() { - GM_openInTab(ARCHIVE_SITE.getArchivedUrl(url)); - }); + if (ARCHIVE_SITE !== onArchiveSite) { + GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name}`, function() { + window.location.href = ARCHIVE_SITE.getArchivedUrl(url); + }); + GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name} (new tab)`, function() { + GM_openInTab(ARCHIVE_SITE.getArchivedUrl(url)); + }); + } let urlObject = new URL(url); urlObject.hash = "";