Add slug with command to unhandled messages

This commit is contained in:
Daniel Oaks 2017-04-16 12:31:32 +03:00 committed by Pavel Djundik
parent 53e419355d
commit 5c336d3789
6 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1,5 @@
"use strict";
module.exports = function(orig) {
return orig.toLowerCase().replace(/[^a-z0-9]/, "-");
};

View File

@ -1,5 +1,5 @@
{{#each channels}}
<div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
<div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}} chan-{{slugify name}}">
<span class="badge{{#if highlight}} highlight{{/if}}">{{#if unread}}{{roundBadgeNumber unread}}{{/if}}</span>
<button class="close" aria-label="Close"></button>
<span class="name" title="{{name}}">{{name}}</span>

View File

@ -1,4 +1,4 @@
<div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" data-time="{{time}}">
<div class="msg msg-{{slugify command}} {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" data-time="{{time}}">
<span class="time tooltipped tooltipped-e" aria-label="{{localetime time}}">
{{tz time}}
</span>

View File

@ -1,5 +1,5 @@
{{#each networks}}
<section id="network-{{id}}" class="network" data-id="{{id}}" data-nick="{{nick}}" data-options="{{tojson serverOptions}}">
<section id="network-{{id}}" class="network name-{{slugify name}} network-{{slugify serverOptions.NETWORK}}" data-id="{{id}}" data-nick="{{nick}}" data-options="{{tojson serverOptions}}">
{{> chan}}
</section>
{{/each}}

View File

@ -25,6 +25,7 @@ function Network(attr) {
irc: null,
serverOptions: {
PREFIX: [],
NETWORK: "",
},
chanCache: [],
});

View File

@ -120,7 +120,7 @@ module.exports = function(irc, network) {
});
irc.on("server options", function(data) {
if (network.serverOptions.PREFIX === data.options.PREFIX) {
if (network.serverOptions.PREFIX === data.options.PREFIX && network.serverOptions.NETWORK === data.options.NETWORK) {
return;
}
@ -131,6 +131,7 @@ module.exports = function(irc, network) {
});
network.serverOptions.PREFIX = data.options.PREFIX;
network.serverOptions.NETWORK = data.options.NETWORK;
client.emit("network_changed", {
network: network.id,