From: handa Date: Wed, 3 Mar 2010 12:04:55 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ALPHA~34 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49a1ef8c80704e2948fd68cf748780b03b907a5d;p=m17n%2Fm17n-lib-js.git *** empty log message *** --- diff --git a/xex.js b/xex.js index 69c58f2..e386132 100644 --- a/xex.js +++ b/xex.js @@ -3025,10 +3025,89 @@ MIM.keypress = function (event) return; }; +MIM.Lang = { + European: new Array ('de', 'fr'), + MiddleEast: new Array ('ar', 'he'), + SouthAsia: new Array ('hi'), + SouthEastAsia: new Array ('th'), + EastAsia: new Array ('ja', 'zh'), + Other: new Array () +}; + +// Other +// am +// ath +// bla +// cr +// el +// eo +// iu +// nsk +// oj + +// Middle Eastern +// ar +// dv +// fa +// he +// hi +// kk +// ps +// ug +// yi* + +// South Asian +// as +// bn +// bo +// gu +// kn +// ks +// ml +// mr +// ne +// or +// pa +// sd +// sa +// si +// ta +// te +// ur + +// European +// cs +// da +// eo +// fr +// hr +// hy +// kk +// ru +// sk +// sr +// sv +// vi* +// yi* + +// East Asian +// ii +// ja +// ko +// zh + +// SouthEast Asian +// km +// lo +// my +// tai +// th +// vi* + MIM.select_im = function (event) { var target = event.target.parentNode; - while (target.tagName != "SELECT") + while (target.tagName != "mim-select-im") target = target.parentNode; var idx = 0; var im = false; @@ -3050,7 +3129,7 @@ MIM.select_im = function (event) MIM.destroy_menu = function (event) { - if (event.target.tagName == "SELECT") + if (event.target.tagName == "mim-select-im") document.getElementsByTagName ('body')[0].removeChild (event.target); }; @@ -3099,30 +3178,55 @@ MIM.select_menu = function (event) return; if (! menu) { - menu = document.createElement ('select'); + menu = document.createElement ('ul'); + menu.style.margin = '0'; + menu.style.padding = '0'; + menu.id = 'mim-select-im'; menu.onclick = MIM.select_im; menu.onmouseout = MIM.destroy_menu; menu.style.position='absolute'; menu.style.left = (event.clientX - 10) + "px"; menu.style.top = (event.clientY - 10) + "px"; + menu.style['border-bottom'] = '1px solid #ccc'; + menu.style['background-color'] = 'white'; menu.target = target; var idx = 0; for (var lang in MIM.imlist) { - var sub = document.createElement ('option'); - sub.appendChild (document.createTextNode ('+ ' + lang)); + var li = document.createElement ('li'); + li.style.position = 'relative'; + li.style['list-style']= 'none'; + li.style.margin = '0'; + li.style.padding = '0'; + li.onmouseover = function () + { + this.style.backgroundColor = 'yellow'; + var children = this.getElementsByTagName ('ul'); + for (var i = children.length - 1; i >= 0; i--) + children[i].display = 'block'; + }; + li.onmouseout = function () { this.style.backgroundColor = 'white'; }; + li.appendChild (document.createTextNode (lang)); + var sub = document.createElement ('ul'); + sub.style.position = 'absolute'; + sub.style.top = '0px'; + sub.style.display = 'none'; + li.appendChild (sub); for (var name in MIM.imlist[lang]) { - var option = document.createElement ('option'); - var imname = ' ' + lang + "-" + name; - option.appendChild (document.createTextNode (imname)); - option.value = imname; - sub.appendChild (option); + var sub_li = document.createElement ('li'); + var imname = ' ' + lang + "-" + name; + sub_li.style.position = 'absolute'; + sub_li.style.top = '0px'; + sub_li.style['list-style']= 'none'; + sub_li.style.display = 'none'; + sub_li.appendChild (document.createTextNode (imname)); + sub.appendChild (sub_li); if (MIM.imlist[lang][name] == MIM.current) menu.selectedIndex = idx; idx++; } - menu.appendChild (sub); + menu.appendChild (li); } menu.size = idx; }