<->archive.is
by
noromanba
2015-05-26 [2015/05/26 07:14:56]
come and go archive.is w/ list and detail page
@@ -18,19 +18,19 @@
// TBD regexp capture
var url = saved.value;
- url = url.replace(/^\*\./,'').replace(/\*$/, ''); // remove wild card
+ url = url.replace(/^\*\./,'').replace(/\*$/, ''); // remove wildcard
location.href = url.indexOf('http') > -1 ?
url.slice(url.lastIndexOf('http')) : // remove some 'http://'; e.g. wayback
- 'http://' + url; // handle domain-only; e.g. 'google.co.jp'
+ 'http://' + url; // handle domain-only; e.g. 'google.co.jp'
} else {
- // TODO canonical or/and remove protocol
+ // TODO canonical or/and remove protocol
location.href = 'https://archive.today/' + location.href;
}
})();
// WTH, WTF
-// archive.today are awsome, but url markup awful
+// archive.today are awsome, but markup awful
//
// - https://archive.today/
// - https://archive.today/www.google.co.jp/ (list page)
@@ -51,4 +51,4 @@
// - *.google.co.jp
//
// ':nth-last-of-type(1)', ':last-of-type' return first element (with attr sel)
-// add #id or .class or data-*, I WANT get original url EASILY
+// plz add #id or .class or data-*, I WANT to get original url EASILY
/*
* @title <->archive.past
* @description come and go archive.today w/ list and detail page
* @include http://*
* @include https://*
* @contributor noromanba
* @license MIT License http://opensource.org/licenses/MIT
* @javascript_url
*/
// c.f.
// https://archive.today/ (Bookmarklet to save here)
// https://archive.today/faq.html
(function () {
if (/archive\.today/.test(location.hostname) && location.pathname) {
var saved = document.querySelector('input[name="q"][value]');
if (!saved || !saved.value) return;
// TBD regexp capture
var url = saved.value;
url = url.replace(/^\*\./,'').replace(/\*$/, ''); // remove wildcard
location.href = url.indexOf('http') > -1 ?
url.slice(url.lastIndexOf('http')) : // remove some 'http://'; e.g. wayback
'http://' + url; // handle domain-only; e.g. 'google.co.jp'
} else {
// TODO canonical or/and remove protocol
location.href = 'https://archive.today/' + location.href;
}
})();
// WTH, WTF
// archive.today are awsome, but markup awful
//
// - https://archive.today/
// - https://archive.today/www.google.co.jp/ (list page)
// - 1 visible input, no div#header
// - #q name="q"
// - https://archive.today/MjjoE (detail page, include wayback)
// - 4 visible inputs, div#header
// - [ ] Saved from: submit tabindex"=-1" (wayback url)
// - http://web.archive.org/web/20040831080059/http://www.google.co.jp/
// - [ ] Redirected from: readonly (wayback url)
// - [ ] Via: readonly (via url)
// - [x] Original: readonly (saved url)
// - 5 input patterns, e.g. Google Japan
// - http://google.co.jp
// - https://google.co.jp
// - google.co.jp
// - http://www.google.co.jp/*
// - *.google.co.jp
//
// ':nth-last-of-type(1)', ':last-of-type' return first element (with attr sel)
// plz add #id or .class or data-*, I WANT to get original url EASILY
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。