diff --git a/client/index.html b/client/index.html index ca1a87e7..1e358be4 100644 --- a/client/index.html +++ b/client/index.html @@ -266,6 +266,10 @@ Enable colored nicknames +

Theme

diff --git a/client/js/lounge.js b/client/js/lounge.js index 27faa8b8..2057c722 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -267,7 +267,16 @@ $(function() { chat.find(".chan.active .chat").trigger("msg.sticky"); // fix growing }) .tab(completeNicks, {hint: false}) - .textcomplete([ + .on("autocomplete:on", function() { + enableAutocomplete(); + }); + + if (options.autocomplete) { + enableAutocomplete(); + } + + function enableAutocomplete() { + input.textcomplete([ emojiStrategy, nicksStrategy, chanStrategy, commandStrategy, foregroundColorStrategy, backgroundColorStrategy ], { @@ -281,6 +290,7 @@ $(function() { $(this).data("autocompleting", false); } }); + } var focus = $.noop; if (!("ontouchstart" in window || navigator.maxTouchPoints > 0)) { diff --git a/client/js/options.js b/client/js/options.js index a0e1fa50..cd38b37f 100644 --- a/client/js/options.js +++ b/client/js/options.js @@ -25,7 +25,8 @@ const options = $.extend({ theme: $("#theme").attr("href").replace(/^themes\/(.*).css$/, "$1"), // Extracts default theme name, set on the server configuration thumbnails: true, userStyles: userStyles.text(), - highlights: [] + highlights: [], + autocomplete: true }, JSON.parse(storage.get("settings"))); module.exports = options; @@ -94,6 +95,12 @@ settings.on("change", "input, select, textarea", function() { chat.find(".msg > .time").each(function() { $(this).text(tz($(this).parent().data("time"))); }); + } else if (name === "autocomplete") { + if (self.prop("checked")) { + $("#input").trigger("autocomplete:on"); + } else { + $("#input").textcomplete("destroy"); + } } }).find("input") .trigger("change");