Epub阅读器0.0.1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
(function(){
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var meta = document.createElement('meta');
|
||||
meta.name = "viewport";
|
||||
meta.content = "width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no";
|
||||
head.appendChild(meta);
|
||||
|
||||
var children = document.body.children;
|
||||
var titleFounded = false;
|
||||
for(var i = 0; i < children.length; i++){
|
||||
var child = children[i]
|
||||
var tagName = child.tagName.toLowerCase()
|
||||
// 隐藏标题前的空段落
|
||||
if(!child.textContent){
|
||||
child.style.display = "none";
|
||||
}else if(titleFounded){
|
||||
// 如果找到标题了,那么遇到第一个不为空的短路,就不再处理了
|
||||
break
|
||||
}
|
||||
// 隐藏标题
|
||||
if(tagName === 'h1' || tagName === 'h2' || tagName === 'h3'){
|
||||
child.style.display = "none"
|
||||
titleFounded = true
|
||||
}
|
||||
}
|
||||
})()
|
||||
Reference in New Issue
Block a user