<->archive.is
by
noromanba
2015-05-26 [2015/05/26 07:14:56]
come and go archive.is w/ list and detail page
@@ -1,5 +1,5 @@
/*
- * @title <->archive.past
+ * @title <->archive.is
* @description come and go archive.is w/ list and detail page
* @include http://*
* @include https://*
@@ -8,40 +8,45 @@
* @javascript_url
*/
-// OBSOLETE .today? turn back .is
-// 〜2014-04-15 http://archive.is
-// 2014-04-15〜 http://archive.today
-// 2015-04-23? http://archive.is
-// 2015-04-20 ".today" but 2015-04-23, 302 redirect to ".is"
-// - http://web.archive.org/web/20150420033512/https://archive.today/
-// - http://web.archive.org/web/20150423204200/http://archive.today/
-// - http://web.archive.org/web/*/archive.today
+// OBSOLETE .today, turn back .is
+// ~2014-04-15? http://archive.is
+// 2014-04-15?~ http://archive.today
+// 2015-04-23? http://archive.is
+// 2015-04-20 ".today" -> 2015-04-23, 302 redirect to ".is"
+// - http://web.archive.org/web/*/archive.today
+// - http://web.archive.org/web/20150420033512/https://archive.today/
+// - http://web.archive.org/web/20150423204200/http://archive.today/
// c.f.
// https://archive.is/ (Bookmarklet for immediately save)
// https://archive.is/faq.html
(function () {
- if (/archive\.is/.test(location.hostname) && location.pathname) {
+ var url;
+
+ if (/archive\.is$/.test(location.hostname)) {
var saved = document.querySelector('input[name="q"][value]');
if (!saved || !saved.value) return;
// TBD regexp capture
- var url = saved.value;
+ 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, H::B et. al
- /*/
- url :
- //*/
'http://' + url;
} else {
- // TODO canonical TBD remove protocol
- location.href = 'https://archive.is/' + location.href;
+ // canonical
+ // http://let.hatelabo.jp/noromanba/let/hLHVzOTQjfYH
+ // https://gist.github.com/noromanba/d730ccf3ae5e6916cd60
+ url = (document.head.querySelector('meta[property="og:url"][content]') || {}).content ||
+ (document.head.querySelector('link[rel="canonical"][href]') || {}).href ||
+ location.href;
+
+ location.href = 'http://archive.is/' + url;
}
})();
+// DBG
// archive.is are awesome, but markup awful
//
// - https://archive.is/
/*
* @title <->archive.is
* @description come and go archive.is w/ list and detail page
* @include http://*
* @include https://*
* @contributor noromanba
* @license MIT License http://opensource.org/licenses/MIT
* @javascript_url
*/
// OBSOLETE .today, turn back .is
// ~2014-04-15? http://archive.is
// 2014-04-15?~ http://archive.today
// 2015-04-23? http://archive.is
// 2015-04-20 ".today" -> 2015-04-23, 302 redirect to ".is"
// - http://web.archive.org/web/*/archive.today
// - http://web.archive.org/web/20150420033512/https://archive.today/
// - http://web.archive.org/web/20150423204200/http://archive.today/
// c.f.
// https://archive.is/ (Bookmarklet for immediately save)
// https://archive.is/faq.html
(function () {
var url;
if (/archive\.is$/.test(location.hostname)) {
var saved = document.querySelector('input[name="q"][value]');
if (!saved || !saved.value) return;
// TBD regexp capture
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, H::B et. al
'http://' + url;
} else {
// canonical
// http://let.hatelabo.jp/noromanba/let/hLHVzOTQjfYH
// https://gist.github.com/noromanba/d730ccf3ae5e6916cd60
url = (document.head.querySelector('meta[property="og:url"][content]') || {}).content ||
(document.head.querySelector('link[rel="canonical"][href]') || {}).href ||
location.href;
location.href = 'http://archive.is/' + url;
}
})();
// DBG
// archive.is are awesome, but markup awful
//
// - https://archive.is/
// - https://archive.is/www.google.co.jp/ (list page)
// - 1 visible input
// - #q name="q"
// - https://archive.is/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: name="q" 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)
// WTH, WTF 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 です。