Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Improve message completion #539

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Unreleased
==========

* Improve message completion

0.51.2 / 2015-09-18
==================

Expand Down
11 changes: 10 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ <h2>Notifications</h2>
<button id="play">Play sound</button>
</div>
</div>
<div class="col-sm-12">
<h2>Other</h2>
</div>
<div class="col-sm-12">
<div class="form-group">
<label for="afterComplete" style="padding-right: 10px">Text to append after username completion</label>
<input type="text" name="afterComplete" id="afterComplete" size="5">
</div>
</div>
<div class="col-sm-12">
<h2>About Shout</h2>
</div>
Expand All @@ -278,7 +287,7 @@ <h2>About Shout</h2>
</button>
<div class="input">
<label for="input" id="nick"></label>
<input id="input" class="mousetrap">
<input id="input" class="mousetrap" autocomplete="off">
</div>
</div>
</form>
Expand Down
20 changes: 17 additions & 3 deletions client/js/shout.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ $(function() {
part: true,
thumbnails: true,
quit: true,
afterComplete: "",
}, $.cookie("settings"));

for (var i in options) {
Expand All @@ -358,7 +359,11 @@ $(function() {
settings.on("change", "input", function() {
var self = $(this);
var name = self.attr("name");
options[name] = self.prop("checked");
if (self.is(":checkbox")) {
options[name] = self.prop("checked");
} else {
options[name] = self.val();
}
$.cookie(
"settings",
options, {
Expand All @@ -378,6 +383,9 @@ $(function() {
if (name === "colors") {
chat.toggleClass("no-colors", !self.prop("checked"));
}
if (name === "afterComplete") {
initTabCompletion();
}
}).find("input")
.trigger("change");

Expand All @@ -404,8 +412,14 @@ $(function() {
});

var input = $("#input")
.history()
.tab(complete, {hint: false});
.history();

initTabCompletion();

function initTabCompletion() {
var settings = $.cookie("settings") || {};
$("#input").tab(complete, {hint: false, after: settings.afterComplete});
}

var form = $("#form");

Expand Down