// ==UserScript==
// @name 【スマホ用】プレーンテキストでコピペしたい。
// @description サイト上のテキスト書式をリセットします。
// @include http://*
// ==/UserScript==
/*
* @title 【スマホ用】プレーンテキストでコピペしたい。
* @description サイト上のテキスト書式をリセットします。
* @include http://*
* @license MIT License
* @require
@private
iPhone Safariで確認。見切り発車。 
*/
(function(){
var body=document.body.innerText
.replace(/\r?\n/g,'\n') //改行コードを統一
.replace(/[ \t ]{2,}/g,' ') //[¥tなど]の連続をSPACE一つにまとめる
.replace(/\t\n/g,'\n') //¥t対応
.replace(/[ \t ]\n/g,'\n') //[¥tなど]+改行コードを ¥n とする
.replace(/\n{3,}/g,'\n\n'); //¥nの3つ以上の連続を ¥n¥n とする
//css
var bodyStyle=document.getElementsByTagName('body')[0].style;
bodyStyle.all='initial';//reset
bodyStyle.width='100%';
bodyStyle.height='100%';
bodyStyle.overFlow='hidden';
document.getElementsByTagName('html')[0].style.width=window.innerWidth+'px';
document.getElementsByTagName('html')[0].style.height=window.innerHeight+'px';
body='';
document.body.innerHTML=body;
document.getElementsByTagName('textarea')[0].style.width=(window.innerWidth-20)+'px';
})()
/*
javascript:(function(){var%20b=document.body.innerText;b=b.replace(/\n{3,}/g,"\n\n").replace(/[%20\t%E3%80%80]\n/g,"\n").replace(/[%20\t%E3%80%80]{2,}/g,"%20").replace(/\r?\n/g,"\n");var%20a=document.getElementsByTagName("body")[0].style;a.all="initial";a.width="100%25";a.height="100%25";a.overFlow="hidden";document.getElementsByTagName("html")[0].style.width=window.innerWidth+"px";document.getElementsByTagName("html")[0].style.height=window.innerHeight+"px";b='";document.body.innerHTML=b;document.getElementsByTagName("textarea")[0].style.width=(window.innerWidth-20)+"px"})();
*/
/*
javascript:(function(){var body=document.body.innerText .replace(/\r?\n/g,'\n').replace(/[ ]{2,}/g,' ').replace(/\t\n/g,'\n').replace(/ \n/g,'\n').replace(/\n{3,}/g,'\n\n');var bodyStyle=document.getElementsByTagName('body')[0].style;bodyStyle.all='initial';bodyStyle.width='100%';bodyStyle.height='100%';bodyStyle.overFlow='hidden';document.getElementsByTagName('html')[0].style.width=window.innerWidth+'px';document.getElementsByTagName('html')[0].style.height=window.innerHeight+'px';body='';document.body.innerHTML=body;document.getElementsByTagName('textarea')[0].style.width=(window.innerWidth-20)+'px';})()
*/