mirror of https://github.com/calzoneman/sync.git
Make links unaffected by chat filters
This commit is contained in:
parent
4fe8ab164d
commit
d0b3f9014a
13
channel.js
13
channel.js
|
@ -1269,14 +1269,21 @@ Channel.prototype.chainMessage = function(user, msg, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.filterMessage = function(msg) {
|
Channel.prototype.filterMessage = function(msg) {
|
||||||
msg = msg.replace(/(((https?)|(ftp))(:\/\/[0-9a-zA-Z\.]+(:[0-9]+)?[^\s$]+))/g, "<a href=\"$1\" target=\"_blank\">$1</a>");
|
const link = /((?:(?:https?)|(?:ftp))(?::\/\/[0-9a-zA-Z\.]+(?::[0-9]+)?[^\s$]+))/g;
|
||||||
|
var subs = msg.split(link);
|
||||||
// Apply other filters
|
// Apply other filters
|
||||||
|
for(var j = 0; j < subs.length; j++) {
|
||||||
|
if(subs[j].match(link)) {
|
||||||
|
subs[j] = subs[j].replace(link, "<a href=\"$1\" target=\"blank\">$1</a>");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for(var i = 0; i < this.filters.length; i++) {
|
for(var i = 0; i < this.filters.length; i++) {
|
||||||
if(!this.filters[i].active)
|
if(!this.filters[i].active)
|
||||||
continue;
|
continue;
|
||||||
msg = this.filters[i].filter(msg);
|
subs[j] = this.filters[i].filter(subs[j]);
|
||||||
}
|
}
|
||||||
return msg;
|
}
|
||||||
|
return subs.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.sendMessage = function(username, msg, msgclass, data) {
|
Channel.prototype.sendMessage = function(username, msg, msgclass, data) {
|
||||||
|
|
|
@ -379,7 +379,6 @@ Media.prototype.update = function(data) {
|
||||||
this.getTime(function(seconds) {
|
this.getTime(function(seconds) {
|
||||||
var time = data.currentTime;
|
var time = data.currentTime;
|
||||||
var diff = time - seconds || time;
|
var diff = time - seconds || time;
|
||||||
console.log(this);
|
|
||||||
|
|
||||||
if(diff > USEROPTS.sync_accuracy) {
|
if(diff > USEROPTS.sync_accuracy) {
|
||||||
this.seek(time);
|
this.seek(time);
|
||||||
|
|
Loading…
Reference in New Issue