ブックマークレット
v2
javascript: t25348709 = [...document.querySelectorAll("table")].map(table=>{return [...table.querySelectorAll("tr")].map(tr=>{return "|" + [...tr.querySelectorAll("th,td")].map(cell=>{if(cell.tagName==="TH") {return "*"+cell.textContent.replaceAll("\n","").trim()+" ";}return cell.textContent.replaceAll("\n","").trim()+" ";}).join("|");}).join("\n");}).join("\n\n");if(navigator.clipboard) {navigator.clipboard.writeText(t25348709).then(()=>{alert("Table is copied");}).catch(error=>{alert("Copy failed: \n\t"+error);});} else {alert(t25348709)}
v1
javascript: navigator.clipboard.writeText( [...document.querySelectorAll("table")].map(table=>{ return [...table.querySelectorAll("tr")].map(tr=>{ return "|" + [...tr.querySelectorAll("th,td")].map(cell=>{ if(cell.tagName==="TH") { return "*"+cell.textContent.replaceAll("\n","").trim()+" "; } return cell.textContent.replaceAll("\n","").trim()+" "; }).join("|"); }).join("\n"); }).join("\n\n") ).then(()=>{ alert("Table is copied"); }).catch(error=>{ alert("Copy failed: \n\t"+error); });
スクリプト
t25348709 = [...document.querySelectorAll("table")].map(table=>{
return [...table.querySelectorAll("tr")].map(tr=>{
return "|" + [...tr.querySelectorAll("th,td")].map(cell=>{
if(cell.tagName==="TH") {
return "*"+cell.textContent.replaceAll("\n","").trim()+" ";
}
return cell.textContent.replaceAll("\n","").trim()+" ";
}).join("|");
}).join("\n");
}).join("\n\n");
if(navigator.clipboard) {
navigator.clipboard.writeText(t25348709).then(()=>{
alert("Table is copied");
}).catch(error=>{
alert("Copy failed: \n\t"+error);
});
} else {
alert(t25348709)
}