Optionally play a sound on notification
Fixes #42 TODO: find and add a sound file
This commit is contained in:
parent
392ded6326
commit
aecae9f0e6
2 changed files with 21 additions and 0 deletions
12
index.html
12
index.html
|
@ -266,6 +266,8 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<div id="footer" ng-show="connected">
|
<div id="footer" ng-show="connected">
|
||||||
<div class="navbar navbar-inverse navbar-fixed-bottom" ng-class="{'withnicklist': showNicklist, 'withsidebar': showSidebar}">
|
<div class="navbar navbar-inverse navbar-fixed-bottom" ng-class="{'withnicklist': showNicklist, 'withsidebar': showSidebar}">
|
||||||
<div input-bar input-id="sendMessage"></div>
|
<div input-bar input-id="sendMessage"></div>
|
||||||
|
</div>
|
||||||
|
<div id="soundNotification"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsModal" class="modal fade">
|
<div id="settingsModal" class="modal fade">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
@ -347,6 +349,16 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<form class="form-inline" role="form">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" ng-model="soundnotification">
|
||||||
|
Play sound on notification
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<form class="form-inline" role="form">
|
<form class="form-inline" role="form">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|
|
@ -685,6 +685,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$store.bind($scope, "useFavico", true);
|
$store.bind($scope, "useFavico", true);
|
||||||
// Save setting for notimestamp
|
// Save setting for notimestamp
|
||||||
$store.bind($scope, "notimestamp", notimestamp);
|
$store.bind($scope, "notimestamp", notimestamp);
|
||||||
|
// Save setting for playing sound on notification
|
||||||
|
$store.bind($scope, "soundnotification", false);
|
||||||
|
|
||||||
// Save setting for displaying embeds in rootScope so it can be used from service
|
// Save setting for displaying embeds in rootScope so it can be used from service
|
||||||
$rootScope.visible = $scope.noembed === false;
|
$rootScope.visible = $scope.noembed === false;
|
||||||
|
@ -876,6 +878,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
window.focus();
|
window.focus();
|
||||||
notification.close();
|
notification.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ($scope.soundnotification) {
|
||||||
|
// TODO fill in a sound file
|
||||||
|
var audioFile = "assets/rickroll";
|
||||||
|
var soundHTML = '<audio autoplay="autoplay"><source src="' + audioFile + '.ogg" type="audio/ogg" /><source src="' + audioFile + '.mp3" type="audio/mpeg" /></audio>';
|
||||||
|
document.getElementById("soundNotification").innerHTML = soundHTML;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.hasUnread = function(buffer) {
|
$scope.hasUnread = function(buffer) {
|
||||||
|
|
Loading…
Reference in a new issue