Advertisement
BrU32

JS Morse Code Start SRC

Oct 16th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. <script>
  2. function encdec(str){
  3. var out1=str;
  4. if(str=="A"){
  5. out1='11';
  6. document.writeln(out1);
  7. }
  8. if(str=="B"){
  9. out1='1423';
  10. document.writeln(out1);
  11. }
  12. if(str=="C"){
  13. out1='234';
  14. document.writeln(out1);
  15. }
  16. if(str=="D"){
  17. out1='111';
  18. document.writeln(out1);
  19. }
  20. if(str=="E"){
  21. out1='23';
  22. document.writeln(out1);
  23. }
  24. if(str=="F"){
  25. out1='1114'
  26. document.writeln(out1);
  27. }
  28. if(str=="G"){
  29. out1='1142'
  30. document.writeln(out1);
  31. }
  32. if(str=="H"){
  33. out1='231'
  34. document.writeln(out1);
  35. }
  36. if(str=="I"){
  37. out1='2'
  38. document.writeln(out1);
  39. return;
  40. }
  41. if(str=="J"){
  42. out1='2231'
  43. document.writeln(out1);
  44. return;
  45. }
  46. if(str=="K"){
  47. out1='1434'
  48. document.writeln(out1);
  49. return;
  50. }
  51. if(str=="L"){
  52. out1='114'
  53. document.writeln(out1);
  54. return;
  55. }
  56. if(str=="M"){
  57. out1='2314'
  58. document.writeln(out1);
  59. return;
  60. }
  61. if(str=="N"){
  62. out1='22'
  63. document.writeln(out1);
  64. return;
  65. }
  66. if(str=="O"){
  67. out1='14'
  68. document.writeln(out1);
  69. return;
  70. }
  71. if(str=="P"){
  72. out1='2343'
  73. document.writeln(out1);
  74. return;
  75. }
  76. if(str=="Q"){
  77. out1='2342'
  78. document.writeln(out1);
  79. return;
  80. }
  81. if(str=="R"){
  82. out1='142'
  83. document.writeln(out1);
  84. return;
  85. }
  86. if(str=="S"){
  87. out1='143'
  88. document.writeln(out1);
  89. return;
  90. }
  91. if(str=="T"){
  92. out1='1'
  93. document.writeln(out1);
  94. return;
  95. }
  96. if(str=="U"){
  97. out1='223'
  98. document.writeln(out1);
  99. return;
  100. }
  101. if(str=="V"){
  102. out1='2311'
  103. document.writeln(out1);
  104. return;
  105. }
  106. if(str=="W"){
  107. out1='2234'
  108. document.writeln(out1);
  109. return;
  110. }
  111. if(str=="X"){
  112. out1='1431'
  113. document.writeln(out1);
  114. return;
  115. }
  116. if(str=="Y"){
  117. out1='222'
  118. document.writeln(out1);
  119. return;
  120. }
  121. if(str=="Z"){
  122. out1='1111'
  123. document.writeln(out1);
  124. return;
  125. }
  126. if(str=="11"){
  127. out1='A';
  128. document.writeln(out1);
  129. }
  130. if(str=="1423"){
  131. out1='B';
  132. document.writeln(out1);
  133. }
  134. if(str=="234"){
  135. out1='C';
  136. document.writeln(out1);
  137. }
  138. if(str=="111"){
  139. out1='D';
  140. document.writeln(out1);
  141. }
  142. if(str=="23"){
  143. out1='E';
  144. document.writeln(out1);
  145. }
  146. if(str=="1114"){
  147. out1='F'
  148. document.writeln(out1);
  149. }
  150. if(str=="1142"){
  151. out1='G'
  152. document.writeln(out1);
  153. }
  154. if(str=="231"){
  155. out1='H'
  156. document.writeln(out1);
  157. }
  158. if(str=="2"){
  159. out1='I'
  160. document.writeln(out1);
  161. return;
  162. }
  163. if(str=="2231"){
  164. out1='J'
  165. document.writeln(out1);
  166. return;
  167. }
  168. if(str=="1434"){
  169. out1='K'
  170. document.writeln(out1);
  171. return;
  172. }
  173. if(str=="114"){
  174. out1='L'
  175. document.writeln(out1);
  176. return;
  177. }
  178. if(str=="2314"){
  179. out1='M'
  180. document.writeln(out1);
  181. return;
  182. }
  183. if(str=="22"){
  184. out1='N'
  185. document.writeln(out1);
  186. return;
  187. }
  188. if(str=="14"){
  189. out1='O'
  190. document.writeln(out1);
  191. return;
  192. }
  193. if(str=="2343"){
  194. out1='P'
  195. document.writeln(out1);
  196. return;
  197. }
  198. if(str=="2342"){
  199. out1='Q'
  200. document.writeln(out1);
  201. return;
  202. }
  203. if(str=="142"){
  204. out1='R'
  205. document.writeln(out1);
  206. return;
  207. }
  208. if(str=="143"){
  209. out1='S'
  210. document.writeln(out1);
  211. return;
  212. }
  213. if(str=="1"){
  214. out1='T'
  215. document.writeln(out1);
  216. return;
  217. }
  218. if(str=="233"){
  219. out1='U'
  220. document.writeln(out1);
  221. return;
  222. }
  223. if(str=="2311"){
  224. out1='V'
  225. document.writeln(out1);
  226. return;
  227. }
  228. if(str=="2234"){
  229. out1='W'
  230. document.writeln(out1);
  231. return;
  232. }
  233. if(str=="1431"){
  234. out1='X'
  235. document.writeln(out1);
  236. return;
  237. }
  238. if(str=="222"){
  239. out1='Y'
  240. document.writeln(out1);
  241. return;
  242. }
  243. if(str=="1111"){
  244. out1='Z'
  245. document.writeln(out1);
  246. return;
  247. }
  248. }
  249. encdec("1111");//From Morse
  250. encdec("B");//To Morse
  251. encdec("C");
  252. encdec("D");
  253. encdec("E");
  254. encdec("F");
  255. encdec("G");
  256. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement