Add slug with command to unhandled messages
This commit is contained in:
parent
53e419355d
commit
5c336d3789
5
client/js/libs/handlebars/slugify.js
Normal file
5
client/js/libs/handlebars/slugify.js
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(orig) {
|
||||
return orig.toLowerCase().replace(/[^a-z0-9]/, "-");
|
||||
};
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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}}
|
||||
|
@ -25,6 +25,7 @@ function Network(attr) {
|
||||
irc: null,
|
||||
serverOptions: {
|
||||
PREFIX: [],
|
||||
NETWORK: "",
|
||||
},
|
||||
chanCache: [],
|
||||
});
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user