@@ -2,13 +2,17 @@ * @title ≡ * @description centering * @include http://* + * @include https://* * @license MIT License http://nrm.mit-license.org/2012 - * @require + * @javascript_url */ // TBD main content detection // c.f. https://github.com/hatena/extract-content-javascript +// tiny ver. +// http://let.hatelabo.jp/noromanba/let/hLHX8--x5Ok9 + (function centering() { var addStyle = (function createContainer() { var parent = document.head || document.body || document.documentElement; @@ -39,3 +43,4 @@ 'min-width' : '640px' }, 'body')); })(); +
  • /*
     * @title ≡
     * @description centering
     * @include http://*
     * @include https://*
     * @license MIT License http://nrm.mit-license.org/2012
     * @javascript_url
     */
    
    // TBD main content detection
    // c.f. https://github.com/hatena/extract-content-javascript
    
    // tiny ver.
    // http://let.hatelabo.jp/noromanba/let/hLHX8--x5Ok9
    
    (function centering() {
        var addStyle = (function createContainer() {
            var parent = document.head || document.body || document.documentElement;
            var style = document.createElement('style');
            style.type = 'text/css';
            style.dataset.letName = createContainer.arguments.callee.caller.name; // XXX
            parent.appendChild(style);
    
            return function (css) {
                style.appendChild(document.createTextNode(css + '\n'));
            };
        })();
    
        var createStyle = function (spec, selector) {
            var s = [];
            s = Object.keys(spec).map(function (prop) {
                return (prop + ': ' + spec[prop] + ' !important; ');
            });
            s.unshift((selector || '*') + ' { ');
            s.push('}');
            return s.join('');
        };
    
        addStyle(createStyle({
            'margin-left' : 'auto',
            'margin-right': 'auto',
            'max-width'   : '80%',
            'min-width'   : '640px'
        }, 'body'));
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/01/11 02:53:00 - 2016-01-11
  2. 2013/06/09 00:05:03 - 2013-06-09
  3. 2013/02/24 18:55:32 - 2013-02-24
  4. 2013/02/24 18:42:59 - 2013-02-24
  5. 2013/02/21 06:11:47 - 2013-02-21
  6. 2013/02/21 04:20:04 - 2013-02-21
  7. 2013/02/21 03:25:07 - 2013-02-21
  8. 2012/07/17 18:21:24 - 2012-07-17