From 60bc2b3e3f3ddddfb97a81ea619d88d73fbef37f Mon Sep 17 00:00:00 2001 From: handa Date: Sat, 23 Jan 2010 09:02:43 +0000 Subject: [PATCH] *** empty log message *** --- mim.js | 84 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/mim.js b/mim.js index 22672f9..0702a47 100644 --- a/mim.js +++ b/mim.js @@ -1,32 +1,29 @@ // -* coding: utf-8; -* -/* URL to scan JavaScript files defining MIM (M17N Input Method). */ -var MIM_url = "http://www.m17n.org/common/mim-js"; - -/* Boolean flag to tell if MIM is active or not. */ -var MIM_enabled = true; - -var MIM_debug = false; - -var MIM_current_im; - -var MIM_list = new Array (); - -function M17N_im (url, lang, name) +var MIM = function () { - this.status = 0; /* 0: not-yet-loaded, 1:loading, 2:loaded, -1:error */ - this.url = url; - this.lang = lang; - this.name = name; - this.keymap = false; - - function add_keystring (map, keystring, str) + var server = "http://www.m17n.org/common/mim-js", + /* Boolean flag to tell if MIM is active or not. */ + var enabled = true; + /* Boolean flag to tell if MIM is running in debug mode or not. */ + var debug = false; + var current_im = false; + + function im (lang, name, filename) { - var i, c; - var newmap; - var intermediate_string = ""; + this.status = 0; /* 0: not-yet-loaded, 1:loading, 2:loaded, -1:error */ + this.url = server + "/" + filename; + this.lang = lang; + this.name = name; + this.keymap = false; + + function add_keystring (map, keystring, str) + { + var i, c; + var newmap; + var intermediate_string = ""; - for (i = 0; i < keystring.length; i++) + for (i = 0; i < keystring.length; i++) { c = keystring.charAt (i); if (c in map) @@ -47,35 +44,38 @@ function M17N_im (url, lang, name) map['_target_text'] = intermediate_string; } } - map['_target_text'] = str; - } + map['_target_text'] = str; + } - function lookup_keyseq (keyseq, limit) - { - var map = this.keymap; + function lookup_keyseq (keyseq, limit) + { + var map = this.keymap; - if (limit > keyseq.length) - limit = keyseq.length; - for (var i = 0; i < limit; i++) + if (limit > keyseq.length) + limit = keyseq.length; + for (var i = 0; i < limit; i++) { var c = keyseq[i]; if (! (c in map)) return i; map = map[c]; } - return map; - } + return map; + } - function load_map (mapdef) - { - this.keymap = new Array (); - for (var keystring in mapdef) - add_keystring (this.keymap, keystring, mapdef[keystring]); + function load_map (mapdef) + { + this.keymap = new Array (); + for (var keystring in mapdef) + add_keystring (this.keymap, keystring, mapdef[keystring]); + } + + this.load_mapdef = load_map; + this.lookup = lookup_keyseq; } - this.load_mapdef = load_map; - this.lookup = lookup_keyseq; -} + return { } +} (); function MIM_register (url, lang, name) { -- 1.7.10.4