{"id":63843,"student_id":1976,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n \u003ctitle\u003eDocument\u003c/title\u003e\\n \u003clink rel=\\\"stylesheet\\\" href=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\\\"\u003e\\n \u003cscript src=\\\"https://code.jquery.com/jquery-3.4.0.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003cdiv class=\\\"chatbox\\\"\u003e\\n \u003ch5 class=\\\"text-center\\\"\u003e艾莉斯\u003c/h5\u003e\\n \u003cdiv class=\\\"comments js-comment\\\"\u003e\\n \u003c/div\u003e\\n \u003cinput class=\\\"form-control js-input\\\" placeholder=\\\"說些什麼...\\\"\u003e\\n \u003c/div\u003e\\n \u003cscript src=\\\"https://unpkg.com/rivescript@latest/dist/rivescript.min.js\\\" type=\\\"application/javascript\\\" charset=\\\"utf-8\\\"\u003e\u003c/script\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"body {\\n width: 100vw;\\n height: 100vh;\\n padding: 10px;\\n}\\n\\nh5 {\\n position: absolute;\\n top: 0;\\n width: 100%;\\n border-bottom: 2px solid #ddd;\\n padding-bottom: 10px;\\n color: #666;\\n background-color: #fff;\\n z-index: 1;\\n}\\n\\n.chatbox {\\n max-width: 550px;\\n height: calc(100vh - 20px);\\n margin: auto;\\n position: relative;\\n \\n}\\n\\n.chatbox input {\\n position: absolute;\\n bottom: 0;\\n}\\n\\n.comments {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n padding: 50px 10px;\\n overflow-y: scroll;\\n}\\n\\n.comment span {\\n display: inline-block;\\n max-width: 75%;\\n padding: 8px;\\n border-radius: 20px;\\n font-size: .9rem;\\n}\\n\\n.comment.comment-right {\\n text-align: right;\\n}\\n\\n.comment.comment-right span {\\n color: #fff;\\n background-color: rgb(59, 114, 241);\\n}\\n\\n.comment.comment-left span {\\n color: #555;\\n background-color: rgb(210, 210, 210);\\n}\",\"js\":\"var code = \\n`\\n+ 我要點餐\\n- \u003cset a=0\u003e\u003cset b=0\u003e\u003cset c=0\u003e\\n^ 好的!我們有賣可樂(10$)、薯條(20$)、漢堡(30$),要點什麼呢?\\n\\n+ 先來#(個|杯|份)*\\n* \u003cstar3\u003e == 可樂 =\u003e 還要加點嗎?\u003cadd a=\u003cstar1\u003e\u003e\\n* \u003cstar3\u003e == 薯條 =\u003e 還要加點嗎?\u003cadd b=\u003cstar1\u003e\u003e\\n* \u003cstar3\u003e == 漢堡 =\u003e 還要加點嗎?\u003cadd c=\u003cstar1\u003e\u003e\\n- ok!\\n\\n+ 再加#(個|杯|份)*\\n* \u003cstar3\u003e == 可樂 =\u003e 還要加點嗎?\u003cadd a=\u003cstar1\u003e\u003e\\n* \u003cstar3\u003e == 薯條 =\u003e 還要加點嗎?\u003cadd b=\u003cstar1\u003e\u003e\\n* \u003cstar3\u003e == 漢堡 =\u003e 還要加點嗎?\u003cadd c=\u003cstar1\u003e\u003e\\n- ok!\\n\\n+ 總共多少?\\n- \u003cset sum=0\u003e\\n^ \u003cset tmp=10\u003e\u003cmult tmp=\u003cget a\u003e\u003e\u003cadd sum=\u003cget tmp\u003e\u003e\\n^ \u003cset tmp=20\u003e\u003cmult tmp=\u003cget b\u003e\u003e\u003cadd sum=\u003cget tmp\u003e\u003e\\n^ \u003cset tmp=30\u003e\u003cmult tmp=\u003cget c\u003e\u003e\u003cadd sum=\u003cget tmp\u003e\u003e\\n^ \u003cget a\u003e杯可樂、\u003cget b\u003e份薯條、\u003cget c\u003e個漢堡,總計 \u003cget sum\u003e 元\\n\\n\\n+ *\\n- 聽不懂你在說什麼,要點餐嗎?\\n\\n`\\n\\n// https://github.com/aichaos/rivescript-js\\nvar rs = new RiveScript({utf8: true});\\nrs.stream(code, console.log);\\nrs.sortReplies();\\n\\n\\nfunction talk (text) {\\n console.log(text)\\n rs.reply('web-user', text).then(function (re) {\\n addComment(re, 'left');\\n });\\n};\"}","created_at":"2019-04-26T11:07:01.914+08:00","updated_at":"2019-11-12T07:31:18.098+08:00","name":"A.L.I.C.E 副本","language":"web","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/63843/1f64bcebf4b9f36ead954edb9469d73a.jpg"},"parent_id":63808,"plugin":"$('body').append('\u003cimg src=\"spin.svg\" style=\"display: none;\"/\u003e'); // cache\nvar input = $('.js-input');\nvar comment = $('.js-comment');\n\n$(input).on('keydown', function (e) {\n if (e.keyCode === 13) {\n input.attr('disabled', true);\n var q = input.val();\n addComment(q, 'right');\n var el = addComment('\u003cimg src=\"spin.svg\"/\u003e', 'left');\n setTimeout(function () {\n el.remove();\n //addComment(talk(q), 'left');\n talk(q)\n \n }, 500 + Math.random()*1000);\n input.value = '';\n input.val('');\n }\n});\n\nfunction addComment (text, who) {\n var html = `\u003cp class=\"comment comment-${who}\"\u003e\u003cspan\u003e${text}\u003c/span\u003e\u003c/p\u003e`;\n var el = $(html);\n comment.append(el);\n comment[0].scrollTop = comment[0].scrollHeight;\n input.attr('disabled', false);\n input[0].focus();\n return el;\n}","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":427,"hashid":"qmdsg6yw","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1119988,"file_name":"spin.svg","project_id":63843,"asset_id":115008,"created_at":"2019-04-26T11:07:01.919+08:00","updated_at":"2019-04-26T11:07:01.919+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦