/*
* @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
*/
// beautify 4-space indent from 3-space indent
(function() {
'use strict';
var head = document.head || document.querySelector('head') ||
document.documentElement.firstElementChild;
// PDFium has not head
if (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';
var html = document.documentElement || document.querySelector('html');
html.style.height = window.innerHeight + 'px';
var letter = document.body.innerText
// 160:
.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');
var area = [
'',
].join('');
// TBD wrap
//area.style.wordBreak = 'break-word';
//area.style.whiteSpace = 'pre-wrap';
document.body.innerHTML = area;
// TBD selection
//area.focus();
//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=['"].join("");document.body.innerHTML=d})();
*/