{"id":66481,"student_id":1404,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n \u003clink rel=\\\"stylesheet\\\" href=\\\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\\\" integrity=\\\"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\\\" crossorigin=\\\"anonymous\\\"\u003e\\n \u003cscript src=\\\"https://code.jquery.com/jquery-3.2.1.slim.min.js\\\" integrity=\\\"sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n\u003cscript src=\\\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js\\\" integrity=\\\"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n\u003cscript src=\\\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js\\\" integrity=\\\"sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl\\\" crossorigin=\\\"anonymous\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003cimg class=\\\"rope js-rope\\\" src=\\\"rope.png\\\"\u003e\\n \u003cp class=\\\"text-center alert alert-warning message js-message\\\"\u003e\u003c/p\u003e\\n \u003cbutton class=\\\"btn btn-primary pair js-pair\\\"\u003e配對\u003c/button\u003e\\n \u003cbutton class=\\\"btn btn-primary restart js-restart\\\"\u003e重新比賽\u003c/button\u003e\\n \u003cbutton class=\\\"btn btn-danger pull js-pull\\\"\u003e拉繩子\u003c/button\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\\n\\n\",\"css\":\"body {\\n background-color: #eee;\\n background-image: url(bg.jpg);\\n background-position: center;\\n background-size: cover;\\n position: relative;\\n height: 100vh;\\n}\\n\\n.rope {\\n position: fixed;\\n height: 200%;\\n top: calc(50% - 100vh);\\n left: 50%;\\n \\n}\\n\\n.message {\\n opacity: .5;\\n}\\n\\n.pair {\\n position: fixed;\\n bottom: 10px;\\n left: 10px;\\n}\\n\\n.restart {\\n position: fixed;\\n bottom: 10px;\\n left: 70px;\\n}\\n\\n.pull {\\n position: fixed;\\n right: 10px;\\n bottom: 10px;\\n}\",\"js\":\"//s1\\nvar p1_id = Math.floor(Math.random() * 9000 + 1000);\\nvar p2_id = \\\"未配對\\\";\\nvar p1_count = 0;\\nvar p2_count = 0;\\nvar status = 0;\\n\\nsetInterval(function(){\\n if (status == 0) {\\n $('.js-message').text(`你的ID: ${p1_id} 對方ID: ${p2_id}`);\\n }\\n if(status == 1){\\n $(\\\".message\\\").text(\\\"開始比賽!!!\\\");\\n }\\n if (status == 2) {\\n if (p1_count \u003e p2_count) {\\n $('.message').text('獲勝!!');\\n } else {\\n $('.message').text('失敗!!');\\n }\\n }\\n \\n var diff = p1_count - p2_count;\\n $(\\\".js-rope\\\").css(\\\"transform\\\", `translateY(${diff}%)`);\\n if(p2_id != \\\"未配對\\\" \u0026\u0026 status != 2){\\n DB.broadcast('update', {id: p1_id, count: p1_count, isGameOver: _isGameOver});\\n }\\n var _isGameOver = p1_count - p2_count \u003e 10;\\n if(_isGameOver){\\n status = 2;\\n }\\n \\n}, 50);\\n\\nDB.onMessage('update', function (data) { //data 存的是什麼??\\n \\n if(data.id == p2_id){\\n console.log(data.id);\\n if(status == 0){\\n status = 1;\\n }else if(status == 1){\\n p2_count = data.count;\\n }else if(data.isGameOver){\\n status = 2;\\n }\\n }\\n});\\n\\n\\n$(\\\".pair\\\").on(\\\"click\\\", function(){\\n if(status == 0){\\n p2_id = prompt(\\\"請輸入對方 id\\\");\\n }\\n})\\n\\n$(\\\".pull\\\").on(\\\"click\\\", function(){\\n if(status == 1){\\n p1_count ++;\\n }\\n})\\n\\n\\n$(\\\".js-restart\\\").click(function(){\\n if(status == 2){\\n status = 0;\\n p1_count = 0;\\n p2_count = 0;\\n }\\n})\\n\\n\\n\\n\\n\\n\\n// var p1_id = Math.floor(Math.random() * 10000);\\n// var p2_id;\\n// var p1_times = 0;\\n// var p2_times = 0;\\n// var status = 0;\\n\\n// $('.js-pair').click(function () {\\n// p2_id = prompt('對方 ID');\\n// });\\n\\n// $('.js-pull').click(function () {\\n// if (status == 1) {\\n// p1_times++;\\n// }\\n// });\\n\\n// $('.js-restart').click(function () {\\n// if (status == 2) {\\n// p1_times = 0;\\n// p2_times = 0;\\n// status = 0;\\n// }\\n// });\\n\\n// DB.onMessage('update', function (data) {\\n// if (data.id == p2_id) {\\n// if (status == 0) {\\n// status = 1;\\n// }\\n// if (status == 1) {\\n// p2_times = data.times;\\n// }\\n// if (data.isGameOver) {\\n// status = 2;\\n// }\\n// }\\n// });\\n\\n// setInterval(function () {\\n\\n// if (status == 0) {\\n// $('.js-message').text(`你的ID: ${p1_id} 對方ID: ${p2_id}`);\\n// }\\n// if (status == 1) {\\n// $('.js-message').text('開始比賽!!');\\n// }\\n// if (status == 2) {\\n// if (p1_times \u003e p2_times) {\\n// $('.js-message').text('獲勝!!');\\n// } else {\\n// $('.js-message').text('失敗!!');\\n// }\\n// }\\n\\n// var diff = p1_times - p2_times;\\n// $('.js-rope').css('transform', `translateY(${diff}%)`);\\n// var isGameOver = p1_times - p2_times \u003e 10;\\n\\n// if (p2_id \u0026\u0026 status != 2) {\\n// DB.broadcast('update', {\\n// id: p1_id,\\n// times: p1_times,\\n// isGameOver: isGameOver\\n// });\\n// }\\n// if (isGameOver) {\\n// status = 2;\\n// }\\n// }, 50);\"}","created_at":"2019-05-06T18:39:34.693+08:00","updated_at":"2020-01-18T17:50:28.493+08:00","name":"點擊大 PK 副本","language":"web","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/66481/1d1e35c05ce4a29aea3280c03ce9e817.jpg"},"parent_id":31711,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":96,"hashid":"wdks9w2k","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1160952,"file_name":"bg.jpg","project_id":66481,"asset_id":71770,"created_at":"2019-05-06T18:39:34.698+08:00","updated_at":"2019-05-06T18:39:34.698+08:00"},{"id":1160953,"file_name":"rope.png","project_id":66481,"asset_id":71771,"created_at":"2019-05-06T18:39:34.699+08:00","updated_at":"2019-05-06T18:39:34.699+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦