From d9813e6244e8be9c11a1705442a1d98d9b5373af Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sat, 15 Jul 2017 14:48:53 -0700 Subject: [PATCH] Remove legacy tab complete (no longer used) --- package.json | 2 +- www/js/ui.js | 80 +--------------------------------------------------- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/package.json b/package.json index 188763ea..e06099dd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.40.0", + "version": "3.40.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/www/js/ui.js b/www/js/ui.js index b949a274..889afc3f 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -112,91 +112,13 @@ $("#guestname").keydown(function (ev) { }); -/** - * TODO: Remove this post-deployment - */ -function oldChatTabComplete() { - var words = $("#chatline").val().split(" "); - var current = words[words.length - 1].toLowerCase(); - if (!current.match(/^[\w-]{1,20}$/)) { - return; - } - - var __slice = Array.prototype.slice; - var usersWithCap = __slice.call($("#userlist").children()).map(function (elem) { - return elem.children[1].innerHTML; - }); - var users = __slice.call(usersWithCap).map(function (user) { - return user.toLowerCase(); - }).filter(function (name) { - return name.indexOf(current) === 0; - }); - - // users now contains a list of names that start with current word - - if (users.length === 0) { - return; - } - - // trim possible names to the shortest possible completion - var min = Math.min.apply(Math, users.map(function (name) { - return name.length; - })); - users = users.map(function (name) { - return name.substring(0, min); - }); - - // continually trim off letters until all prefixes are the same - var changed = true; - var iter = 21; - while (changed) { - changed = false; - var first = users[0]; - for (var i = 1; i < users.length; i++) { - if (users[i] !== first) { - changed = true; - break; - } - } - - if (changed) { - users = users.map(function (name) { - return name.substring(0, name.length - 1); - }); - } - - // In the event something above doesn't generate a break condition, limit - // the maximum number of repetitions - if (--iter < 0) { - break; - } - } - - current = users[0].substring(0, min); - for (var i = 0; i < usersWithCap.length; i++) { - if (usersWithCap[i].toLowerCase() === current) { - current = usersWithCap[i]; - break; - } - } - - if (users.length === 1) { - if (words.length === 1) { - current += ":"; - } - current += " "; - } - words[words.length - 1] = current; - $("#chatline").val(words.join(" ")); -} - CyTube.chatTabCompleteData = { context: {} }; function chatTabComplete() { if (!CyTube.tabCompleteMethods) { - oldChatTabComplete(); + console.error('Missing CyTube.tabCompleteMethods!'); return; } var chatline = document.getElementById("chatline");