{"id":54098,"student_id":1909,"content":"\n","created_at":"2019-01-12T16:12:20.985+08:00","updated_at":"2019-07-31T06:53:07.947+08:00","name":"變數\u0026型態 副本","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/54098/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":10705,"plugin":"var JavaScript = {\n load: function(src, callback) {\n var script = document.createElement('script'),\n loaded;\n script.setAttribute('src', src);\n if (callback) {\n script.onreadystatechange = script.onload = function() {\n if (!loaded) {\n callback();\n }\n loaded = true;\n };\n }\n document.getElementsByTagName('head')[0].appendChild(script);\n }\n};\n\nJavaScript.load('//code.jquery.com/jquery-2.2.4.min.js',function() {\n JavaScript.load('//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js',function() {\n\t\tconsole.log($);\n\t});\n});\n\n(function() {\n let variables = {};\n let ignore = {};\n\n for (let i in window) {\n ignore[i] = true;\n }\n\n ignore.jQuery = true;\n ignore.$ = true;\n\n setInterval(function(){ \n for (let name in window) {\n if (ignore.hasOwnProperty(name) == false) {\n if (variables.hasOwnProperty(name) == false) {\n variables[name] = window[name];\n create(name);\n }\n }\n }\n\n for (let name in variables) {\n if (variables[name] !== window[name]) {\n variables[name] = window[name];\n update(name);\n }\n }\n }, 200);\n\n function create(name) {\n let tp = template(name);\n let box = $(tp).draggable().css({ top: '50vh', left: '50vw', position: 'absolute' })\n $('body').append(box);\n }\n\n function update(name) {\n let id = '#' + name;\n let paras = renderParameters(window[name]);\n\n $(id).attr('class', paras.className + ' variable');\n $(id + ' .val').html(paras.text);\n }\n\n function template(name) {\n let paras = renderParameters(window[name]);\n return `\n \u003cdiv id=${name} class=\"variable ${paras.className}\"\"\u003e\n \u003cspan class=\"key\"\u003e${name}\u003c/span\u003e\n \u003cspan class=\"val\"\u003e${paras.text}\u003c/span\u003e\n \u003c/div\u003e`\n }\n\n function renderParameters(val) {\n let className, text, constructor;\n if (val === undefined) {\n text = 'undefined';\n className = 'undefined';\n }\n\n if (val === null) {\n text = 'null';\n className = 'undefined';\n }\n\n if (val != undefined \u0026\u0026 val != null) {\n constructor = val.constructor;\n }\n\n if (constructor === String) {\n className = 'string';\n text = '\"' + val.toString() + '\"';\n }\n\n if (constructor === Number) {\n className = 'number';\n text = val.toString();\n }\n\n if (constructor === Boolean) {\n className = 'boolean';\n text = val.toString();\n }\n\n if (constructor === Array) {\n className = 'array';\n text = '[' + val.toString() + ']';\n }\n\n if (constructor === Object) {\n className = 'object';\n text = 'Object';\n }\n\n if (constructor === Function) {\n className = 'function';\n text = 'Function';\n }\n\n return {\n className: className,\n text: text\n }\n }\n})();\n\nvar styleString = `\n #msg {\n display: block;\n position: absolute;\n top: 50vh;\n left: 50vw;\n transform: translate(-50%, -50%);\n padding: 50px;\n border: 4px solid #ddd;\n border-radius: 10px;\n color: #ddd;\n font-size: 1.5em;\n font-weight: bold;\n font-weight: bold;\n }\n\n body {\n width: 100%;\n height: 100vh;\n background-color: #ccc;\n margin: 0;\n padding: 0;\n }\n\n .variable {\n display: inline-block;\n font-size: 1.7em;\n border-width: 3px;\n border-style: solid;\n border-radius: 7px;\n cursor: move;\n }\n\n .key {\n background-color: #fff;\n border-radius: 5px 0px 0px 5px;\n padding: 0px 3px;\n }\n\n .val {\n padding: 0px 5px;\n color: #fff;\n }\n\n .string {\n background-color: #D9B300;\n border-color: #D9B300;\n }\n\n .string .key {\n color: #D9B300;\n }\n\n .number {\n background-color: #5151A2;\n border-color: #5151A2;\n }\n\n .number .key {\n color: #5151A2;\n }\n\n .boolean {\n background-color: #7E3D76;\n border-color: #7E3D76;\n }\n\n .boolean .key {\n color: #7E3D76;\n }\n\n .array,\n .function,\n .object {\n background-color: #b01;\n border-color: #b01;\n }\n\n .array .key,\n .function .key,\n .object .key {\n color: #b01;\n }\n\n .null,\n .undefined {\n background-color: #777777;\n border-color: #777777;\n }\n\n .null .key,\n .undefined .key {\n color: #777777;\n }\n`\n\nfunction addStyleString(str) {\n var node = document.createElement('style');\n node.innerHTML = str;\n document.body.appendChild(node);\n}\n\naddStyleString(styleString);","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":64,"hashid":"jzmsr5mk","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
到這台電腦