var pclass = 'reader-word-layer';
var pparts = [];
var pdoc = '';
function getDoc() {
pdoc = '';
pparts = document.querySelectorAll('.'+pclass);
pparts.forEach(function (item) {
pdoc += item.innerHTML
});
pdoc = pdoc.replace(/<.*?>/g,'').replace(/ /g,' ');
var win = window.open();
win.document.write("<pre>"+pdoc+"</pre>");
}
var style = "-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none; -webkit-box-shadow: 1px 2px 10px #00000022;-moz-box-shadow: 1px 2px 10px #00000022;box-shadow: 1px 2px 10px #00000022;outline:none; padding: 0 30px; border-radius: 15px; z-index: 9999;position: fixed;top: 30px;left: 30px;border: 5px solid #78C941;line-height: 4rem;font-size: 2rem;font-weight: bold;text-align: center;background-color: #fff;";
var href = "data:text/plain;charset=utf-8," + encodeURIComponent(pdoc);
var downA = document.createElement('button');
var downText = document.createTextNode('新标签页中打开文档');
downA.setAttribute('onclick', 'getDoc()');
downA.setAttribute('id', 'downloadA');
downA.setAttribute('style', style);
downA.appendChild(downText);
document.body.appendChild(downA);
免费获取百度文库内容
最新推荐文章于 2021-01-07 10:20:20 发布