{"id":44289,"student_id":1976,"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\\\"\u003eI love You\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\":\"body {\\n background-image: url('dust.png');\\n}\",\"js\":\"/**\\n* encodeTable -\u003e 編碼用對照表\\n* decodeTable -\u003e 解碼用對照表\\n*/\\n$('#decode').click(decode);\\n$('#encode').click(encode);\\n$('#play').click(play);\\n\\n\\n\\n//編碼\\nfunction encode () {\\n var sentence = $(\\\"#text\\\").val()\\n var words = sentence.split(\\\" \\\")\\n var code = \\\"\\\"\\n console.log(words) // [\\\"i\\\", \\\"love\\\", \\\"you\\\"]\\n\\n words.forEach(function (word) {\\n var alphabets = word.split(\\\"\\\")\\n alphabets.forEach(function(alphabet) {\\n code = code + encodeTable[alphabet] + \\\" \\\"\\n })\\n code = code + \\\" \\\"\\n })\\n code = code.trim()\\n $(\\\"#text\\\").val(code)\\n}\\n\\n\\n// 解碼\\nfunction decode () {\\n var sentence = $(\\\"#text\\\").val()\\n var words = sentence.split(\\\" \\\")\\n var code = \\\"\\\"\\n console.log(words) // [\\\"i\\\", \\\"love\\\", \\\"you\\\"]\\n\\n words.forEach(function (word) {\\n var alphabets = word.split(\\\" \\\")\\n alphabets.forEach(function(alphabet) {\\n code = code + decodeTable[alphabet]\\n })\\n code = code + \\\" \\\"\\n })\\n code = code.trim()\\n $(\\\"#text\\\").val(code)\\n}\\n\\n// 播放\\nfunction play () {\\n var sentence = $(\\\"#text\\\").val()\\n var words = sentence.split(\\\"\\\")\\n function run() {\\n var note = words.shift()\\n \\n if(note == \\\"-\\\") {\\n playNote(500, 200)\\n setTimeout(run, 300);\\n }\\n \\n if(note == \\\".\\\") {\\n playNote(500, 50)\\n setTimeout(run, 150);\\n }\\n \\n if(note == \\\" \\\") {\\n setTimeout(run, 200);\\n }\\n }\\n \\n run()\\n\\n}\"}","created_at":"2018-10-06T13:13:37.311+08:00","updated_at":"2019-11-08T05:10:15.747+08:00","name":"摩斯密碼 副本","language":"web","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/44289/c1049b946059236b1970bb20f7fbcbf7.jpg"},"parent_id":33465,"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}","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":382,"hashid":"zpes8ygd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":779168,"file_name":"dust.png","project_id":44289,"asset_id":51276,"created_at":"2018-10-06T13:13:37.319+08:00","updated_at":"2018-10-06T13:13:37.319+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦