Merge pull request #2289 from lol768/master
Add auto-prepend behaviour for unprefixed channel names
This commit is contained in:
commit
fe08547d6b
@ -414,7 +414,19 @@ $(function() {
|
|||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in#Iterating_over_own_properties_only
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in#Iterating_over_own_properties_only
|
||||||
for (let key in params) {
|
for (let key in params) {
|
||||||
if (params.hasOwnProperty(key)) {
|
if (params.hasOwnProperty(key)) {
|
||||||
const value = params[key];
|
let value = params[key];
|
||||||
|
|
||||||
|
if (key === "join") {
|
||||||
|
const channels = value.split(",");
|
||||||
|
value = channels.map((c) => {
|
||||||
|
if (c.match(/^\w/)) {
|
||||||
|
return "#" + c;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}).join(",");
|
||||||
|
}
|
||||||
|
|
||||||
// \W searches for non-word characters
|
// \W searches for non-word characters
|
||||||
key = key.replace(/\W/g, "");
|
key = key.replace(/\W/g, "");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user