darekagakaku FF

    
      
  • /*
     * @title darekagakaku days--
     * @description dive into darekagakaku. more deep, deep, deeper (Forked from darekagakaku digging)
     * @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)));
            };
            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 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 です。

History

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