From 698bdb7da8006b66c55ee577b5ccb80fd8c69248 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 30 Dec 2016 11:36:20 +0000 Subject: [PATCH] fix bug --- _embed/public/js/common.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index 40f7fa14..b227ba5e 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -167,7 +167,8 @@ function deleteEvent(event) { buttons.delete.changeToDone(request.status != 204, html); } } - r.send(); + + request.send(); }); return false; @@ -211,9 +212,15 @@ function searchEvent(event) { if (event.keyCode == 13) { box.innerHTML = ''; search.classList.add('ongoing'); + + let url = window.location.host + window.location.pathname; + + if (document.getElementById("editor")) { + url = removeLastDirectoryPartOf(url); + } if (supported && user.AllowCommands) { - let conn = new WebSocket('ws://' + window.location.host + window.location.pathname + '?command=true'); + let conn = new WebSocket(`ws://${url}?command=true`); conn.onopen = function() { conn.send(value); @@ -235,7 +242,7 @@ function searchEvent(event) { box.innerHTML = ''; let ul = box.querySelector('ul'), - conn = new WebSocket('ws://' + window.location.host + window.location.pathname + '?search=true'); + conn = new WebSocket(`ws://${url}?search=true`); conn.onopen = function() { conn.send(value);