From 7c9961bca2d27baa4f475f86d9cd2c61721eac01 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 19 Mar 2010 13:16:48 +0000 Subject: [PATCH] *** empty log message *** --- Makefile | 10 +++++++--- index.html | 11 ++++++++++- mim.js | 11 ++++++----- xex.js | 3 ++- 4 files changed, 25 insertions(+), 10 deletions(-) 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); } -- 1.7.10.4