Skip to content

Commit f30e075

Browse files
committed
fix
1 parent f446daf commit f30e075

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

DownloadAllContent/DownloadAllContent.user.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
function getPageContent(doc){
107107
if(!doc)return i18n.error;
108108
var i,j,k,rStr="",pageData=(doc.body?doc.body:doc).cloneNode(true),delList=[];
109-
[].forEach.call(pageData.querySelectorAll("script,style,link"),function(item){delList.push(item);});
109+
[].forEach.call(pageData.querySelectorAll("script,style,link,img"),function(item){delList.push(item);});
110110
[].forEach.call(delList,function(item){item.parentNode.removeChild(item);});
111111
var largestContent,contents=pageData.querySelectorAll("span,div,article,p,td");
112112
for(i=0;i<contents.length;i++){
@@ -116,6 +116,11 @@
116116
if((item.nodeType==3 && /^\s*$/.test(item.data)) || (item.tagName=="FONT" && item.className=="jammer") || (item.style && item.style.display=="none"))
117117
item.parentNode.removeChild(item);
118118
}
119+
for(j=content.childNodes.length-1;j>=0;j--){
120+
item=content.childNodes[j];
121+
if(item.nodeType==1 && /^\s*$/.test(item.innerHTML))
122+
item.parentNode.removeChild(item);
123+
}
119124
[].forEach.call(content.childNodes,function(item){
120125
if(item.nodeType==3 && item.data && !/^\s*$/.test(item.data))
121126
hasText=true;

0 commit comments

Comments
 (0)