True Reader Mode

    @@ -24,6 +24,6 @@ if (el) { hide(el); } else { - hide(document.documentElement); + hide(document.body || document.documentElement); } })()
  • /*
     * @title True Reader Mode
     * @description Show only main content
     * @include http://*
     * @license MIT License
     * @require 
     */
    (function() {
    function hide(el) {
      var parent = el.parentNode;
      if (parent) {
        var sibling = parent.firstElementChild;
        while (sibling) {
          if (sibling != el) {
            sibling.style.webkitFilter = 'brightness(1)';
          }
          sibling = sibling.nextElementSibling;
        }
        hide(parent);
      }
    }
    
    var el = document.querySelector('*[role="main"]');
    if (el) {
      hide(el);
    } else {
      hide(document.body || document.documentElement);
    }
    })()
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2012/10/12 23:53:26 - 2012-10-12
  2. 2012/10/12 23:51:08 - 2012-10-12