{"id":46912,"student_id":45,"content":"var name = prompt(\"名子?\") || \"匿名\"\nvar comments = [\"?\", \"??\", \"???\", \"!\", \"!!\"]\nvar user = {\n 159: {\n id: 159, name: \"皮卡丘\"\n },\n 464: {\n id: 464, name: \"傑尼龜\"\n },\n 991: {\n id: 991, name: \"妙蛙種子\"\n }\n};\nvar id = Math.floor(Math.random()*100000)\nuser[id] = {\n id: id,\n name: name,\n time:Date.now()\n}\nforever(function() {\n user[id].time=Date.now()\n DB.broadcast(\"u\", user[id])\n for (var i = 0; i \u003c comments.length; i++) {\n print(comments[i], 150, 15*i+30)\n }\n print(\"===玩家名單===\")\n var i = 0\n for (var id in user) {\n i++\n console.log(id);\n console.log(user[id]);\n console.log(user[id].name);\n print(user[id].name, 10, 10+20*i)\n if(Date.now()\u003euser[id].time+1500){delete user[id]}\n }\n})\nDB.onMessage(\"u\", function(data) {\n if(user[data.id]===undefined){comments.unshift(`[${data.time}] ${data.name}加入聊天室`)}\n user[data.id] = data\n})\nwhen(\"click\", function() {\n var msg = `[${(new Date).toLocaleTimeString()}]${name}`+prompt(\"留言\")\n comments.unshift(msg)\n DB.broadcast(\"msg\", msg)\n})\nDB.onMessage(\"msg\", function(data) {\n comments.unshift(data)\n})\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","created_at":"2018-10-27T15:38:37.501+08:00","updated_at":"2019-11-10T10:24:05.989+08:00","name":"聊天室 副本","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/46912/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":34007,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":54,"hashid":"p93sekmp","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
到這台電腦