From 9fcc205cb53d42fd978538cdd10c62fe77cb576b Mon Sep 17 00:00:00 2001 From: janus_wel Date: Sat, 27 Sep 2008 03:48:36 +0000 Subject: add dictionary property to SITE_DEFINITION. remove the variable "g:lookupDictionary_dictionary". switch over dictionary by site definition. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@20024 d0d07461-0603-4401-acd4-de1884942a52 --- lookupDictionary.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'lookupDictionary.js') diff --git a/lookupDictionary.js b/lookupDictionary.js index 8e69540..20cb00d 100644 --- a/lookupDictionary.js +++ b/lookupDictionary.js @@ -13,25 +13,28 @@ const SITE_DEFINITION = [{ names: ['eiji[ro]'], url: 'http://eow.alc.co.jp/%s/UTF-8/', shortHelp: 'SPACE ALC (英辞郎 on the Web)', - xpath: 'id("resultList")' + xpath: 'id("resultList")', + dictionary: 'en-US', },{ names: ['goo'], url: 'http://dictionary.goo.ne.jp/search.php?MT=%s&kind=all&mode=0', shortHelp: 'goo 辞書', encode: 'EUC-JP', xpath: '//div[@id="incontents"]/*[@class="ch04" or @class="fs14" or contains(@class,"diclst")]', - multi: true + 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"]' + xpath: '//div[@class="NetDicHead"]', },{ names: ['answers'], url: 'http://www.answers.com/%s', shortHelp: 'Answers.com(英英辞書)', - xpath: 'id("firstDs")' + xpath: 'id("firstDs")', + dictionary: 'en-US', }]; // class definition @@ -77,7 +80,14 @@ SpellChecker.prototype = { * @param {String} dict */ setDictionary: function (dict) { - this.engine.dictionary = dict; + var dictionaries = this.getDictionaryList() + for (var i=0, max=dictionaries.length ; i