Merge pull request #1294 from awalgarg/autocomplete-optout
Allow opting out of autocomplete
This commit is contained in:
commit
b1fa78665c
@ -266,6 +266,10 @@
|
||||
<input type="checkbox" name="coloredNicks">
|
||||
Enable colored nicknames
|
||||
</label>
|
||||
<label class="opt">
|
||||
<input type="checkbox" name="autocomplete">
|
||||
Enable autocomplete
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<h2>Theme</h2>
|
||||
|
@ -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)) {
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user