Created
July 12, 2012 07:57
-
-
Save tiye/3096543 to your computer and use it in GitHub Desktop.
36 拼音很早时候的 demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body{ | |
| font-size:28px; | |
| background:rgba(200,200,255,1);} | |
| textarea{ | |
| padding:20px; | |
| font-size:28px; | |
| width:600px; | |
| float:left; | |
| height:600px;} | |
| nav{ | |
| padding:20px; | |
| float:left;} | |
| section{ | |
| padding:100px 20px;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <link rel="stylesheet"href="36.css"/> | |
| <script src="36.js"></script> | |
| </head> | |
| <body> | |
| <textarea id="text">这是一段演示三十六输入法码表拼音三键一字的视频 | |
| </textarea> | |
| <nav id="nav">nav</nav> | |
| <section> | |
| XFF CVA KBA HFB | |
| <br/> | |
| KMB CAV | |
| <br/> | |
| BZB CXA G,V VZA AMS | |
| <br/> | |
| ACS SDC SGN KBN | |
| <br/> | |
| BZB KFB KBA NFA | |
| <br/> | |
| FAF CVA SHN | |
| </section> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onload=start; | |
| function start(){ | |
| var all_keys=[65,83,68,70,71,72,74,75,90,88,67,86,66,78,77,188,8]; | |
| console.log(all_keys.length); | |
| var the_string=[]; | |
| var text=document.getElementById('text'); | |
| console.log(text); | |
| var nav=document.getElementById('nav'); | |
| document.onkeydown=get_key; | |
| function get_key(event){ | |
| var place=all_keys.indexOf(event.keyCode); | |
| if(place>=0){ | |
| if(place==16){ | |
| text.value=text.value.slice(0,-1);} | |
| else{ | |
| send(place);}}} | |
| function send(place){ | |
| the_string.push(place); | |
| nav.innerHTML=the_string; | |
| if(the_string.length==3){ | |
| deal(the_string); | |
| the_string=[];}} | |
| function deal(the_string){ | |
| text.value+=look(the_string);}} | |
| function look(arr){ | |
| var t=[0,0,0,0,0]; | |
| console.log('arr',arr); | |
| var sheng=[ | |
| ['b', 'p', 'm', 'f'], | |
| ['d', 't', 'n', 'l'], | |
| ['g', 'k', 'h', '\''], | |
| ['zh','ch', 'sh', 'r'], | |
| ['z', 'c', 's', '*']]; | |
| var yun=[ | |
| ['y', 'i', 'u'], //a | |
| ['a', 'ia', 'ua'], //s | |
| ['o', 'io', 'uo'], //d | |
| ['e', 'ie', 've'], //f | |
| ['ang', 'iang', 'uang'], //g | |
| ['eng', 'ing', 'ueng'], //h | |
| ['ong', 'iong', '*'], //j | |
| ['van', 'v', 'vn'], //k | |
| ['ai', 'er', 'uai'], //z | |
| ['ei', '*', 'ui'], //x | |
| ['ao', 'iao', '*'], //c | |
| ['ou', 'iu', '*'], //v | |
| ['an', 'ian', 'uan'], //b | |
| ['en', 'in', 'un'], //n | |
| ['*', '*', '*'], //m | |
| ['*', '*', '*']]; //, | |
| var diao=['1','2','3','4']; | |
| t[4]=arr[1]%4; | |
| t[0]=Math.floor(arr[1]/4); | |
| t[3]=arr[2]; | |
| t[1]=arr[0]%3; | |
| t[2]=Math.floor(arr[0]/3); | |
| console.log(t); | |
| var str=sheng[t[2]][t[0]]+yun[t[3]][t[1]]+'\''+diao[t[4]] | |
| console.log(str); | |
| return str+',';} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment