├── README.md ├── LICENSE ├── css └── style.css ├── index.html └── js └── js.js /README.md: -------------------------------------------------------------------------------- 1 | Playground 2 | ========== 3 | 4 | This is an interactive HTML/CSS/JS playground similar to jsFiddle, jsBin, CodePen and the likes but much simpler with only the basic features. 5 | 6 | This project is based on the wonderful work and [write-up](http://codetheory.in/building-your-own-html-css-js-realtime-playground/) of the CSSDeck Author, [Rishabh](http://codetheory.in/about/). You can see the [CSSDeck](http://cssdeck.com/) variant [here](http://cssdeck.com/labs/zcqps6a7). I couldn't find an example on Github so I created one. 7 | 8 | To use it, clone or download and unzip the project and start a local webserver (like `python -m SimpleHTTPServer`). 9 | 10 | ![screenshot](http://content.screencast.com/users/dirkk1/folders/Jing/media/35515ad5-ca5d-4de5-b976-24c8ce572037/00000249.png) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Dirk Krause 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-box-sizing: border-box; 3 | -moz-box-sizing: border-box; 4 | box-sizing: border-box; 5 | } 6 | 7 | html, body { 8 | width: 100%; height: 100%; 9 | } 10 | 11 | #wrap { 12 | width: 100%; 13 | height: 100%; 14 | } 15 | 16 | /* Code Editors */ 17 | 18 | #code_editors { 19 | position: absolute; 20 | top: 0; left: 0; bottom: 0; right: 60%; 21 | } 22 | 23 | #code_editors .code_box { 24 | height: 33%; width: 100%; 25 | position: relative; 26 | } 27 | .code_box h3 { 28 | font-size: 13px; 29 | height: 30px; 30 | padding: 5px 10px; margin: 0; 31 | background: linear-gradient(#707070, #555); 32 | color: white; 33 | border-top: 1px solid #8F8F8F; 34 | border-bottom: 1px solid #202020; 35 | } 36 | .code_box textarea { 37 | position: absolute; 38 | left: 0; right: 0; top: 30px; bottom: 0; 39 | resize: none; border: 0; 40 | padding: 10px; 41 | font-family: monospace; 42 | } 43 | .code_box textarea:focus { 44 | outline: none; 45 | background: #EFEFEF; 46 | } 47 | 48 | /* Output Area */ 49 | #output { 50 | position: absolute; 51 | left: 40%; top: 0; right: 0; bottom: 0; 52 | border: 5px solid #444; 53 | border-left-width: 10px; 54 | overflow: hidden; 55 | } 56 | 57 | #output iframe { 58 | width: 100%; height: 100%; 59 | border: 0; 60 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 |
9 |
10 |

HTML

11 | 12 |
13 |
14 |

CSS

15 | 16 |
17 |
18 |

JavaScript

19 | 20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /js/js.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | // Base template 4 | var base_tpl = 5 | "\n" + 6 | "\n\t" + 7 | "\n\t\t" + 8 | "\n\t\t" + 9 | "Test\n\n\t\t\n\t" + 10 | "\n\t" + 11 | "\n\t\n\t" + 12 | "\n" + 13 | ""; 14 | 15 | var prepareSource = function() { 16 | var html = html_editor.getValue(), 17 | css = css_editor.getValue(), 18 | js = js_editor.getValue(), 19 | src = ''; 20 | 21 | // HTML 22 | src = base_tpl.replace('', html + ''); 23 | 24 | // CSS 25 | css = ''; 26 | src = src.replace('', css + ''); 27 | 28 | // Javascript 29 | js = '