@@ -45,6 +30,6 @@ - @await RenderSectionAsync("Scripts", required: false) + @await RenderSectionAsync("Scripts", false) diff --git a/BinaryDad.Coding/wwwroot/css/jotted/jotted.min.css b/BinaryDad.Coding/wwwroot/css/jotted/jotted.min.css new file mode 100644 index 0000000..e25d662 --- /dev/null +++ b/BinaryDad.Coding/wwwroot/css/jotted/jotted.min.css @@ -0,0 +1 @@ +.jotted{position:relative;height:12em;overflow:hidden;border:1px solid rgba(51,51,51,0.24);border-radius:2px;box-sizing:border-box;font-family:sans-serif}.jotted-nav{position:absolute;z-index:2;display:block;width:100%;height:2.4em;overflow:hidden;margin:0;padding:0;list-style-type:none;background:rgba(51,51,51,0.08);border-bottom:1px solid rgba(51,51,51,0.2)}.jotted-nav-item{display:none;float:left;border-width:0 1px;border-style:solid;border-color:transparent;color:#555}.jotted-nav-item:first-child{border-width:0 1px 0 0}.jotted-nav-item:hover,.jotted-nav-item:focus{background:rgba(51,51,51,0.04)}.jotted-nav-item:active{background:rgba(51,51,51,0.12)}.jotted-nav-item a{display:block;padding:0 .8em;color:inherit;line-height:2.4em;text-decoration:none}.jotted-pane-active-result .jotted-nav-item-result,.jotted-pane-active-html .jotted-nav-item-html,.jotted-pane-active-css .jotted-nav-item-css,.jotted-pane-active-js .jotted-nav-item-js{background:#fff;border-color:rgba(51,51,51,0.3);color:#222}jotted-nav-item,.jotted-nav-item-result{display:block}.jotted-has-html .jotted-nav-item-html,.jotted-has-css .jotted-nav-item-css,.jotted-has-js .jotted-nav-item-js{display:block}.jotted-pane{position:absolute;z-index:1;visibility:hidden;height:100%;width:100%;padding-top:2.4em;box-sizing:border-box;background:#fff}.jotted-pane-active-result .jotted-pane-result,.jotted-pane-active-html .jotted-pane-html,.jotted-pane-active-css .jotted-pane-css,.jotted-pane-active-js .jotted-pane-js{position:relative;visibility:visible}.jotted-editor{height:100%}.jotted-pane-result iframe,.jotted-editor textarea{display:block;width:100%;height:100%;margin:0;border:0;box-sizing:border-box}.jotted-editor textarea{padding:1em;background:#fff}.jotted-status-active-html .jotted-pane-html,.jotted-status-active-css .jotted-pane-css,.jotted-status-active-js .jotted-pane-js{padding-bottom:1.5em}.jotted-status{position:absolute;bottom:0;left:0;z-index:999;width:100%;padding:0 .6em}.jotted-status p{margin:0;color:#333;font-size:.8em;line-height:1.8em}.jotted-status p:before{content:'';position:relative;display:inline-block;width:1.2em;height:1.2em;margin-right:.8em;margin-bottom:.28em;border-radius:100%;color:#fff;font-size:.8em;font-family:monospace;font-weight:bold;line-height:1.2em;text-align:center;vertical-align:middle}.jotted-status-loading{background:#fff6d5}.jotted-status-loading p:before{background:#fd5}.jotted-status-error{background:#ffccbc}.jotted-status-error p:before{background:#c0392b}.jotted-button{padding:0 1em;border:1px solid #ccc;background:rgba(236,236,236,0.92);background:linear-gradient(rgba(249,249,249,0.92),rgba(236,236,236,0.92));border-radius:2px;cursor:pointer;line-height:1.6em}.jotted-button:hover{background:#f9f9f9}.jotted-plugin-ace .jotted-editor > textarea{display:none}.jotted-plugin-ace .ace_editor{width:100%;height:100%}.jotted-plugin-codemirror .CodeMirror{height:100%}.jotted-nav-item-console{display:block}.jotted-pane-console{background:#fff}.jotted-pane-active-console .jotted-pane-console{position:relative;visibility:visible}.jotted-pane-active-console .jotted-nav-item-console{background:#fff;border-color:rgba(51,51,51,0.3);color:#222}.jotted-console-container{height:100%;overflow:auto;font-family:monospace}.jotted-console-output{margin:0;padding:0;list-style-type:none;line-height:2.8em}.jotted-console-log{padding:0 1em}.jotted-console-log-history{border-width:1px 0;border-style:solid;border-color:rgba(51,51,51,0.08);background:rgba(51,51,51,0.04)}.jotted-console-log-error{background:#ffccbc;color:#500}.jotted-console-input{position:relative;background:rgba(51,51,51,0.12)}.jotted-console-input:before{content:'>';position:absolute;left:0;top:0;z-index:1;padding:0 1em;pointer-events:none;font-family:inherit;font-weight:bold;line-height:2.4em}.jotted-console-input input{box-sizing:border-box;display:block;width:100%;height:2.4em;border:0;padding:0 1em 0 2.4em;background:transparent;line-height:2.4em;font-family:inherit}.jotted-console-clear{position:absolute;top:3.3em;right:1.4em}.jotted-plugin-pen{display:flex;flex-flow:row wrap;user-select:none}.jotted-plugin-pen .jotted-pane-result{flex:1 100%}.jotted-plugin-pen .jotted-editor .CodeMirror{height:calc(100% - 39px)}.jotted-plugin-pen .jotted-nav{display:none}.jotted-plugin-pen .jotted-pane{padding-top:0;height:50%}.jotted-plugin-pen .jotted-pane-title{display:block;background:rgba(51,51,51,0.08);border-bottom:1px solid rgba(51,51,51,0.2);padding:0 .8em;line-height:2.4em;font-family:sans-serif}.jotted-plugin-pen .jotted-pane-title-result{display:none}.jotted-plugin-pen .jotted-pane-result,.jotted-plugin-pen.jotted-has-html .jotted-pane-html,.jotted-plugin-pen.jotted-has-css .jotted-pane-css,.jotted-plugin-pen.jotted-has-js .jotted-pane-js,.jotted-plugin-pen.jotted-plugin-console .jotted-pane-console{position:relative;visibility:visible}.jotted-plugin-pen.jotted-has-html .jotted-pane,.jotted-plugin-pen.jotted-has-css .jotted-pane,.jotted-plugin-pen.jotted-has-js .jotted-pane{max-width:100%;width:100%}.jotted-plugin-pen.jotted-has-html.jotted-has-css .jotted-pane-html,.jotted-plugin-pen.jotted-has-html.jotted-has-css .jotted-pane-css,.jotted-plugin-pen.jotted-has-html.jotted-has-js .jotted-pane-html,.jotted-plugin-pen.jotted-has-html.jotted-has-js .jotted-pane-js,.jotted-plugin-pen.jotted-has-css.jotted-has-js .jotted-pane-css,.jotted-plugin-pen.jotted-has-css.jotted-has-js .jotted-pane-js{max-width:50%;width:50%}.jotted-plugin-pen.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane-html,.jotted-plugin-pen.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane-js,.jotted-plugin-pen.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane-css{max-width:33.3333%;width:33.3333%}.jotted-plugin-pen.jotted-plugin-console .jotted-console-clear{top:4.3em}.jotted-plugin-console.jotted-plugin-pen.jotted-has-html .jotted-pane,.jotted-plugin-console.jotted-plugin-pen.jotted-has-css .jotted-pane,.jotted-plugin-console.jotted-plugin-pen.jotted-has-js .jotted-pane{width:50%}.jotted-plugin-console.jotted-plugin-pen.jotted-has-html.jotted-has-css .jotted-pane,.jotted-plugin-console.jotted-plugin-pen.jotted-has-html.jotted-has-js .jotted-pane,.jotted-plugin-console.jotted-plugin-pen.jotted-has-css.jotted-has-js .jotted-pane{width:33.33%}.jotted-plugin-console.jotted-plugin-pen.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane{width:25%}.jotted-plugin-pen-expander{position:absolute;height:100%;width:3px;z-index:5;cursor:col-resize;border-left:1px solid #ddd}.jotted-button-play{position:absolute;top:.52em;right:.52em;z-index:3}.jotted-nav-item,.jotted-pane{box-sizing:border-box}.jotted-theme-bin{overflow:hidden}.jotted-theme-bin .jotted-nav{clear:both}.jotted-theme-bin .jotted-nav-item{background:transparent;pointer-events:none;text-align:center}.jotted-theme-bin .jotted-nav-item,.jotted-theme-bin .jotted-pane{border-width:0 1px 0 0;border-style:solid;border-color:#ddd}.jotted-theme-bin .jotted-pane:last-child{border:0}.jotted-theme-bin .jotted-pane-result,.jotted-theme-bin.jotted-has-html .jotted-pane-html,.jotted-theme-bin.jotted-has-css .jotted-pane-css,.jotted-theme-bin.jotted-has-js .jotted-pane-js{position:relative;float:left;visibility:visible}.jotted-theme-bin .jotted-pane-result,.jotted-theme-bin .jotted-nav-item{width:100%}.jotted-theme-bin.jotted-has-html .jotted-nav-item,.jotted-theme-bin.jotted-has-css .jotted-nav-item,.jotted-theme-bin.jotted-has-js .jotted-nav-item,.jotted-theme-bin.jotted-has-html .jotted-pane,.jotted-theme-bin.jotted-has-css .jotted-pane,.jotted-theme-bin.jotted-has-js .jotted-pane{width:50%}.jotted-theme-bin.jotted-has-html.jotted-has-css .jotted-nav-item,.jotted-theme-bin.jotted-has-html.jotted-has-js .jotted-nav-item,.jotted-theme-bin.jotted-has-css.jotted-has-js .jotted-nav-item,.jotted-theme-bin.jotted-has-html.jotted-has-css .jotted-pane,.jotted-theme-bin.jotted-has-html.jotted-has-js .jotted-pane,.jotted-theme-bin.jotted-has-css.jotted-has-js .jotted-pane{width:33.33%}.jotted-theme-bin.jotted-has-html.jotted-has-css.jotted-has-js .jotted-nav-item,.jotted-theme-bin.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane{width:25%}.jotted-theme-bin .jotted-pane-console{position:relative;float:left;visibility:visible}.jotted-plugin-console.jotted-theme-bin.jotted-has-html .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-css .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-js .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-html .jotted-pane,.jotted-plugin-console.jotted-theme-bin.jotted-has-css .jotted-pane,.jotted-plugin-console.jotted-theme-bin.jotted-has-js .jotted-pane{width:33.33%}.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-css .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-js .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-css.jotted-has-js .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-css .jotted-pane,.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-js .jotted-pane,.jotted-plugin-console.jotted-theme-bin.jotted-has-css.jotted-has-js .jotted-pane{width:25%}.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-css.jotted-has-js .jotted-nav-item,.jotted-plugin-console.jotted-theme-bin.jotted-has-html.jotted-has-css.jotted-has-js .jotted-pane{width:20%} \ No newline at end of file diff --git a/BinaryDad.Coding/wwwroot/css/site.css b/BinaryDad.Coding/wwwroot/css/site.css index e679a8e..4f849e4 100644 --- a/BinaryDad.Coding/wwwroot/css/site.css +++ b/BinaryDad.Coding/wwwroot/css/site.css @@ -1,71 +1,7 @@ -/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification -for details on configuring this project to bundle and minify static web assets. */ +body { -a.navbar-brand { - white-space: normal; - text-align: center; - word-break: break-all; } -/* Provide sufficient contrast against white background */ -a { - color: #0366d6; -} - -.btn-primary { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -.nav-pills .nav-link.active, .nav-pills .show > .nav-link { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; -} - -/* Sticky footer styles --------------------------------------------------- */ -html { - font-size: 14px; -} -@media (min-width: 768px) { - html { - font-size: 16px; - } -} - -.border-top { - border-top: 1px solid #e5e5e5; -} -.border-bottom { - border-bottom: 1px solid #e5e5e5; -} - -.box-shadow { - box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); -} - -button.accept-policy { - font-size: 1rem; - line-height: inherit; -} - -/* Sticky footer styles --------------------------------------------------- */ -html { - position: relative; - min-height: 100%; -} - -body { - /* Margin bottom by footer height */ - margin-bottom: 60px; -} -.footer { - position: absolute; - bottom: 0; - width: 100%; - white-space: nowrap; - line-height: 60px; /* Vertically center the text there */ -} +textarea { + font-family: 'Roboto Mono', monospace; +} \ No newline at end of file diff --git a/BinaryDad.Coding/wwwroot/js/hub.js b/BinaryDad.Coding/wwwroot/js/hub.js index 571c01a..39cf65c 100644 --- a/BinaryDad.Coding/wwwroot/js/hub.js +++ b/BinaryDad.Coding/wwwroot/js/hub.js @@ -2,24 +2,24 @@ var connection = new signalR.HubConnectionBuilder().withUrl("/codeHub").build(); - let $code = $('#code'); - let $mirror = $('#mirror'); + //let $code = $('#code'); + //let $mirror = $('#mirror'); - $('#code').keyup(function () { + //$('#code').keyup(function () { - let user = 'ryan'; - let message = $code.val(); + // let user = 'ryan'; + // let message = $code.val(); - connection.invoke("SendMessage", user, message).catch(function (err) { - return console.error(err.toString()); - }); - }); + // connection.invoke("SendMessage", user, message).catch(function (err) { + // return console.error(err.toString()); + // }); + //}); - connection.on("ReceiveMessage", function (user, message) { + //connection.on("ReceiveMessage", function (user, message) { - $mirror.val(message); + // $mirror.val(message); - }); + //}); connection.start().then(function () { //$('#send').prop('disabled', false); diff --git a/BinaryDad.Coding/wwwroot/js/jotted/jotted.min.js b/BinaryDad.Coding/wwwroot/js/jotted/jotted.min.js new file mode 100644 index 0000000..9681715 --- /dev/null +++ b/BinaryDad.Coding/wwwroot/js/jotted/jotted.min.js @@ -0,0 +1 @@ +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Jotted=b()}(this,function(){"use strict";function a(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c={};return Object.keys(a).forEach(function(b){c[b]=a[b]}),Object.keys(b).forEach(function(d){"undefined"!=typeof c[d]?c[d]=a[d]:c[d]=b[d]}),c}function b(a,b){var c=new window.XMLHttpRequest;c.open("GET",a),c.responseType="text",c.onload=function(){200===c.status?b(null,c.responseText):b(a,c)},c.onerror=function(a){b(a)},c.send()}function c(a,b,c,e,f){return function(b,g){b&&e.push(b),a++,a2&&void 0!==arguments[2]?arguments[2]:function(){},e=[];return a.length?void d(0,b,a,e,c):c(e,b)}function f(a,b){var c=null,d=null;return function(){var e=this,f=arguments;c?d=!0:a.apply(this,arguments),clearTimeout(c),c=setTimeout(function(){d&&a.apply(e,f),c=null,d=null},b)}}function g(a,b){if(!a.className)return!1;var c=" "+a.className+" ";return b=" "+b+" ",c.indexOf(b)!==-1}function h(a,b){return g(a,b)?a.className:(a.className&&(b=" "+b),a.className+=b,a.className)}function i(a,b){var c=" "+b,d=b+" ";return a.className.indexOf(c)!==-1?a.className=a.className.replace(c,""):a.className.indexOf(d)!==-1?a.className=a.className.replace(d,""):a.className=a.className.replace(b,""),a.className}function j(a,b){return a.getAttribute("data-"+b)}function k(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},e=a(d,B);for(var f in e){var g=f.length;if(c.slice(-g++)==="."+f)return e[f]}for(var h in e)if(b===h)return e[h];return b}function l(){return'\n \n
\n
\n
\n
\n '}function m(a){return"jotted-pane-active-"+a}function n(){return"jotted"}function o(a){return"jotted-has-"+a}function p(a){return"jotted-editor jotted-editor-"+a}function q(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return'\n \n
\n '}function r(a){return"\n

"+a+"

\n "}function s(a){return"jotted-status-"+a}function t(a){return"jotted-status-active-"+a}function u(a){return"jotted-plugin-"+a}function v(a){return"Loading "+a+".."}function w(a){return"There was an error loading "+a+"."}function x(a){for(var b in F){var c=F[b];if(c._id===a)return c}throw new Error("Plugin "+a+" is not registered.")}function y(a,b){b._id=a,F.push(b)}function z(){var a=this;this._get("options").plugins.forEach(function(b){var c=void 0,d=void 0,e={};"string"==typeof b?d=b:"object"===("undefined"==typeof b?"undefined":C(b))&&(d=b.name,e=b.options||{}),c=x(d),a._get("plugins")[b]=new c(a,e),h(a._get("$container"),u(d))})}function A(a){a.plugin("render",H),a.plugin("scriptless",I),a.plugin("ace",J),a.plugin("codemirror",K),a.plugin("less",L),a.plugin("coffeescript",M),a.plugin("stylus",N),a.plugin("babel",O),a.plugin("markdown",P),a.plugin("console",Q),a.plugin("play",R),a.plugin("pen",S)}var B={html:"html",css:"css",js:"javascript",less:"less",styl:"stylus",coffee:"coffeescript"},C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},D=(function(){function a(a){this.value=a}function b(b){function c(a,b){return new Promise(function(c,e){var h={key:a,arg:b,resolve:c,reject:e,next:null};g?g=g.next=h:(f=g=h,d(a,b))})}function d(c,f){try{var g=b[c](f),h=g.value;h instanceof a?Promise.resolve(h.value).then(function(a){d("next",a)},function(a){d("throw",a)}):e(g.done?"return":"normal",g.value)}catch(a){e("throw",a)}}function e(a,b){switch(a){case"return":f.resolve({value:b,done:!0});break;case"throw":f.reject(b);break;default:f.resolve({value:b,done:!1})}f=f.next,f?d(f.key,f.arg):g=null}var f,g;this._invoke=c,"function"!=typeof b.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(b.prototype[Symbol.asyncIterator]=function(){return this}),b.prototype.next=function(a){return this._invoke("next",a)},b.prototype.throw=function(a){return this._invoke("throw",a)},b.prototype.return=function(a){return this._invoke("return",a)},{wrap:function(a){return function(){return new b(a.apply(this,arguments))}},await:function(b){return new a(b)}}}(),function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}),E=function(){function a(a,b){for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:90,d=this.find(a);b._priority=c,d.push(b),d.sort(function(a,b){return a._priority>b._priority?1:b._priority>a._priority?-1:0})}},{key:"remover",value:function(a,b){a.forEach(function(){if(!b)return void(a.length=0);var c=[].indexOf.call(a,b);c!==-1&&a.splice(c,1)})}},{key:"unsubscribe",value:function(a,b){var c=this.find(a);this.remover(c,b),this.callbacks[a]=this.callbacks[a]||[],this.remover(this.callbacks[a],b)}},{key:"publish",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=this.find(a),d=[];c.forEach(function(a){d.push(a)}),e(d,b,this.runCallbacks(a))}},{key:"runCallbacks",value:function(a){var b=this;return function(c,d){b.callbacks[a]=b.callbacks[a]||[],b.callbacks[a].forEach(function(a){a(c,d)})}}},{key:"done",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};this.callbacks[a]=this.callbacks[a]||[],this.callbacks[a].push(b)}}]),a}(),H=function(){function b(c,d){D(this,b),d=a(d,{});var e=!!("srcdoc"in document.createElement("iframe")),f=c.$container.querySelector(".jotted-pane-result iframe"),g="",h={html:"",css:"",js:""};window.addEventListener("message",this.domready.bind(this)),c.on("change",this.change.bind(this),100),this.supportSrcdoc=e,this.content=h,this.frameContent=g,this.$resultFrame=f,this.callbacks=[],this.index=0,this.lastCallback=function(){}}return E(b,[{key:"template",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return"\n \n \n \n \n\n \n \n \n "+b+"\n\n \n \n \n \n \n "}},{key:"change",value:function(a,b){var c=this;this.content[a.type]=a.content;var d=this.frameContent;if(this.frameContent=this.template(this.content.css,this.content.html,this.content.js),this.lastCallback=function(){c.lastCallback=function(){},b(null,a)},a.forceRender!==!0&&this.frameContent===d)return void b(null,a);if(this.supportSrcdoc){var e=document.createElement("iframe");this.$resultFrame.parentNode.replaceChild(e,this.$resultFrame),this.$resultFrame=e,this.$resultFrame.contentWindow.document.open(),this.$resultFrame.contentWindow.document.write(this.frameContent),this.$resultFrame.contentWindow.document.close()}else{this.$resultFrame.setAttribute("data-srcdoc",this.frameContent);var f='javascript:window.frameElement.getAttribute("data-srcdoc");';this.$resultFrame.setAttribute("src",f),this.$resultFrame.contentWindow&&(this.$resultFrame.contentWindow.location=f)}}},{key:"domready",value:function(a){if(a.source===this.$resultFrame.contentWindow){var b={};try{b=JSON.parse(a.data)}catch(a){}"jotted-dom-ready"===b.type&&this.lastCallback()}}}]),b}(),I=function(){function b(c,d){D(this,b),d=a(d,{});var e=["application/javascript","application/ecmascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"];c.on("change",this.change.bind(this)),this.runScriptTypes=e}return E(b,[{key:"change",value:function(a,b){if("html"!==a.type)return b(null,a);var c=document.createElement("div");c.innerHTML=a.content;for(var d=null,e=c.querySelectorAll("script"),f=0;f0&&void 0!==arguments[0]?arguments[0]:"",b=arguments[1],c=document.createElement("li");h(c,"jotted-console-log"),"undefined"!=typeof b&&h(c,"jotted-console-log-"+b),c.innerHTML=a,this.$output.appendChild(c)}},{key:"submit",value:function(a){var b=this.$input.value.trim();if(""===b)return a.preventDefault();this.history.push(b),this.historyIndex=this.history.length,this.log(b,"history"),0!==b.indexOf("return")&&(b="return "+b);try{var c=this.getIframe().contentWindow.eval("(function() {"+b+"})()");this.log(c)}catch(a){this.log(a,"error")}this.$input.value="",this.$container.scrollTop=this.$container.scrollHeight,a.preventDefault()}},{key:"clear",value:function(){this.$output.innerHTML=""}},{key:"history",value:function(a){var b=38,c=40,d=!1,e=this.$input.selectionStart;a.keyCode===b&&0!==this.historyIndex&&0===e&&(this.historyIndex--,d=!0),a.keyCode===c&&this.historyIndex!==this.history.length-1&&e===this.$input.value.length&&(this.historyIndex++,d=!0),d&&(this.$input.value=this.history[this.historyIndex])}}]),b}(),R=function(){function b(c,d){D(this,b),d=a(d,{firstRun:!0});var e=10,f={},g={};d.firstRun===!1&&(f={html:{type:"html",content:""},css:{type:"css",content:""},js:{type:"js",content:""}});var h=document.createElement("button");h.className="jotted-button jotted-button-play",h.innerHTML="Run",c.$container.appendChild(h),h.addEventListener("click",this.run.bind(this)),c.on("change",this.change.bind(this),e),this.cache=f,this.code=g,this.jotted=c}return E(b,[{key:"change",value:function(b,c){this.code[b.type]=a(b),"undefined"!=typeof this.cache[b.type]?(c(null,this.cache[b.type]),this.cache[b.type].forceRender=null):(this.cache[b.type]=a(b),c(null,b))}},{key:"run",value:function(){for(var b in this.code)this.cache[b]=a(this.code[b],{forceRender:!0}),this.jotted.trigger("change",this.cache[b])}}]),b}(),S=function(){function a(b,c){D(this,a);var d={html:{title:"HTML",classChecker:"jotted-has-html"},css:{title:"CSS",classChecker:"jotted-has-css"},js:{title:"JavaScript",classChecker:"jotted-has-js"},console:{title:"Console",classChecker:"jotted-plugin-console"}},e=[];for(var f in d)b.$container.classList.contains(d[f].classChecker)&&e.push(b.$container.querySelector(".jotted-pane-"+f));this.resizablePanes=[];for(var g=0;g0&&(j.expander=document.createElement("div"),j.expander.classList.add("jotted-plugin-pen-expander"),j.expander.addEventListener("mousedown",this.startExpand.bind(this,b)),l.insertBefore(j.expander,k))}}}return E(a,[{key:"startExpand",value:function(a,b){var c=this.resizablePanes.filter(function(a){return a.expander===b.target}).shift(),d=this.resizablePanes[this.resizablePanes.indexOf(c)-1],e=100/parseInt(window.getComputedStyle(c.container.parentNode).width,10);c.container.parentNode.style.display="none",c.startX=b.clientX,c.startWidth=parseFloat(window.getComputedStyle(c.container).width,10),d.startWidth=parseFloat(window.getComputedStyle(d.container).width,10),c.container.parentNode.style.display="",c.mousemove=this.doDrag.bind(this,c,d,e),c.mouseup=this.stopDrag.bind(this,c),document.addEventListener("mousemove",c.mousemove,!1),document.addEventListener("mouseup",c.mouseup,!1)}},{key:"doDrag",value:function(a,b,c,d){var e=b.startWidth+(d.clientX-a.startX)*c,f=a.startWidth-(d.clientX-a.startX)*c,g=10;e>=g&&f>=g&&(a.container.style.maxWidth="none",b.container.style.maxWidth="none",b.container.style.width=e+"%",a.container.style.width=f+"%")}},{key:"stopDrag",value:function(a,b){document.removeEventListener("mousemove",a.mousemove,!1),document.removeEventListener("mouseup",a.mouseup,!1)}}]),a}(),T=function(){function c(b,d){if(D(this,c),!b)throw new Error("Can't find Jotted container.");var e={};this._get=function(a){return e[a]},this._set=function(a,b){return e[a]=b,e[a]};var g=this._set("options",a(d,{files:[],showBlank:!1,runScripts:!0,pane:"result",debounce:250,plugins:[]}));g.plugins.push("render"),g.runScripts===!1&&g.plugins.push("scriptless"),this._set("cachedContent",{html:null,css:null,js:null});var i=this._set("pubsoup",new G);this._set("trigger",this.trigger()),this._set("on",function(){i.subscribe.apply(i,arguments)}),this._set("off",function(){i.unsubscribe.apply(i,arguments)});var j=this._set("done",function(){i.done.apply(i,arguments)});j("change",this.errors.bind(this));var k=this._set("$container",b);k.innerHTML=l(),h(k,n());var p=this._set("paneActive",g.pane);h(k,m(p)),this._set("$status",{});for(var q=["html","css","js"],r=0;r0&&void 0!==arguments[0]?arguments[0]:"error",b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!b.length)return this.clearStatus(a,c);var d=this._get("$status");h(d[c.type],s(a)),h(this._get("$container"),t(c.type));var e="";b.forEach(function(a){e+=r(a)}),d[c.type].innerHTML=e}},{key:"clearStatus",value:function(a,b){var c=this._get("$status");i(c[b.type],s(a)),i(this._get("$container"),t(b.type)),c[b.type].innerHTML=""}},{key:"trigger",value:function(){var a=this._get("options"),b=this._get("pubsoup");if(a.debounce===!1)return function(){b.publish.apply(b,arguments)};var c={},d={};return function(e){var f=arguments,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},h=g.type,i=void 0===h?"default":h;c[i]?d[i]=!0:b.publish.apply(b,arguments),clearTimeout(c[i]),c[i]=setTimeout(function(){d[i]&&b.publish.apply(b,f),d[i]=null,c[i]=null},a.debounce)}}}]),c}();return T.plugin=function(){return y.apply(this,arguments)},A(T),T}); \ No newline at end of file