From b0642ef52ef57f7220821daa3a8b78d7750c4ada Mon Sep 17 00:00:00 2001 From: Kenox Date: Fri, 4 Nov 2022 09:09:51 +0100 Subject: [PATCH] Update source --- static/application.js | 10 +++------- static/application.min.js | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/static/application.js b/static/application.js index 1bb8df4..2f444ae 100644 --- a/static/application.js +++ b/static/application.js @@ -237,11 +237,6 @@ haste.prototype.removeLineNumbers = function() { // Load a document and show it haste.prototype.loadDocument = function(key) { - // remove all code elements from the page - const elements = document.getElementsByTagName('code'); - while(elements.length > 0){ - elements[0].parentNode.removeChild(elements[0]); - } // Split the key up var parts = key.split('.', 2); // Ask for what we want @@ -296,8 +291,9 @@ haste.prototype.lockDocument = function() { pre.appendChild(code); code.onclick = function() { - window.location.hash = (i + 1).toString(); - // highlightNew(code); + var file = '/' + ret.key + "#" + (i + 1).toString(); + window.history.pushState(null, _this.appName + '-' + ret.key, file); + highlightNew(code); } } diff --git a/static/application.min.js b/static/application.min.js index e211aed..fbadbc6 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");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;o");e.appendChild(t),document.body.appendChild(e)},haste.prototype.loadDocument=function(e){const t=document.getElementsByTagName("code");for(;t.length>0;)t[0].parentNode.removeChild(t[0]);var o=e.split(".",2),n=this;n.doc=new haste_document,n.doc.load(o[0],function(e){if(e){for(var t=e.value.split(/\r\n|\r|\n/),o=0;o/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");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;o");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