diff options
author | mattn | 2008-04-18 10:02:46 +0000 |
---|---|---|
committer | mattn | 2008-04-18 10:02:46 +0000 |
commit | 987a50ab1f22b8da26968731e9e0bea6663ea4b0 (patch) | |
tree | 96fd7979101c71f51fe7c1f93cc0194a69850274 | |
parent | 3cfb22fb97c1c7fb83f76399381f413b0d276c6f (diff) | |
download | vimperator-plugins-987a50ab1f22b8da26968731e9e0bea6663ea4b0.tar.bz2 |
lang/javascript/vimperator-plugins/trunk/direct_bookmark.js:
* いかんいかん。ちゃんと書こう!私
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@9697 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | direct_bookmark.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/direct_bookmark.js b/direct_bookmark.js index ebf72a2..c809e0a 100644 --- a/direct_bookmark.js +++ b/direct_bookmark.js @@ -137,8 +137,11 @@ // copied from Pagerization (c) id:ofk
function parseHTML(str, ignore_tags){
str = str.replace(/^[\s\S]*?<html(?:\s[^>]+?)?>|<\/html\s*>[\S\s]*$/ig, '');
- if (ignore_tags && ignore_tags instanceof Array)
- str = str.replace(new RegExp('<' + ignore_tags.join('[^>]+?>|<') + '[^>]+?>', 'ig'), '');
+ if (ignore_tags && ignore_tags instanceof Array) {
+ ignore_tags.forEach(function(t) {
+ str = str.replace(new RegExp('<' + t + '(?:\\s[^>]+?)?>|<\\/' + t + '\\s*>', 'ig'), '');
+ });
+ }
var res = document.implementation.createDocument(null, 'html', null);
var range = document.createRange();
range.setStartAfter(window.content.document.body);
@@ -255,7 +258,7 @@ xhr.open("GET","http://b.hatena.ne.jp/my",false);
xhr.send(null);
- var mypage_html = parseHTML(xhr.responseText, ['img']);
+ var mypage_html = parseHTML(xhr.responseText, ['img', 'script']);
var tags = getElementsByXPath("//ul[@id=\"taglist\"]/li/a",mypage_html);
tags.forEach(function(tag){
|