mirror of
https://github.com/thelounge/thelounge
synced 2024-11-29 07:20:25 +00:00
Usernames are now clickable
This commit is contained in:
parent
2516dce8cb
commit
be945fe4de
5 changed files with 66 additions and 52 deletions
|
@ -59,22 +59,25 @@ h2 {
|
|||
padding: 0 10px;
|
||||
width: 100%;
|
||||
}
|
||||
#chat .channel,
|
||||
#chat .network {
|
||||
#chat .window {
|
||||
background: #fff;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
#chat .network .close {
|
||||
display: none;
|
||||
}
|
||||
#chat .network .close,
|
||||
#chat .network .users {
|
||||
display: none;
|
||||
}
|
||||
#chat .network .messages {
|
||||
right: 0;
|
||||
}
|
||||
#chat .query .users {
|
||||
display: none;
|
||||
}
|
||||
#chat .query .messages {
|
||||
right: 0;
|
||||
}
|
||||
#chat .title {
|
||||
border-bottom: 1px solid #ccc;
|
||||
height: 43px;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{{#networks}}
|
||||
<div class="network list-group" data-id="{{id}}">
|
||||
{{#channels}}
|
||||
<a href="" class="channel list-group-item" data-id="{{id}}">
|
||||
<a href="" class="channel list-group-item" data-id="{{id}}" data-name="{{name}}">
|
||||
<span class="badge pull-right"></span>
|
||||
{{name}}
|
||||
</a>
|
||||
|
@ -50,9 +50,9 @@
|
|||
|
||||
<script type="text/html" id="users">
|
||||
{{#users}}
|
||||
<div class="user">
|
||||
<a href="{{name}}" class="user">
|
||||
{{mode}}{{name}}
|
||||
</div>
|
||||
</a>
|
||||
{{/users}}
|
||||
</script>
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
{{#messages}}
|
||||
<div class="message {{type}}">
|
||||
<span class="time">{{time}}</span>
|
||||
<span class="user">{{mode}}{{user}}</span>
|
||||
<a href="{{user}}" class="user">{{mode}}{{user}}</a>
|
||||
<span class="text">{{text}}</span>
|
||||
</div>
|
||||
{{/messages}}
|
||||
|
|
|
@ -65,6 +65,19 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
sidebar.on("click", ".channel", function(e) {
|
||||
e.preventDefault();
|
||||
sidebar.find(".active").removeClass("active");
|
||||
var item = $(this)
|
||||
.addClass("active")
|
||||
.find(".badge")
|
||||
.html("")
|
||||
.end();
|
||||
var id = item.data("id");
|
||||
chat.find(".window[data-id='" + id + "']")
|
||||
.bringToTop();
|
||||
});
|
||||
|
||||
chat.on("submit", "form", function() {
|
||||
var input = $(this).find(".input");
|
||||
var text = input.val();
|
||||
|
@ -82,7 +95,7 @@ $(function() {
|
|||
btn.prop("disabled", true);
|
||||
socket.emit("input", {
|
||||
id: btn.closest(".window").data("id"),
|
||||
text: "/leave"
|
||||
text: "/LEAVE"
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -92,17 +105,27 @@ $(function() {
|
|||
badge.html((parseInt(badge.html()) + 1) || "1");
|
||||
});
|
||||
|
||||
sidebar.on("click", ".channel", function(e) {
|
||||
chat.on("click", ".user", function(e) {
|
||||
e.preventDefault();
|
||||
sidebar.find(".active").removeClass("active");
|
||||
var item = $(this)
|
||||
.addClass("active")
|
||||
.find(".badge")
|
||||
.html("")
|
||||
.end();
|
||||
var id = item.data("id");
|
||||
chat.find(".window[data-id='" + id + "']")
|
||||
.bringToTop();
|
||||
});
|
||||
|
||||
chat.on("dblclick", ".user", function() {
|
||||
var user = $(this);
|
||||
var id = user.closest(".window").data("id");
|
||||
var name = user.attr("href");
|
||||
|
||||
var channel = sidebar
|
||||
.find(".channel[data-id='" + id + "']")
|
||||
.siblings(".channel[data-name='" + name + "']");
|
||||
if (channel.size() != 0) {
|
||||
channel.trigger("click");
|
||||
return;
|
||||
}
|
||||
|
||||
socket.emit("input", {
|
||||
id: id,
|
||||
text: "/QUERY " + name
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ var id = 1;
|
|||
|
||||
models.User = Backbone.Model.extend({
|
||||
defaults: {
|
||||
mode: "",
|
||||
name: ""
|
||||
}
|
||||
});
|
||||
|
|
|
@ -138,22 +138,6 @@ function handleInput(input) {
|
|||
);
|
||||
break;
|
||||
|
||||
case "QUERY":
|
||||
var irc = network.irc;
|
||||
if (!argv[1] || typeof irc === "undefined") {
|
||||
break;
|
||||
}
|
||||
|
||||
var channels = network.get("channels");
|
||||
if (argv[1].charAt(0) != "#" && !channels.findWhere({name: argv[1]})) {
|
||||
channels.add(
|
||||
new models.Channel({
|
||||
name: argv[1]
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case "TOPIC":
|
||||
var irc = network.irc;
|
||||
if (typeof irc === "undefined") {
|
||||
|
@ -192,6 +176,7 @@ function handleInput(input) {
|
|||
}
|
||||
break;
|
||||
|
||||
case "QUERY":
|
||||
case "WHOIS":
|
||||
var irc = network.irc;
|
||||
if (typeof irc !== "undefined") {
|
||||
|
@ -275,6 +260,7 @@ function handleEvent(argv) {
|
|||
if (typeof channel == "undefined") {
|
||||
channel = channels.add(
|
||||
new models.Channel({
|
||||
type: "query",
|
||||
name: target
|
||||
})
|
||||
);
|
||||
|
@ -551,6 +537,7 @@ function handleEvent(argv) {
|
|||
if (typeof channel == "undefined") {
|
||||
channel = channels.add(
|
||||
new models.Channel({
|
||||
type: "query",
|
||||
name: argv.args[1]
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue