Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Implement notifications for all messages #540

Merged
merged 1 commit into from
Jan 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ <h2>Notifications</h2>
<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>
Expand Down
7 changes: 5 additions & 2 deletions client/js/shout.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ $(function() {
part: true,
thumbnails: true,
quit: true,
notifyAllMessages: false,
}, $.cookie("settings"));

for (var i in options) {
Expand All @@ -372,6 +373,7 @@ $(function() {
"nick",
"part",
"quit",
"notifyAllMessages",
].indexOf(name) !== -1) {
chat.toggleClass("hide-" + name, !self.prop("checked"));
}
Expand Down Expand Up @@ -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();
}
Expand Down