From e0e48925b574a1afdd0f6b528e0725064ae9ef8e Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 8 Jul 2018 22:20:49 +0300 Subject: [PATCH] Remove input history --- client/js/autocompletion.js | 2 -- client/js/keybinds.js | 55 ------------------------------------- 2 files changed, 57 deletions(-) diff --git a/client/js/autocompletion.js b/client/js/autocompletion.js index 76a209a4..5a28c4f6 100644 --- a/client/js/autocompletion.js +++ b/client/js/autocompletion.js @@ -30,8 +30,6 @@ $("#form").on("submit", () => { } }); -const chat = $("#chat"); -const sidebar = $("#sidebar"); const emojiSearchTerms = Object.keys(emojiMap); const emojiStrategy = { id: "emoji", diff --git a/client/js/keybinds.js b/client/js/keybinds.js index 0f576896..47f2936a 100644 --- a/client/js/keybinds.js +++ b/client/js/keybinds.js @@ -97,61 +97,6 @@ Mousetrap.bind([ const inputTrap = Mousetrap(input.get(0)); -function enableHistory() { - const history = [""]; - let position = 0; - - input.on("input", () => { - position = 0; - }); - - inputTrap.bind("enter", function(e) { - position = 0; - const input = $(e.target); - - if (input.data("autocompleting")) { - return false; - } - - const text = input.val(); - - if (text.length === 0) { - return false; - } - - // Store new message in history if last message isn't already equal - if (history[1] !== text) { - history.splice(1, 0, text); - } - - return false; - }); - - inputTrap.bind(["up", "down"], function(e, key) { - if (e.target.selectionStart !== e.target.selectionEnd || input.data("autocompleting")) { - return; - } - - if (position === 0) { - history[position] = input.val(); - } - - if (key === "up") { - if (position < history.length - 1) { - position++; - } - } else if (position > 0) { - position--; - } - - input.val(history[position]); - - return false; - }); -} - -enableHistory(); - const colorsHotkeys = { k: "\x03", b: "\x02",