Implement notifications for all messages

Implement option to get notifications also for message not just for mentions

Resolves: #446
This commit is contained in:
Nicolas Hohm 2015-11-14 17:57:19 +01:00
parent 62f56fed8a
commit 3fe78e8972
2 changed files with 12 additions and 2 deletions

View File

@ -258,6 +258,13 @@
<button id="play">Play sound</button>
</div>
</div>
<div class="col-sm-12">
<label class="opt">
<input type="checkbox" name="notifyAllMessages">
Enable notification for all messages
</label>
</div>
<div class="col-sm-12">
<h2>About Shout</h2>
</div>

View File

@ -347,6 +347,7 @@ $(function() {
part: true,
thumbnails: true,
quit: true,
notifyAllMessages: false,
}, $.cookie("settings"));
for (var i in options) {
@ -372,6 +373,7 @@ $(function() {
"nick",
"part",
"quit",
"notifyAllMessages",
].indexOf(name) !== -1) {
chat.toggleClass("hide-" + name, !self.prop("checked"));
}
@ -573,9 +575,10 @@ $(function() {
var isQuery = button.hasClass("query");
var type = msg.type;
var highlight = type.contains("highlight");
if (highlight || isQuery) {
var message = type.contains("message");
var settings = $.cookie("settings") || {};
if (highlight || isQuery || (settings.notifyAllMessages && message)) {
if (!document.hasFocus() || !$(target).hasClass("active")) {
var settings = $.cookie("settings") || {};
if (settings.notification) {
pop.play();
}