{"id":140139,"student_id":1998,"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\":\"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// 編碼\\nfunction encode () {\\n // 1. 取出輸入框的值\\n var str = $(\\\"#text\\\").val();\\n // 2. 把輸入框的值用空格分割\\n var arr = str.split(\\\" \\\");\\n // 3. 把各個分割的單字 for 迴圈印出來\\n var answer = \\\"\\\";\\n arr.forEach(function(word){\\n var arr2 = word.split(\\\"\\\");\\n arr2.forEach(function(char){\\n answer += encodeTable[char] + \\\" \\\";\\n })\\n answer += \\\" \\\";\\n })\\n answer = answer.trim();\\n $(\\\"#text\\\").val(answer);\\n}\\n\\n\\n\\n\\n// 解碼\\nfunction decode () {\\n // 1. 取出輸入框的值\\n var str = $(\\\"#text\\\").val();\\n // 2. 把輸入框的值用空格分割\\n var arr = str.split(\\\" \\\");\\n // 3. 把各個分割的單字 for 迴圈印出來\\n var answer = \\\"\\\";\\n arr.forEach(function(word){\\n var arr2 = word.split(\\\" \\\");\\n arr2.forEach(function(char){\\n answer += decodeTable[char];\\n })\\n answer += \\\" \\\";\\n })\\n answer = answer.trim();\\n $(\\\"#text\\\").val(answer);\\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\\n }\\n run();\\n}\"}","created_at":"2020-04-11T16:22:24.970+08:00","updated_at":"2020-04-18T16:37:51.246+08:00","name":"摩斯密碼 副本","language":"web","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/140139/ebe89a81c34beb29f3113a42a207f4ad.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":44,"hashid":"9ygs6nyd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2419571,"file_name":"dust.png","project_id":140139,"asset_id":51276,"created_at":"2020-04-11T16:22:24.975+08:00","updated_at":"2020-04-11T16:22:24.975+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦