From: handa Date: Thu, 25 Mar 2010 00:01:47 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ALPHA~3 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74f5ef5f5a1c7e1a1bb94a94883f85cd4ac43765;p=m17n%2Fm17n-lib-js.git *** empty log message *** --- diff --git a/mim2.js b/mim2.js index 7f78838..3df31e3 100644 --- a/mim2.js +++ b/mim2.js @@ -1051,6 +1051,7 @@ MIM.im_domain.DefType (MIM.State.prototype); var vname = node.attributes['vname'].nodeValue; if (this != MIM.im_global) { + alert ("getting global var of vname:"+vname); var vari = get_global_var (vname); if (vari != null) this.domain.Defvar (vname, vari.desc, vari.val, vari.range); @@ -1149,33 +1150,28 @@ MIM.im_domain.DefType (MIM.State.prototype); + (this.name != 'nil' ? this.name : this.extra_id), MIM.im_domain, null); - } + }; - var proto = { - 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; - } + function load_im (node) + { + 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; } - MIM.IM.prototype = proto; + MIM.IM.prototype.Load = function () + { + this.load_status = MIM.LoadStatus.Loading; + Xex.Load (MIM.server, this.file, load_im); + } MIM.IC = function (im, target) { @@ -1688,11 +1684,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,7 +1720,10 @@ 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); @@ -1734,6 +1731,7 @@ MIM.im_domain.DefType (MIM.State.prototype); } node = undefined; MIM.current = MIM.imlist['t']['latn-post']; + MIM.current.Load (); } }) (); @@ -2372,6 +2370,7 @@ MIM.keypress = function (event) if (target.im) { MIM.current = target.im; + MIM.current.Load (); destroy (); } event.preventDefault (); diff --git a/xex2.js b/xex2.js index 144e9af..0d6ceb1 100644 --- a/xex2.js +++ b/xex2.js @@ -1367,17 +1367,18 @@ Xex.Load = function (server, file, callback) var iframe = document.createElement ('iframe'); function receiver (event) { - alert ('receiver called:'+event.data); + //alert ('receiver called:'+event.data); var parser = new DOMParser (); var xml = parser.parseFromString (event.data, 'text/xml'); + //alert ('parsed:'+xml); window.removeEventListener ('message', receiver, false); body.removeChild (iframe); - callback (xml); + callback (xml.firstElement ()); }; Xex.xml = undefined; window.addEventListener ('message', receiver, false); iframe.src = server + '/loadxml.html#' + file; - alert ('iframe created'); + //alert ('iframe created'); body.appendChild (iframe); };