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 = "";