{"id":280964,"student_id":10,"content":"var a = 'apple';\nvar b = 2;","created_at":"2021-07-29T15:21:30.385+08:00","updated_at":"2021-07-29T15:31:41.278+08:00","name":"變數\u0026型態 副本","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/280964/5cef79b2ec0469b708d321e72d20aec4.jpg"},"parent_id":43877,"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 console.log($);\n console.log('jQuery')\n main();\n });\n});\n\nlet variables = {};\nlet ignore = {};\n\nfor (let i in window) {\n ignore[i] = true;\n}\n\nfunction main() {\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({\n top: '50vh', left: '50vw', position: 'absolute'\n })\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 {\ndisplay: block;\nposition: absolute;\ntop: 50vh;\nleft: 50vw;\ntransform: translate(-50%, -50%);\npadding: 50px;\nborder: 4px solid #ddd;\nborder-radius: 10px;\ncolor: #ddd;\nfont-size: 1.5em;\nfont-weight: bold;\nfont-weight: bold;\n}\n\nbody {\nwidth: 100%;\nheight: 100vh;\nbackground-color: #ccc;\nmargin: 0;\npadding: 0;\n}\n\n.variable {\ndisplay: inline-block;\nfont-size: 1.7em;\nborder-width: 3px;\nborder-style: solid;\nborder-radius: 7px;\ncursor: move;\n}\n\n.key {\nbackground-color: #fff;\nborder-radius: 5px 0px 0px 5px;\npadding: 0px 3px;\n}\n\n.val {\npadding: 0px 5px;\ncolor: #fff;\n}\n\n.string {\nbackground-color: #D9B300;\nborder-color: #D9B300;\n}\n\n.string .key {\ncolor: #D9B300;\n}\n\n.number {\nbackground-color: #5151A2;\nborder-color: #5151A2;\n}\n\n.number .key {\ncolor: #5151A2;\n}\n\n.boolean {\nbackground-color: #7E3D76;\nborder-color: #7E3D76;\n}\n\n.boolean .key {\ncolor: #7E3D76;\n}\n\n.array,\n.function,\n.object {\nbackground-color: #b01;\nborder-color: #b01;\n}\n\n.array .key,\n.function .key,\n.object .key {\ncolor: #b01;\n}\n\n.null,\n.undefined {\nbackground-color: #777777;\nborder-color: #777777;\n}\n\n.null .key,\n.undefined .key {\ncolor: #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":185,"hashid":"kdms63vjw","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
到這台電腦