{"id":197168,"student_id":12205,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n\\t\u003clink rel=\\\"stylesheet\\\" href=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css\\\" integrity=\\\"sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4\\\" crossorigin=\\\"anonymous\\\"\u003e\\n\\t\u003cscript src=\\\"https://code.jquery.com/jquery-3.3.1.slim.min.js\\\" integrity=\\\"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n \u003cscript src=\\\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js\\\" integrity=\\\"sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n \u003cscript src=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js\\\" integrity=\\\"sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody class=\\\"text-center p-4\\\"\u003e\\n \u003ch2\u003e摩斯密碼\u003c/h2\u003e\\n \u003ctextarea class=\\\"form-control\\\" rows=\\\"8\\\" cols=\\\"40\\\" id=\\\"text\\\"\u003e\u003c/textarea\u003e\\n \u003cdiv class=\\\"m-2\\\"\u003e\\n \u003cbutton class=\\\"btn btn-primary\\\" id=\\\"encode\\\"\u003e編碼\u003c/button\u003e\\n \u003cbutton class=\\\"btn btn-primary\\\" id=\\\"decode\\\"\u003e解碼\u003c/button\u003e\\n \u003cbutton class=\\\"btn btn-primary\\\" id=\\\"play\\\"\u003e播放\u003c/button\u003e \\n \u003c/div\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"textarea {\\n font-family: monospace;\\n font-weight: 900;\\n font-size: 3rem;\\n}\",\"js\":\"\"}","created_at":"2020-10-23T12:50:36.812+08:00","updated_at":"2020-10-23T12:52:24.343+08:00","name":"摩斯密碼 ","language":"web","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/197168/26a90f63325fcb1537af6787d26ff843.jpg"},"parent_id":103491,"plugin":"var encodeTable = {\n A: '.-',\n B: '-...',\n C: '-.-.',\n D: '-..',\n E: '.',\n F: '..-.',\n G: '--.',\n H: '....',\n I: '..',\n J: '.---',\n K: '-.-',\n L: '.-..',\n M: '--',\n N: '-.',\n O: '---',\n P: '.--.',\n Q: '--.-',\n R: '.-.',\n S: '...',\n T: '-',\n U: '..-',\n V: '...-',\n W: '.--',\n X: '-..-',\n Y: '-.--',\n Z: '--..',\n a: '.-',\n b: '-...',\n c: '-.-.',\n d: '-..',\n e: '.',\n f: '..-.',\n g: '--.',\n h: '....',\n i: '..',\n j: '.---',\n k: '-.-',\n l: '.-..',\n m: '--',\n n: '-.',\n o: '---',\n p: '.--.',\n q: '--.-',\n r: '.-.',\n s: '...',\n t: '-',\n u: '..-',\n v: '...-',\n w: '.--',\n x: '-..-',\n y: '-.--',\n z: '--..',\n 1: '.----',\n 2: '..---',\n 3: '...--',\n 4: '....-',\n 5: '.....',\n 6: '-....',\n 7: '--...',\n 8: '---..',\n 9: '----.',\n 0: '-----',\n '.': '.-.-.-',\n ':': '---...',\n ',': '--..--',\n ';': '-.-.-.',\n '?': '..--..',\n '=': '-...-',\n \"'\": '.----.',\n '/': '-..-.',\n '!': '-.-.--',\n '-': '-....-',\n '_': '..--.-',\n '\"': '.-..-.',\n '(': '-.--.',\n ')': '-.--.-',\n '$': '...-..-',\n '\u0026': '.-...',\n '@': '.--.-.',\n '+': '.-.-.'\n}\n\nvar decodeTable = {};\nfor (var key in encodeTable) {\n decodeTable[encodeTable[key]] = key;\n}\n\nvar audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n\nfunction playNote(frequency, duration) {\n // create Oscillator node\n var oscillator = audioCtx.createOscillator();\n\n oscillator.type = 'square';\n oscillator.frequency.value = frequency; // value in hertz\n oscillator.connect(audioCtx.destination);\n oscillator.start();\n\n setTimeout(\n function(){\n oscillator.stop();\n }, duration);\n}\n\n/**\n * encodeTable -\u003e 編碼用對照表\n * decodeTable -\u003e 解碼用對照表\n */\n$('#decode').click(decode);\n$('#encode').click(encode);\n$('#play').click(play);\n\n// 編碼\nfunction encode () {\n var text = $('#text').val();\n var code = '';\n text.split(' ').forEach(function (word) {\n word.split('').forEach(function (a) {\n code += encodeTable[a] + ' ';\n });\n code += ' ';\n });\n code = code.trim();\n $(\"#text\").val(code);\n}\n\n// 解碼\nfunction decode () {\n var text = $('#text').val();\n var code = '';\n text.split(' ').forEach(function (word) {\n word.split(' ').forEach(function (a) {\n code += decodeTable[a];\n });\n code += ' ';\n });\n code = code.trim();\n $(\"#text\").val(code);\n}\n\n// 播放\nfunction play () {\n var code = $('#text').val().split('');\n function run () {\n var t = code.shift();\n if (t == '.') {\n playNote(500, 50);\n }\n if (t == '-') {\n playNote(500, 200);\n }\n if (t == '.') {\n setTimeout(run, 150); \n }\n if (t == '-') {\n setTimeout(run, 300); \n }\n if (t == ' ') {\n setTimeout(run, 300);\n }\n }\n run();\n}","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":45,"hashid":"6rps98e9m","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦