darekagakaku FF

    @@ -1,14 +1,13 @@ /* - * @title darekagakaku days-- - * @description dive into darekagakaku. more deep, deep, deeper (Forked from darekagakaku digging) + * @title darekagakaku FF + * @description fast-forward darekagakaku * @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) + * @contributor taizooo http://let.hatelabo.jp/taizooo/let/gYC-ycuH_KPtfg + * @contributor noromanba http://let.hatelabo.jp/noromanba/let/gYC-xeHrgub3Vg (Fork of) + * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHUrrmJl6w3 + * @license MIT License http://opensource.org/licenses/MIT */ -// [Changes] -// - code beautify -// - peitit refactoring (function () { var toDBdateString = function (date) { @@ -22,20 +21,20 @@ paddingSlice(date.getDate(), 2) ].join('-'); }; - + (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); + var next = new Date(date[0], (date[1] - 1), date[2]); // innner month: 0-11 + next.setDate(next.getDate() + 1); + + location.pathname = '/v/' + toDBdateString(next); })(); -})(); +})();
  • /*
     * @title darekagakaku FF
     * @description fast-forward darekagakaku
     * @include http://darekagakaku.herokuapp.com/*
     * @include https://darekagakaku.herokuapp.com/*
     * @contributor taizooo     http://let.hatelabo.jp/taizooo/let/gYC-ycuH_KPtfg
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/gYC-xeHrgub3Vg (Fork of)
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/hLHUrrmJl6w3
     * @license MIT License http://opensource.org/licenses/MIT
     */
    
    (function () {
        var toDBdateString = function (date) {
            // absolutize, stringfy, digitalize, zeropadding
            var paddingSlice = function (num, digit) {
                return ('0' + Math.abs(num)).slice(-(Number(digit)));
            };
            return [
                paddingSlice(date.getFullYear(), 4),
                paddingSlice((date.getMonth() + 1), 2), // display month: 1-12
                paddingSlice(date.getDate(), 2)
            ].join('-');
        };
    
        (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 next = new Date(date[0], (date[1] - 1), date[2]); // innner month: 0-11
            next.setDate(next.getDate() + 1);
    
            location.pathname = '/v/' + toDBdateString(next);
        })();
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/10/01 19:30:17 - 2013-10-01
  2. 2013/10/01 19:29:54 - 2013-10-01