2txt

    @@ -9,16 +9,23 @@ * @javascript_url */ +/* for mobile +javascript:(function(){var a=document.documentElement||document.querySelector('html'),b=document.head||document.querySelector('head')||a.firstElementChild;if(b&&'head'===b.nodeName.toLowerCase()){var c=document.createElement('meta');c.name='viewport',c.content='width=device-width, initial-scale=1',b.appendChild(c)}var d=document.body.style;d.all='initial',d.maxWidth='100%',d.height='100%',d.overFlow='hidden',a.style.height=window.innerHeight+'px';var e=document.body.innerText.split(String.fromCharCode(160)).join(' ').replace(/\r?\n/g,'\n').replace(/[ \t ]{2,}/g,' ').trim().replace(/\n{3,}/g,'\n\n'),f=['<textarea style="','padding: 6px;','width: 94%;','height: 100%;','font-size: 16px;','border-radius: 0;','" readonly>',e,'</textarea>'].join('');document.body.innerHTML=f})(); +*/ +// minified w/ Babili +// https://babeljs.io/repl/ + // beautify 4-space indent from 3-space indent (function() { 'use strict'; + var html = document.documentElement || document.querySelector('html'); var head = document.head || document.querySelector('head') || - document.documentElement.firstElementChild; + html.firstElementChild; // PDFium has not head - if (head) { + if (head && head.nodeName.toLowerCase() === 'head') { var viewport = document.createElement('meta'); viewport.name = 'viewport'; viewport.content = 'width=device-width, initial-scale=1'; @@ -40,7 +47,6 @@ bodyStyle.height = '100%'; bodyStyle.overFlow = 'hidden'; - var html = document.documentElement || document.querySelector('html'); html.style.height = window.innerHeight + 'px'; var letter = document.body.innerText @@ -53,6 +59,9 @@ // 3+ times linebreak -> 2 times .replace(/\n{3,}/g,'\n\n'); + // TBD heredoc func c.f. + // https://github.com/to/tombloo/blob/d040ea4/xpi/chrome/content/library/01_utility.js#L2489 + // http://let.hatelabo.jp/noromanba/let/hJmcrJG18dRE var area = [ '<textarea style="', 'padding: 6px;', @@ -62,8 +71,9 @@ 'border-radius: 0;', '" readonly>', letter, - '</textarea>', + '</textarea>' ].join(''); + // TBD wrap //area.style.wordBreak = 'break-word'; //area.style.whiteSpace = 'pre-wrap'; @@ -74,9 +84,3 @@ //area.select(); })(); -// minified -// https://chriszarate.github.io/bookmarkleter/ -/* -javascript:(function(){var e=document.head||document.querySelector("head")||document.documentElement.firstElementChild;if(e){var t=document.createElement("meta");t.name="viewport",t.content="width=device-width, initial-scale=1",e.appendChild(t)}var n=document.body.style;n.all="initial",n.maxWidth="100%",n.height="100%",n.overFlow="hidden",(document.documentElement||document.querySelector("html")).style.height=window.innerHeight+"px";var i=document.body.innerText.split(String.fromCharCode(160)).join(" ").replace(/\r?\n/g,"\n").replace(/[ \t ]{2,}/g," ").trim().replace(/\n{3,}/g,"\n\n"),d=['<textarea style="',"padding: 6px;","width: 94%;","height: 100%;","font-size: 16px;","border-radius: 0;",'" readonly>',i,"</textarea>"].join("");document.body.innerHTML=d})(); -*/ -
  • /*
     * @title 2txt
     * @description show page text for copy
     * @include http://*
     * @include https://*
     * @contributor tokyo_2020  http://let.hatelabo.jp/tokyo_2020/let/hJme68iP0Yt-
     * @license MIT License     https://opensource.org/licenses/MIT
     * @version 2017.4.27.0
     * @javascript_url
     */
    
    /* for mobile
    javascript:(function(){var a=document.documentElement||document.querySelector('html'),b=document.head||document.querySelector('head')||a.firstElementChild;if(b&&'head'===b.nodeName.toLowerCase()){var c=document.createElement('meta');c.name='viewport',c.content='width=device-width, initial-scale=1',b.appendChild(c)}var d=document.body.style;d.all='initial',d.maxWidth='100%',d.height='100%',d.overFlow='hidden',a.style.height=window.innerHeight+'px';var e=document.body.innerText.split(String.fromCharCode(160)).join(' ').replace(/\r?\n/g,'\n').replace(/[ \t ]{2,}/g,' ').trim().replace(/\n{3,}/g,'\n\n'),f=['<textarea style="','padding: 6px;','width: 94%;','height: 100%;','font-size: 16px;','border-radius: 0;','" readonly>',e,'</textarea>'].join('');document.body.innerHTML=f})();
    */
    // minified w/ Babili
    // https://babeljs.io/repl/
    
    // beautify 4-space indent from 3-space indent
    
    (function() {
        'use strict';
    
        var html = document.documentElement || document.querySelector('html');
        var head = document.head || document.querySelector('head') ||
            html.firstElementChild;
    
        // PDFium has not head
        if (head && head.nodeName.toLowerCase() === 'head') {
            var viewport = document.createElement('meta');
            viewport.name = 'viewport';
            viewport.content = 'width=device-width, initial-scale=1';
    
            head.appendChild(viewport);
        }
    
        var bodyStyle = document.body.style;
        // XXX rough and tangled
        bodyStyle.all = 'initial';
    
        // TBD disable css and contentEditable
        //Array.prototype.forEach.call(document.styleSheets, function(sheet) {
        //    sheet.disabled = true;
        //});
    
        //bodyStyle.width = window.innerWidth + 'px';
        bodyStyle.maxWidth = '100%';
        bodyStyle.height = '100%';
        bodyStyle.overFlow = 'hidden';
    
        html.style.height = window.innerHeight + 'px';
    
        var letter = document.body.innerText
            // 160: &nbsp;
            .split(String.fromCharCode(160)).join(' ')
            .replace(/\r?\n/g,'\n')
            // include U+3000 "IDEOGRAPHIC SPACE" aka "Zenkaku Space"
            .replace(/[ \t ]{2,}/g,' ')
            .trim()
            // 3+ times linebreak -> 2 times
            .replace(/\n{3,}/g,'\n\n');
    
        // TBD heredoc func c.f.
        // https://github.com/to/tombloo/blob/d040ea4/xpi/chrome/content/library/01_utility.js#L2489
        // http://let.hatelabo.jp/noromanba/let/hJmcrJG18dRE
        var area = [
            '<textarea style="',
            'padding: 6px;',
            'width: 94%;',
            'height: 100%;',
            'font-size: 16px;',
            'border-radius: 0;',
            '" readonly>',
            letter,
            '</textarea>'
        ].join('');
    
        // TBD wrap
        //area.style.wordBreak = 'break-word';
        //area.style.whiteSpace = 'pre-wrap';
        document.body.innerHTML = area;
    
        // TBD selection
        //area.focus();
        //area.select();
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/04/29 02:18:24 - 2017-04-29
  2. 2017/04/28 09:57:20 - 2017-04-28
  3. 2017/04/28 09:56:31 - 2017-04-28