diff --git a/static/application.js b/static/application.js index 2d23285..9cc7e7d 100644 --- a/static/application.js +++ b/static/application.js @@ -248,18 +248,18 @@ haste.prototype.loadDocument = function(key) { _this.doc = new haste_document(); _this.doc.load(parts[0], function(ret) { if (ret) { - var lines = ret.value.split(/\r\n|\r|\n/); - for (var i = 0; i < lines.length; i++) { - let code = document.createElement('code'); - code.innerHTML = lines[i]; - let pre = document.getElementById("box"); - pre.appendChild(code); + const lines = ret.value.split(/\r\n|\r|\n/); + for (let i = 0; i < lines.length; i++) { + let code = document.createElement('code'); + code.innerHTML = lines[i]; + let pre = document.getElementById("box"); + pre.appendChild(code); - code.onclick = function() { - var file = '/' + ret.key + "#" + (i + 1).toString(); - window.history.pushState(null, _this.appName + '-' + ret.key, file); - highlightNew(code); - } + code.onclick = function() { + var file = '/' + ret.key + "#" + (i + 1).toString(); + window.history.pushState(null, _this.appName + '-' + ret.key, file); + highlightNew(code); + } } _this.setTitle(ret.key); diff --git a/static/application.min.js b/static/application.min.js index 0c17d4d..c747395 100644 --- a/static/application.min.js +++ b/static/application.min.js @@ -1 +1 @@ -const workersUrl="https://api.knx.cool/";var haste_document=function(){this.locked=!1};htmlEscape=function(e){return e.replace(/&/g,"&").replace(/>/g,">").replace(/0;)t[0].parentNode.removeChild(t[0])}function highlightNew(e){const t=document.getElementsByTagName("code");let o=0;for(let e=0;eo&&(o=t[e].offsetWidth),t[e].style.removeProperty("background-color");const n=$(document).width();n>o&&(o=n);for(let e=0;e'+e+"");$("#messages").prepend(o),setTimeout(function(){o.slideUp("fast",function(){$(this).remove()})},3e3)},haste.prototype.lightKey=function(){this.configureKey(["new","save"])},haste.prototype.fullKey=function(){this.configureKey(["new","duplicate","raw"])},haste.prototype.configureKey=function(e){var t,o=0;$("#box2 .function").each(function(){for(t=$(this),o=0;o0;)t[0].parentNode.removeChild(t[0]);this.$box.hide(),this.doc=new haste_document,this.setTitle(),this.lightKey(),this.$textarea.val("").show("fast",function(){this.focus()}),this.removeLineNumbers()},haste.extensionMap={rb:"ruby",py:"python",pl:"perl",php:"php",scala:"scala",go:"go",xml:"xml",html:"xml",htm:"xml",css:"css",js:"javascript",vbs:"vbscript",lua:"lua",pas:"delphi",java:"java",cpp:"cpp",cc:"cpp",m:"objectivec",vala:"vala",sql:"sql",sm:"smalltalk",lisp:"lisp",ini:"ini",diff:"diff",bash:"bash",sh:"bash",tex:"tex",erl:"erlang",hs:"haskell",md:"markdown",txt:"",coffee:"coffee",swift:"swift"},haste.prototype.lookupExtensionByType=function(e){for(var t in haste.extensionMap)if(haste.extensionMap[t]===e)return t;return e},haste.prototype.lookupTypeByExtension=function(e){return haste.extensionMap[e]||e},haste.prototype.addLineNumbers=function(e){if(removeElementsByClass("linenumber"),window.location.hash){highlightNew(getLineElement(window.location.hash.substring(1)))}},haste.prototype.removeLineNumbers=function(){removeElementsByClass("highlight"),removeElementsByClass("linenumber");let e=document.createElement("a");e.classList.add("linenumber");let t=document.createTextNode(">");e.appendChild(t),document.body.appendChild(e)},haste.prototype.loadDocument=function(e){var t=e.split(".",2),o=this;o.doc=new haste_document,o.doc.load(t[0],function(e){if(e){for(var t=e.value.split(/\r\n|\r|\n/),n=0;n/g,">").replace(/0;)t[0].parentNode.removeChild(t[0])}function highlightNew(e){const t=document.getElementsByTagName("code");let o=0;for(let e=0;eo&&(o=t[e].offsetWidth),t[e].style.removeProperty("background-color");const n=$(document).width();n>o&&(o=n);for(let e=0;e'+e+"");$("#messages").prepend(o),setTimeout(function(){o.slideUp("fast",function(){$(this).remove()})},3e3)},haste.prototype.lightKey=function(){this.configureKey(["new","save"])},haste.prototype.fullKey=function(){this.configureKey(["new","duplicate","raw"])},haste.prototype.configureKey=function(e){var t,o=0;$("#box2 .function").each(function(){for(t=$(this),o=0;o0;)t[0].parentNode.removeChild(t[0]);this.$box.hide(),this.doc=new haste_document,this.setTitle(),this.lightKey(),this.$textarea.val("").show("fast",function(){this.focus()}),this.removeLineNumbers()},haste.extensionMap={rb:"ruby",py:"python",pl:"perl",php:"php",scala:"scala",go:"go",xml:"xml",html:"xml",htm:"xml",css:"css",js:"javascript",vbs:"vbscript",lua:"lua",pas:"delphi",java:"java",cpp:"cpp",cc:"cpp",m:"objectivec",vala:"vala",sql:"sql",sm:"smalltalk",lisp:"lisp",ini:"ini",diff:"diff",bash:"bash",sh:"bash",tex:"tex",erl:"erlang",hs:"haskell",md:"markdown",txt:"",coffee:"coffee",swift:"swift"},haste.prototype.lookupExtensionByType=function(e){for(var t in haste.extensionMap)if(haste.extensionMap[t]===e)return t;return e},haste.prototype.lookupTypeByExtension=function(e){return haste.extensionMap[e]||e},haste.prototype.addLineNumbers=function(e){if(removeElementsByClass("linenumber"),window.location.hash){highlightNew(getLineElement(window.location.hash.substring(1)))}},haste.prototype.removeLineNumbers=function(){removeElementsByClass("highlight"),removeElementsByClass("linenumber");let e=document.createElement("a");e.classList.add("linenumber");let t=document.createTextNode(">");e.appendChild(t),document.body.appendChild(e)},haste.prototype.loadDocument=function(e){var t=e.split(".",2),o=this;o.doc=new haste_document,o.doc.load(t[0],function(e){if(e){const t=e.value.split(/\r\n|\r|\n/);for(let n=0;n