Prevent External Links in the Chatbox
(Versions 1.3 - 1.9.1)This small plug in will allow you to prevent users posting links to other sites in your chatbox, but they will still be able to post links to your site.
If you use the chatbox here at AvacWeb you'll notice I've implemented this at AvacWeb.
I've also added an option for you to allow sites which contain certain strings, fill in as many as you want.
Simply install this message hook:
- Code:
avacweb_chat_config.message_hook.push(function(row, username, user_id, usr, msg) {
var links = msg.getElementsByTagName('a'), whitelist = [location.hostname, 'youtube', 'twitter', 'facebook'];
for(var i = 0, l; (l = links[i++]); ) {
if(l.href.charAt(0) !== '/' && !l.href.match(RegExp('(' + whitelist.join('|') + ')', 'i'))) {
l.href = '/';
l.innerHTML = '[External links are banned in the chatbox]';
}
}
});
You can also change this line [ic]l.innerHTML = '[External links are banned in the chatbox]';[/ic] to whatever you want it to say.