From: handa Date: Sat, 23 Jan 2010 02:23:29 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: before-ns X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71f034e3c700f8d6467365cfabaf7ac9075e25ba;p=m17n%2Fm17n-lib-js.git *** empty log message *** --- diff --git a/Makefile b/Makefile index 40d4336..87057c3 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ -DIST1=/var/www/mim -DIST2=/project/web/extra/m17n-lib/mim-js/ +DIST=/project/web/extra/m17n-lib/mim-js/ FILES=index.html latn-post.js mim.js th-kesmanee.js upload: + @updated=""; \ for f in ${FILES}; do \ - if [ ! -f ${DIST1}/$$f -o $$f -nt ${DIST1}/$$f ] ; then \ + if [ ! -f ${DIST}/$$f -o $$f -nt ${DIST}/$$f ] ; then \ echo $$f; \ - cp $$f ${DIST1}; \ - cp $$f ${DIST2}; \ + cp $$f ${DIST}; \ + updated="1"; \ fi; \ - done - cd /project/web/source/m17n-lib; make + done; \ + if [ -n "$$updated" ] ; then \ + echo $$updated; \ + cd /project/web/source/m17n-lib; make; \ + fi diff --git a/index.html b/index.html index 2dc8d9f..f9b114d 100644 --- a/index.html +++ b/index.html @@ -12,15 +12,18 @@ - - + +

m17n-lib input method in Javascript

+

textarea

+

text

+

+

debug Info

downpressstatuskeyseqrange
00

-
diff --git a/latn-post.js b/latn-post.js index 156ad92..fb6df0b 100644 --- a/latn-post.js +++ b/latn-post.js @@ -1,4 +1,3 @@ -//alert ("loading... latin-post"); im = MIM_find ('latin', 'post'); im.load_mapdef ({ " _":" ", diff --git a/mim.js b/mim.js index d206d76..22672f9 100644 --- a/mim.js +++ b/mim.js @@ -6,6 +6,8 @@ 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 (); @@ -133,8 +135,7 @@ function MIM_load (im) s.charset = 'UTF-8'; s.src = filename; document.body.appendChild (s); - alert (s.innerText); - //document.body.removeChild (s); + document.body.removeChild (s); im.status = 2; return im; } @@ -195,12 +196,14 @@ function MIM_decode_key (event) function debug_print (event, ic) { + if (! MIM_debug) + return; var target = event.target; var code = event.keyCode; - var char = event.type == 'keydown' ? "?" : event.charCode; + var ch = event.type == 'keydown' ? "-none-" : event.charCode; var key = MIM_decode_key (event); - document.getElementById (event.type).innerHTML = "" + code + "/" + char + " : " + key; + document.getElementById (event.type).innerHTML = "" + code + "/" + ch + " : " + key; document.getElementById ('status').innerHTML = ic.im.status; var keyseq = ""; for (var i = 0; i < ic.keyseq.length; i++) @@ -333,7 +336,7 @@ function MIM_handle_keyseq (event, ic) ic.reset (); event.preventDefault (); //document.getElementById ('text').value - //= keyseq_string (ic.keyseq) + " handled"; + //= keyseq_string (ic.keyseq) + " handled"; } else if (map > 0) { @@ -350,8 +353,8 @@ function MIM_handle_keyseq (event, ic) else { ic.reset (); - document.getElementById ('text').value - = keyseq_string (ic.keyseq) + " unhandled"; + //document.getElementById ('text').value + //= keyseq_string (ic.keyseq) + " unhandled"; } } @@ -472,5 +475,13 @@ function MIM_init () MIM_add_event_listener (window, 'keydown', MIM_keydown); MIM_add_event_listener (window, 'keypress', MIM_keypress); MIM_add_event_listener (window, 'mousedown', MIM_select_menu); + if (window.location == 'http://localhost/mim/index.html') + MIM_url = 'http://localhost/mim'; MIM_load (MIM_current_im); } + +function MIM_init_debug () +{ + MIM_debug = true; + MIM_init (); +}