Send a message when a user enters reading mode
(Versions 1.3+)This plug in will install a feature for you that when a user clicks the "Reading" button a message will be sent saying "Username has entered Reading mode", and when they click to return to normal it will send a message saying "Username has exited Reading Mode".
First, if your AWC installation is non-english you may need to add these entries into the AWC Translation object[tip]Which you should be familiar with if you have translated your AWC[/tip]:
[ic]"has entered reading mode" : "has entered Reading Mode."[/ic]
[ic]"has exited reading mode" : "has exited Reading Mode."[/ic]
Now for the actual Javascript Plug in. It's a different code depending on your AWC version.
For versions 1.6+ use this:
- Code:
avacweb_chat_config.add_event('onload', function() {
$( avacweb_chat.id('achat_reading') ).click(function() {
if(avacweb_chat.reading) {
avacweb_chat.send_message('/me ' + avacweb_chat.t('has entered Reading Mode'));
}
else {
avacweb_chat.send_message('/me ' + avacweb_chat.t('has exited Reading Mode'));
}
});
});
For version 1.9+ use this:
- Code:
[panda=js]avacweb_chat_config.add_event('onsettingchange', function(e) {
if(e.data === 'reading') {
this.send_message('/me ' + this.t( this.settings.on('reading') ? 'has entered reading mode' : 'has exited reading mode' ) );
}
});
For version 2.0+ use this:
- Code:
[panda=js]avacweb_chat_config.add_event('onsettingchange', function(e) {
if(e.data === 'reading') {
this.submit('/me ' + this.t( this.settings.on('reading') ? 'has entered reading mode' : 'has exited reading mode' ) );
}
});