Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Andris Reinman committed Feb 14, 2012
1 parent 0dc5bf7 commit d03726a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion article-fetch.js
Expand Up @@ -50,7 +50,6 @@ genFName.counter = 0;


function sanitizeHTML(html){

html = html.trim().
replace(/\r?\n|\r/g, "\u0000").
replace(/<(div|p|ul|li|h1|h2|h3|h4|h5)>[\s\u0000]*(<br>[\s\u0000]*)*/g, "<$1>").
Expand Down
11 changes: 9 additions & 2 deletions static/bifocal/inject.js
Expand Up @@ -100,16 +100,21 @@ function __PHANTOM_RESPONSE(){
}else if(href.match(/^https?\:\/\/[a-z\.\-]+\/teemalehed\//i)){
// delfi teemalehed
elements[i].removeAttribute(attr);
}else{
elements[i].href = href;
}

// pildid
}else if(elements[i].tagName == "IMG"){
if(attr.toLowerCase() == "alt"){
// keep
}else if(attr.toLowerCase() == "src"){
if((elements[i].src || "").toString().trim().match(/^(javascript|about)\s*\:/)){
var src = (elements[i].src || "").toString().trim();
if(src.match(/^(javascript|about)\s*\:/)){
elements[i].removeAttribute(attr);
};
}else{
elements[i].src = src;
}
}else{
elements[i].removeAttribute(attr);
}
Expand All @@ -121,5 +126,7 @@ function __PHANTOM_RESPONSE(){
}
}
}


}
}

0 comments on commit d03726a

Please sign in to comment.