[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
w3m-filter-imepita
- From: Naohiro Aota <nao.aota@xxxxxxxxx>
- Date: Mon, 05 Nov 2007 06:22:23 +0900 (JST)
- X-ml-name: emacs-w3m
- X-mail-count: 09754
青田です。
つまらないパッチで恐縮ですが、イメぴた(http://imepita.jp/)の画像ページ
をうまく表示する filter を書いてみました。
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3072
diff -u -r1.3072 ChangeLog
--- ChangeLog 3 Nov 2007 04:01:22 -0000 1.3072
+++ ChangeLog 4 Nov 2007 20:46:05 -0000
@@ -1,3 +1,8 @@
+2007-11-05 Naohiro Aota <nao.aota@xxxxxxxxx>
+
+ * w3m-filter.el (w3m-filter-rules): Add rule for the site of imepita.
+ (w3m-filter-imepita): New function.
+
2007-11-03 David Hansen <david.hansen@xxxxxxx>
* w3m.el (w3m-relationship-oddmuse-estimate): Follow new page layout.
Index: w3m-filter.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-filter.el,v
retrieving revision 1.31
diff -u -r1.31 w3m-filter.el
--- w3m-filter.el 17 Oct 2007 11:15:57 -0000 1.31
+++ w3m-filter.el 4 Nov 2007 20:46:05 -0000
@@ -56,7 +56,8 @@
w3m-filter-amazon)
("\\`http://mixi\\.jp" w3m-filter-mixi)
("\\`http://eow\\.alc\\.co\\.jp/[^/]+/UTF-8" w3m-filter-alc)
- ("\\`http://www\\.asahi\\.com/" w3m-filter-asahi-shimbun))
+ ("\\`http://www\\.asahi\\.com/" w3m-filter-asahi-shimbun)
+ ("\\`http://imepita\\.jp/[0-9]+/[0-9]+" w3m-filter-imepita))
"Rules to filter advertisements on WEB sites."
:group 'w3m
:type '(repeat
@@ -303,4 +304,16 @@
;; (if (string-match "\\Cj" cword) "JE" "EJ"))))
))))
+(defun w3m-filter-imepita (url)
+ "JavaScript emulation."
+ (goto-char (point-min))
+ (let (tmp)
+ (when (re-search-forward
+ (concat "<script><!--\ndocument.write('\\([^\n]*\\)');\r\n//--></script>\n"
+ "<noscript>.*</noscript>")
+ nil t)
+ (setq tmp (match-string 1))
+ (delete-region (match-beginning 0) (match-end 0))
+ (insert tmp))))
+
;;; w3m-filter.el ends here