diff --git a/static/application.js b/static/application.js index c9183be..8bdaded 100644 --- a/static/application.js +++ b/static/application.js @@ -180,10 +180,10 @@ haste.prototype.addLineNumbers = function(lineCount) { const hash = window.location.hash.substring(1); highlightNew(getLineElement(hash)); - /*document.getElementById('line' + hash).scrollIntoView({ + getLineElement(hash).scrollIntoView({ behavior: 'smooth', block: 'center' - });*/ + }); } /*for (var i = 0; i < lineCount; i++) { let div = document.createElement('a'); diff --git a/static/application.min.js b/static/application.min.js index 0ecd109..8096965 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=$(window).width();console.log("Window width: "+n+" - MaxWidth: "+o),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/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=$(window).width();console.log("Window width: "+n+" - MaxWidth: "+o),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){const e=window.location.hash.substring(1);highlightNew(getLineElement(e)),getLineElement(e).scrollIntoView({behavior:"smooth",block:"center"})}},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