Add a way to cycle through nicks on mobile

This was heavily inspired by https://github.com/maxpoulin64/lounge/commit/a877e46.
Clearly not a definitive solution but a good start to have and to improve upon.
This commit is contained in:
Jérémie Astori 2016-10-06 19:42:05 -04:00
parent 61a582f71f
commit ddaf7ff300
3 changed files with 19 additions and 1 deletions

View File

@ -141,6 +141,7 @@ button {
#footer .icon,
#chat .count:before,
#settings #play:before,
#form #cycle-nicks:before,
#form #submit:before,
#chat .invite .from:before,
#chat .join .from:before,
@ -186,6 +187,8 @@ button {
#footer .settings:before { content: "\f013"; /* http://fontawesome.io/icon/cog/ */ }
#footer .sign-out:before { content: "\f011"; /* http://fontawesome.io/icon/power-off/ */ }
#form #cycle-nicks:before { content: "\f007"; /* http://fontawesome.io/icon/user/ */ }
#form #submit:before { content: "\f1d8"; /* http://fontawesome.io/icon/paper-plane/ */ }
#chat .invite .from:before {
@ -1362,16 +1365,22 @@ button {
align-self: center;
}
#form #cycle-nicks,
#form #submit {
color: #9ca5b4;
font-size: 14px;
height: 32px;
transition: opacity .2s;
width: 32px;
width: 24px;
-webkit-flex: 0 0 auto;
flex: 0 0 auto;
}
#form #submit {
margin-right: 4px;
}
#form #cycle-nicks:hover,
#form #submit:hover {
opacity: .6;
}

View File

@ -66,6 +66,9 @@
--><span id="save-nick-tooltip" class="tooltipped tooltipped-e" aria-label="Save"><button id="submit-nick" type="button" aria-label="Save"></button></span>
</span>
<textarea id="input" class="mousetrap"></textarea>
<span id="cycle-nicks-tooltip" class="tooltipped tooltipped-w" aria-label="Cycle through nicks">
<button id="cycle-nicks" type="button" aria-label="Cycle through nicks"></button>
</span>
<span id="submit-tooltip" class="tooltipped tooltipped-w" aria-label="Send message">
<button id="submit" type="submit" aria-label="Send message"></button>
</span>

View File

@ -721,6 +721,12 @@ $(function() {
})
.tab(complete, {hint: false});
// Cycle through nicks for the current word, just like hitting "Tab"
$("#cycle-nicks").on("click", function() {
input.triggerHandler($.Event("keydown.tabcomplete", {which: 9}));
focus();
});
$("#form").on("submit", function(e) {
e.preventDefault();
var text = input.val();