Update Archive Site Links to 1.1.0

- Show archive links even for the same archiver
This commit is contained in:
blankie 2023-08-30 11:27:05 +10:00
parent a91831ee70
commit 387213d063
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 9 additions and 11 deletions

View File

@ -4,7 +4,7 @@
// @match http*://*/* // @match http*://*/*
// @grant GM_openInTab // @grant GM_openInTab
// @grant GM_registerMenuCommand // @grant GM_registerMenuCommand
// @version 1.0.0 // @version 1.1.0
// @author blankie // @author blankie
// @description Adds buttons to the monkey menu to open/archive in the Wayback Machine and archive.today // @description Adds buttons to the monkey menu to open/archive in the Wayback Machine and archive.today
// @inject-into content // @inject-into content
@ -72,21 +72,19 @@ for (const ARCHIVE_SITE of ARCHIVE_SITES) {
let archiveSites = 0; let archiveSites = 0;
for (const ARCHIVE_SITE of ARCHIVE_SITES) { for (const ARCHIVE_SITE of ARCHIVE_SITES) {
if (onArchiveSite === ARCHIVE_SITE) {
continue;
}
if (archiveSites !== 0) { if (archiveSites !== 0) {
GM_registerMenuCommand("=".repeat(20) + "\u200B".repeat(archiveSites), function() {}); GM_registerMenuCommand("=".repeat(20) + "\u200B".repeat(archiveSites), function() {});
} }
archiveSites++; archiveSites++;
if (ARCHIVE_SITE !== onArchiveSite) {
GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name}`, function() { GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name}`, function() {
window.location.href = ARCHIVE_SITE.getArchivedUrl(url); window.location.href = ARCHIVE_SITE.getArchivedUrl(url);
}); });
GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name} (new tab)`, function() { GM_registerMenuCommand(`Open in ${ARCHIVE_SITE.name} (new tab)`, function() {
GM_openInTab(ARCHIVE_SITE.getArchivedUrl(url)); GM_openInTab(ARCHIVE_SITE.getArchivedUrl(url));
}); });
}
let urlObject = new URL(url); let urlObject = new URL(url);
urlObject.hash = ""; urlObject.hash = "";