From 64b68106944f8d0faf444b3989ffe8f1a389500d Mon Sep 17 00:00:00 2001
From: teramako
Date: Fri, 24 Oct 2008 17:43:25 +0000
Subject: * HTMLパースに失敗していたのを修正 * goo辞書のXPath修正 *
goo辞書のHTMLがUTF-8になったのに対応...できてないかも
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22080 d0d07461-0603-4401-acd4-de1884942a52
---
lookupDictionary.js | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
(limited to 'lookupDictionary.js')
diff --git a/lookupDictionary.js b/lookupDictionary.js
index c0ba49c..fa6d8d0 100644
--- a/lookupDictionary.js
+++ b/lookupDictionary.js
@@ -17,24 +17,23 @@ const SITE_DEFINITION = [{
dictionary: 'en-US',
},{
names: ['goo'],
- url: 'http://dictionary.goo.ne.jp/search.php?MT=%s&kind=all&mode=0',
+ url: 'http://dictionary.goo.ne.jp/search.php?MT=%s&kind=all&mode=0&IE=UTF-8',
shortHelp: 'goo 辞書',
- encode: 'EUC-JP',
- xpath: '//div[@id="incontents"]/*[@class="ch04" or @class="fs14" or contains(@class,"diclst")]',
+ xpath: 'id("incontents")/*[@class="ch04" or @class="fs14" or contains(@class,"diclst")]',
multi: true,
dictionary: 'en-US',
-},{
- names: ['infokanji'],
- url: 'http://dictionary.www.infoseek.co.jp/?sc=1&se=on&lp=0&gr=kj&sv=KJ&qt=&qty=%s&qtb=&qtk=0',
- shorthelp: 'Infoseek 漢字辞書',
- encode: 'EUC-JP',
- xpath: '//div[@class="NetDicHead"]',
},{
names: ['answers'],
url: 'http://www.answers.com/%s',
shortHelp: 'Answers.com(英英辞書)',
xpath: 'id("firstDs")',
dictionary: 'en-US',
+},{
+ names: ['wikipe[dia]'],
+ url: 'http://ja.wikipedia.org/wiki/%s',
+ shortHelp: 'Wikipedia(ja) lite',
+ xpath: 'id("bodyContent")/p[1]',
+ dictionary: 'en-US',
}];
let (siteDef = liberator.globalVariables.lookupDictionary_site_definition) {
@@ -154,7 +153,7 @@ SITE_DEFINITION.forEach(function(dictionary){
.getService( Components.interfaces.nsITextToSubURI);
url = dictionary.url.replace(/%s/g, ttbu.ConvertAndEscape(dictionary.encode, arg));
} else {
- url = dictionary.url.replace(/%s/g,encodeURI(arg));
+ url = dictionary.url.replace(/%s/g,encodeURIComponent(arg));
}
//liberator.log('URL: ' +url);
var result;
@@ -165,8 +164,8 @@ SITE_DEFINITION.forEach(function(dictionary){
liberator.echoerr('Nothing to show...');
}
var xs = new XMLSerializer();
- liberator.echo('