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:
Leo Franchi
2013-07-12 14:12:12 -04:00
parent 218a7dc1bd
commit 017bd6b8b1

View File

@@ -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) {