darekagakaku days--
@@ -23,18 +23,18 @@
};
(function () {
+ var origin = 'https://darekagakaku.herokuapp.com/';
+ if (location.href.indexOf(origin) === -1) {
+ location.href = origin;
+ }
+
var date = location.pathname.slice(3).split('-');
if (!date || date.length < 3) return;
- // better be assert
+ // better to assert
var eve = new Date(date[0], (date[1] - 1), date[2]); // innner month: 0-11
- eve.setDate(eve.getDate() - 1); // previous day
+ eve.setDate(eve.getDate() - 1);
- var origin = 'https://darekagakaku.herokuapp.com/';
- if (location.href.indexOf(origin) === -1) {
- location.href = origin;
- } else {
- location.pathname = '/v/' + toDBdateString(eve);
- }
+ location.pathname = '/v/' + toDBdateString(eve);
})();
})();
/*
* @title darekagakaku timemachine
* @description dive into darekagakaku. more deep, deep, deeper
* @include http://darekagakaku.herokuapp.com/*
* @include https://darekagakaku.herokuapp.com/*
* @license MIT License
* @see http://let.hatelabo.jp/taizooo/let/gYC-ycuH_KPtfg (Fork of)
*/
// [Changes]
// - code beautify
// - peitit refactoring
(function () {
var toDBdateString = function (date) {
// absolutize, stringfy, digitalize, zeropadding
var paddingSlice = function (num, digit) {
return ('0' + Math.abs(num)).slice(-(Number(digit)));
};
var y = date.getFullYear(),
m = date.getMonth() + 1, // display month: 1-12
d = date.getDate();
return paddingSlice(y, 4) + '-' + paddingSlice(m, 2) + '-' + paddingSlice(d, 2);
};
(function () {
var origin = 'https://darekagakaku.herokuapp.com/';
if (location.href.indexOf(origin) === -1) {
location.href = origin;
}
var date = location.pathname.slice(3).split('-');
if (!date || date.length < 3) return;
// better to assert
var eve = new Date(date[0], (date[1] - 1), date[2]); // innner month: 0-11
eve.setDate(eve.getDate() - 1);
location.pathname = '/v/' + toDBdateString(eve);
})();
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。