mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
Don't limit ourselves to webkit for audible notifications
Previously we were checking for webkit before checking for
$('<audio>') support, but that cuts out non-webkit browsers that support
the basics of the HTML5 audio api.
Now we actually run the feature test in order to enable it, and only
check for webkit when enabling webkit-specific desktop notifications
(imported from commit 851eed86af167d0530f7e1793e2ca1f9b4cdd71d)
This commit is contained in:
@@ -51,20 +51,6 @@ exports.initialize = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window.webkitNotifications) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(document).click(function () {
|
||||
if (!page_params.desktop_notifications_enabled || asked_permission_already) {
|
||||
return;
|
||||
}
|
||||
if (window.webkitNotifications.checkPermission() !== 0) { // 0 is PERMISSION_ALLOWED
|
||||
window.webkitNotifications.requestPermission(function () {});
|
||||
asked_permission_already = true;
|
||||
}
|
||||
});
|
||||
|
||||
var audio = $("<audio>");
|
||||
if (audio[0].canPlayType === undefined) {
|
||||
supports_sound = false;
|
||||
@@ -81,6 +67,18 @@ exports.initialize = function () {
|
||||
.attr("src", "/static/audio/humbug.mp3"));
|
||||
}
|
||||
}
|
||||
|
||||
if (window.webkitNotifications) {
|
||||
$(document).click(function () {
|
||||
if (!page_params.desktop_notifications_enabled || asked_permission_already) {
|
||||
return;
|
||||
}
|
||||
if (window.webkitNotifications.checkPermission() !== 0) { // 0 is PERMISSION_ALLOWED
|
||||
window.webkitNotifications.requestPermission(function () {});
|
||||
asked_permission_already = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.update_title_count = function (new_message_count) {
|
||||
|
||||
Reference in New Issue
Block a user