X-Git-Url: http://git.chise.org/gitweb/?p=m17n%2Fm17n-lib-js.git;a=blobdiff_plain;f=mim2.js;h=2bb2370baa69cd3484fa91611b5fe8093b4b83cd;hp=7f78838859d7eae44de7a0b86ae4f7c363134601;hb=HEAD;hpb=d64052eb9999afb5618be26c44d033cc8ce33c54 diff --git a/mim2.js b/mim2.js index 7f78838..2bb2370 100644 --- a/mim2.js +++ b/mim2.js @@ -1149,33 +1149,33 @@ MIM.im_domain.DefType (MIM.State.prototype); + (this.name != 'nil' ? this.name : this.extra_id), MIM.im_domain, null); + }; + + function load_im (node, im) + { + //alert ('Loading IM (' + im + ':' + im.lang + '-' + im.name + ')'); + im.map_list = {}; + im.initial_state = null; + im.state_list = {}; + for (node = node.firstElement (); node; node = node.nextElement ()) + { + var name = node.nodeName; + //Xex.Log ('parsing ' + name); + var parser = parsers[name]; + if (parser) + parser.call (im, node); + } + //alert ('initial state = ' + im.initial_state); + im.load_status = MIM.LoadStatus.Loaded; } - var proto = { + MIM.IM.prototype = { Load: function () { - var node = Xex.Load (MIM.server, this.file); - if (! node) - { - this.load_status = MIM.LoadStatus.Error; - return false; - } - this.map_list = {}; - this.initial_state = null; - this.state_list = {}; - for (node = node.firstElement (); node; node = node.nextElement ()) - { - var name = node.nodeName; - var parser = parsers[name]; - if (parser) - parser.call (this, node); - } - this.load_status = MIM.LoadStatus.Loaded; - return true; + this.load_status = MIM.LoadStatus.Loading; + Xex.Load (MIM.server, this.file, load_im, this); } - } - - MIM.IM.prototype = proto; + }; MIM.IC = function (im, target) { @@ -1688,11 +1688,9 @@ MIM.im_domain.DefType (MIM.State.prototype); } }; - MIM.create_list = function (node) { + MIM.create_list = function (node) + { // Load the list of input methods. - MIM.A = node; - alert ('create-list called: node=' + MIM.A); - var node = node.firstElement; for (node = node.firstChild; node; node = node.nextSibling) if (node.nodeName == 'input-method') { @@ -1726,14 +1724,17 @@ MIM.im_domain.DefType (MIM.State.prototype); } } if (MIM.imextra.t && MIM.imextra.t.global) - MIM.im_global = MIM.imextra.t.global; + { + MIM.im_global = MIM.imextra.t.global; + MIM.im_global.Load (); + } else { MIM.im_global = new MIM.IM ('t', 'nil', 'global', null); MIM.im_global.load_status = MIM.LoadStatus.Error; } - node = undefined; MIM.current = MIM.imlist['t']['latn-post']; + MIM.current.Load (); } }) (); @@ -2118,7 +2119,7 @@ MIM.keydown = function (event) if (! ic || ic.im != MIM.current) { target.mim_ic = null; - Xex.Log ('creating IC'); + Xex.Log ('creating IC for ' + MIM.current.lang + '-' + MIM.current.name); ic = new MIM.IC (MIM.current, target); if (ic.im.load_status != MIM.LoadStatus.Loaded) return true; @@ -2372,6 +2373,7 @@ MIM.keypress = function (event) if (target.im) { MIM.current = target.im; + MIM.current.Load (); destroy (); } event.preventDefault ();