From: handa Date: Fri, 19 Mar 2010 13:16:48 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ALPHA~9 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c9961bca2d27baa4f475f86d9cd2c61721eac01;p=m17n%2Fm17n-lib-js.git *** empty log message *** --- diff --git a/Makefile b/Makefile index 87057c3..58383c4 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,20 @@ DIST=/project/web/extra/m17n-lib/mim-js/ -FILES=index.html latn-post.js mim.js th-kesmanee.js +FILES=index.html test.html imlist.xml xex.js mim.js /usr/local/work/m17n-db-xml/MIM/*.mimx upload: @updated=""; \ for f in ${FILES}; do \ - if [ ! -f ${DIST}/$$f -o $$f -nt ${DIST}/$$f ] ; then \ + base=`basename $$f`; \ + if [ ! -f "${DIST}/$$base" ] ; then \ + echo $$f; \ + cp $$f ${DIST}; \ + updated="1"; \ + elif [ "$$f" -nt "${DIST}/$$base" ] ; then \ echo $$f; \ cp $$f ${DIST}; \ updated="1"; \ fi; \ done; \ if [ -n "$$updated" ] ; then \ - echo $$updated; \ cd /project/web/source/m17n-lib; make; \ fi diff --git a/index.html b/index.html index afc7707..ab298ae 100644 --- a/index.html +++ b/index.html @@ -87,7 +87,9 @@ -

m17n-lib input method in Javascript

+

m17n-lib input method in Javascript (tested only on Chrome)

+The default input method is latn-post. +Click an input area by Control-Mouse-1 to select any other input method.
textarea
text
@@ -97,6 +99,13 @@ down0 press0 + diff --git a/mim.js b/mim.js index 5dac255..26c978f 100644 --- a/mim.js +++ b/mim.js @@ -51,6 +51,9 @@ var MIM = { } }; +if (window.location == 'http://localhost/mim/index.html') + MIM.server = 'http://localhost/mim'; + (function () { var keysyms = new Array (); keysyms["bs"] = "backspace"; @@ -1125,7 +1128,7 @@ MIM.im_domain.DefType (MIM.State.prototype); var proto = { Load: function () { - var node = Xex.Load (null, this.file); + var node = Xex.Load (MIM.server, this.file); if (! node) { this.load_status = MIM.LoadStatus.Error; @@ -1661,7 +1664,7 @@ MIM.im_domain.DefType (MIM.State.prototype); MIM.IC.prototype = proto; - var node = Xex.Load (null, "imlist.xml"); + var node = Xex.Load (MIM.server, "imlist.xml"); for (node = node.firstChild; node; node = node.nextSibling) if (node.nodeName == 'input-method') { @@ -2394,8 +2397,6 @@ MIM.keypress = function (event) MIM.add_event_listener (window, 'keydown', MIM.keydown); MIM.add_event_listener (window, 'keypress', MIM.keypress); MIM.add_event_listener (window, 'mousedown', create_menu); - if (window.location == 'http://localhost/mim/index.html') - MIM.server = 'http://localhost/mim'; - MIM.current = MIM.imlist['zh']['py-gb']; + MIM.current = MIM.imlist['t']['latn-post']; }; }) (); diff --git a/xex.js b/xex.js index 932d240..c0ba885 100644 --- a/xex.js +++ b/xex.js @@ -1302,8 +1302,9 @@ Xex.Load = function (server, file) { var obj = new XMLHttpRequest (); var url = server ? server + '/' + file : file; + //alert ('loading ' + url); obj.open ('GET', url, false); obj.overrideMimeType ('text/xml'); obj.send (''); - return obj.responseXML.firstChild; + return (obj.responseXML && obj.responseXML.firstChild); }