+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
32e4d12
initial new draft of robust links started
Jun 13, 2025
9f88714
isValidAbsolute URL function
Jun 13, 2025
18ba567
robust links initial setup
Jun 18, 2025
7b27f41
Test Suite 47 out of 53 passed
Jun 20, 2025
5d075b4
fully tested robustlinks class
Jun 20, 2025
6fa9c8a
createURI
Jun 23, 2025
9494c60
convert all <a> tags into robuts links method
Jun 25, 2025
451389d
test suite 1 failed
Jun 25, 2025
8becda6
autoinit
Jun 26, 2025
decd922
working autoinit
Jun 27, 2025
de24b8c
Working autoinit
Jun 27, 2025
ec2c533
Working model
Jun 27, 2025
57fd9dd
dropdown arrow
Jul 1, 2025
c80eeb0
bug fixes
Jul 1, 2025
5acb7ad
bug fixes
Jul 1, 2025
80e32fc
moved out json exclusions
Jul 2, 2025
8ff4090
Autoinit private function
Jul 8, 2025
ee6d040
Config documentation
Jul 8, 2025
9f2ab60
Dropdown option config
Jul 8, 2025
42e1737
code cleanup
Jul 9, 2025
6bb2980
test suite
Jul 9, 2025
f158a86
Test cases
Jul 11, 2025
d2e72be
robust links types
Jul 11, 2025
cdb0ab3
new test case
d-koding Jul 18, 2025
c3e8093
updated to check async for link rot, not necessarily a good change
d-koding Jul 19, 2025
af89445
see it in action!
d-koding Jul 21, 2025
4814ef7
slight change to dist/index.html
d-koding Jul 21, 2025
061ca69
demo
d-koding Jul 21, 2025
e2ac1c8
demo1
d-koding Jul 21, 2025
8f70e75
working dropdown menu with css
d-koding Jul 21, 2025
9c8c60f
fully working dropdown menu
d-koding Jul 22, 2025
da5b5c3
save point
d-koding Jul 22, 2025
72cd22a
new demo
d-koding Jul 22, 2025
2d40b48
compiled js
d-koding Jul 22, 2025
130610f
new working demo
d-koding Jul 23, 2025
3d39427
new demo
d-koding Jul 23, 2025
3e808ea
bad test
d-koding Jul 23, 2025
f8958a1
final shipped demo
d-koding Jul 24, 2025
a5d8f0b
code cleanup
d-koding Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
219 changes: 219 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
# General
.DS_Store
.env
.idea/
.vscode/
npm-debug.log
yarn-debug.log
yarn-error.log
node_modules/
dist/
build/
coverage/
*.log
*.tmp
*.bak
*.swp
*.swo

# macOS
.DS_Store
.Trashes
._*
.Spotlight-V100
.TemporaryItems
.fseventsd
Icon?

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Linux
*~
.#*
*.swp
*.swo
*.bak
*.pyc
*.pyo

# Java
*.class
# Package Files
*.jar
*.war
*.ear
*.zip
*.tar
*.gz
# Maven
target/
pom.xml.tag
pom.xml.bak
pom.xml.versionsBackup
pom.xml.next
release.properties
releaseCandidate.properties
# Gradle
.gradle/
build/
# IntelliJ IDEA
.idea/
*.iml
*.iws
*.ipr

# Python
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
*.egg
*.egg-info/
dist/
build/
/htmlcov/
.tox/
.coverage
.pytest_cache/
*.mo
*.pot
*.log
.mypy_cache/
.vscode/

# JavaScript/Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
dist/
build/
coverage/
tmp/
*.orig
.cache/

# Ruby
.bundle/
/vendor/bundle
.rvmrc
.rbenv-version
.zeus.sock
public/assets/
tmp/
log/*.log
*.log
*.sqlite3
*.rbc

# C# / .NET
[Bb]in/
[Oo]bj/
*.user
*.suo
*.sln.docstates
_ReSharper*/
*.resharper
[Tt]humbs.db
[Dd]esktop.ini

# C++
*.o
*.obj
*.ko
*.mod.c
*.lo
*.loT
*.class
*.dll
*.dSYM/
*.lib
*.so
*.a
*.exe
*.out
*.app
*.bin
*.res
*.pch
*.pdb
*.ilk
*.suo
*.user
*.ncb
*.aps
*.bsc
*.sbr
*.scc
_UpgradeReport_Files/
# Build files
CMakeCache.txt
CMakeFiles/
Makefile
cmake_install.cmake
install/
build/

# Go
*.exe
*.dll
*.so
*.dylib
*.o
*.a
*.bak
*.tmp
*.out
*.log
*_test
test_coverage.html
/vendor/

# PHP
/vendor/
composer.lock
.env
.phpunit.result.cache

# Swift / Objective-C
build/
*.xcarchive/
*.xcuserdata/
*.xccheckout/
*.framework
*.lo
*.o
*.d
#*.js
*.map
*.swiftdoc
*.swiftmodule
*.ipa
*.app

# Docker
Dockerfile.orig
docker-compose.yml.orig

# Vagrant
.vagrant/

# Terraform
.terraform/
*.tfplan
*.tfstate
*.tfstate.backup

# Jekyll / Hugo (Static Site Generators)
_site/
public/
.sass-cache/
.jekyll-cache/
117 changes: 106 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,109 @@
# Robust Links
Are you an author of web pages and you don't want your links to die? Here is a really easy way to achieve just that:
# Robust Links V2 [WIP]

* Include the Robust Links JavaScript and CSS files into your pages as shown below.
* Robustify your links by adding HTML elements as explained in the [Robustifying Links document](http://robustlinks.mementoweb.org/spec/).
* You can read about the motivations for using Robust Links [here](http://robustlinks.mementoweb.org/about/).
* The result will be that each link is augmented with the ability to see the linked resource as it was at or around the time the link was created. This is achieved by resolving links using the [Memento Time Travel](http://timetravel.mementoweb.org/guide/api/) infrastructure that aggregates web archives from around the world. At any time, even when a link breaks, the Robust Link will lead to archived content.
Are you an author of web pages and you don't want your links to die? The `RobustLinksV2` library provides a powerful and flexible way to combat "link rot" and "content drift" by augmenting your web links with archival metadata and functionality.

This library helps ensure that even if an original web resource changes or disappears, visitors to your page can still access a preserved version of the content as it was intended at the time of linking. This is achieved by leveraging the [Memento Time Travel](http://timetravel.mementoweb.org/guide/api/) infrastructure, which aggregates web archives from around the world.

![](https://robustlinks.mementoweb.org/demo/robustlinks_demo_light.gif)
*(Note: The GIF shows a previous version's UI, but the core concept of augmented links remains.)*

### See it in Action!

<a href="demo/index.html" style="
display: inline-block;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
color: #ffffff;
background-color: #007bff;
border: none;
border-radius: 5px;
text-decoration: none;
text-align: center;
transition: background-color 0.3s;
">
Go to the Live Demo
</a>


## Key Concepts

Robust Links enhance standard `<a>` tags with specific `data-*` attributes:

* `data-originalurl`: The original, canonical URI of the resource being linked.
* `data-versiondate`: The intended date of linking to the resource, representing the state the linker wants the visitor to experience.
* `data-versionurl`: (Optional) The URI of one or more pre-existing snapshots of the resource, often from a web archive.

## Installation and Setup

To integrate `RobustLinksV2` into your webpage:

1. **Download the files:** Obtain the compiled `robustlinks2.js` and `robustlinks2.css` files.
2. **Place them in your project:** A common setup is to place `robustlinks2.js` in a `js/` directory.
3. **Include in your HTML:** Add the following lines to the `<head>` section of your HTML source:

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Robust Links Page</title>
</head>
<body>
<!-- Your page content -->

<!-- RobustLinksV2 JavaScript and css (place before closing </body> for optimal loading) -->
<script type="module" src="js/robustlinks2.js"></script>
<link rel="stylesheet" href="robustlinks.css">

<!-- Your initialization script -->
<script type="module">
import { RobustLinksV2 } from './js/robustlinks2.js';

document.addEventListener('DOMContentLoaded', () => {
// Initialize RobustLinksV2 with your desired configuration
new RobustLinksV2({
// Your configuration options go here (see below)
});
});
</script>
</body>
</html>
```

## RobustLinksConfig Options

The `RobustLinksV2` class is initialized with a configuration object (`RobustLinksConfig`) to customize its behavior:

```typescript
interface RobustLinksConfig {
id?: string; // An identifier for the RobustLinksV2 instance.
debug?: boolean; // Enables debug logging to the console. Defaults to `false`.
timeGate?: string; // The base URL for the Memento TimeGate. Defaults to "[https://web.archive.org/](https://web.archive.org/)".
enableDropdown?: boolean; // Enables or disables the dropdown menu for robustified links. Defaults to `false`.
dropdownArrowColor?: string; // The color of the dropdown arrow icon (influences CSS). Defaults to "#333".
dropdownArrowSize?: string; // The size (e.g., "1em", "12px") of the dropdown arrow icon (influences CSS). Defaults to "6px".
dropdownArrowHtml?: string; // Custom HTML string to use for the dropdown arrow icon (e.g., SVG markup). If not provided, a Unicode arrow (▼) is used.
autoInit?: boolean | { // Enables or configures automatic robust link creation on initialization. Defaults to `true`.
selector?: string; // CSS selector for links to robustify. Defaults to `a:not([data-originalurl])`.
rootElement?: HTMLElement; // The DOM element to search within. Defaults to `document.body`.
dataProducer?: (anchor: HTMLAnchorElement, index: number) => { // Custom function to provide robust link data.
originalUrl: string;
versionDate: Date;
versionSnapshots?: RobustLinkSnapshot[];
newHref?: string;
} | null | undefined;
};
}
```

## FUTURE WORK
* Serverside fetching for more accurate version dates
*
* Configurable fallback for versiondate, other parameters

## Add Robust Links To Your Webpages
## Add Robust Links To Your Webpages [LEGACY]

Simply append the following lines to the `<head>` section of your HTML source:

Expand All @@ -19,7 +114,7 @@ Simply append the following lines to the `<head>` section of your HTML source:
<script type="text/javascript" src="https://doi.org/10.25776/h1fa-7a28"></script>
```

## RobustLinks Menu
## RobustLinks Menu [LEGACY]

After adding the Robust Links JavaScript source to your HTML file, a new link icon will appear next to all the robustified links in the page. Clicking the down arrow in this icon will pop up a menu with the following items:

Expand All @@ -30,10 +125,10 @@ After adding the Robust Links JavaScript source to your HTML file, a new link ic
* `Version archived near <date>`: When clicking this menu item, the JavaScript library will use the datetime provided in the `data-versiondate` attribute along with the original url and redirect you to the closest memento around that datetime using the [Memento Time Travel](http://timetravel.mementoweb.org/guide/api/) service.


## Example
## Example [LEGACY]
- [Before](http://robustlinks.mementoweb.org/demo/uri_references.html)
- [After](http://robustlinks.mementoweb.org/demo/uri_references_js.html)
- [After](http://robustlinks.mementoweb.org/demo/uri_references_js.html)

## License
## License [LEGACY]
See the [license](http://mementoweb.github.io/SiteStory/license.html).

36 changes: 36 additions & 0 deletions archiveExclusions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
"https?://web.archive.org/web/",
"https?://web.archive.bibalex.org/web/",
"https?://www.webarchive.org.uk/wayback/en/archive/",
"https?://langzeitarchivierung.bib-bvb.de/wayback/",
"https?://webcitation.org/",
"https?://webarchive.loc.gov/all/",
"https?://wayback.archive-it.org/all/",
"https?://wayback.archive-it.org/[0-9]+/",
"https?://webarchive.parliament.uk/[0-9]+/",
"https?://webarchive.parliament.uk/[0-9]+tf_/",
"https?://webarchive.nationalarchives.gov.uk/[0-9]+/",
"https?://webarchive.nationalarchives.gov.uk/[0-9]+tf_/",
"https?://archive.li/",
"https?://archive.vn/",
"https?://archive.fo/",
"https?://archive.md/",
"https?://archive.ph/",
"https?://archive.today/",
"https?://archive.is/",
"https?://waext.banq.qc.ca/wayback/[0-9]+/",
"https?://haw.nsk.hr/arhiva/",
"https?://wayback.webarchiv.cz/wayback/[0-9]+/",
"https?://wayback.vefsafn.is/wayback/[0-9]+/",
"https?://arquivo.pt/wayback/[0-9]+/",
"https?://arquivo.pt/wayback/[0-9]+if_/",
"https?://perma-archives.org/warc/[0-9]+/",
"https?://perma.cc/[0-9A-Z]{4}-[0-9A-Z]{4}/",
"https?://wayback.padicat.cat/wayback/[0-9]+/",
"https?://archive.aueb.gr/services/web/[0-9]+/",
"https?://digital.library.yorku.ca/wayback/[0-9]+/",
"https?://veebiarhiiv.digar.ee/a/[0-9]+/",
"https?://webarchive.nrscotland.gov.uk/[0-9]+/",
"https?://nukrobia.nuk.uni-lj.si:8080/wayback/[0-9]+/",
"https?://swap.stanford.edu/[0-9]+/"
]
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载