Fix text selection

This commit is contained in:
Mattias Erming 2014-09-29 12:48:14 -07:00
parent 9947b537b6
commit 8b392a9fa0
2 changed files with 17 additions and 4 deletions

View file

@ -386,7 +386,20 @@ $(function() {
}); });
}); });
chat.on("click", ".messages", focus); chat.on("click", ".messages", function() {
setTimeout(function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
if (!text) {
focus();
}
}, 2);
});
$(window).on("focus", focus); $(window).on("focus", focus);
function focus() { function focus() {
@ -641,13 +654,13 @@ $(function() {
var direction = keys.split("+").pop(); var direction = keys.split("+").pop();
switch (direction) { switch (direction) {
case "up": case "up":
// Wrap around! // Loop
var upTarget = (channels.length + (index - 1 + channels.length)) % channels.length; var upTarget = (channels.length + (index - 1 + channels.length)) % channels.length;
channels.eq(upTarget).click(); channels.eq(upTarget).click();
break; break;
case "down": case "down":
// Wrap aroud! // Loop
var downTarget = (channels.length + (index + 1 + channels.length)) % channels.length; var downTarget = (channels.length + (index + 1 + channels.length)) % channels.length;
channels.eq(downTarget).click(); channels.eq(downTarget).click();
break; break;

View file

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "The self-hosted web IRC client", "description": "The self-hosted web IRC client",
"version": "0.38.7", "version": "0.38.8",
"author": "Mattias Erming", "author": "Mattias Erming",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {