Improved favicon on notify
This commit is contained in:
parent
eb3d30324f
commit
dc1c2aa9c8
@ -8,7 +8,7 @@
|
|||||||
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
|
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
|
||||||
<link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/>
|
<link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/>
|
||||||
<link rel="stylesheet" href="css/app.css?11"/>
|
<link rel="stylesheet" href="css/app.css?11"/>
|
||||||
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||||
|
|
||||||
<meta property="og:title" content="Webogram">
|
<meta property="og:title" content="Webogram">
|
||||||
<meta property="og:url" content="http://zhukov.github.io/webogram/">
|
<meta property="og:url" content="http://zhukov.github.io/webogram/">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript" src="js/util.js"></script>
|
<script type="text/javascript" src="js/util.js"></script>
|
||||||
<script type="text/javascript" src="js/app.js?8"></script>
|
<script type="text/javascript" src="js/app.js?8"></script>
|
||||||
<script type="text/javascript" src="js/services.js?11"></script>
|
<script type="text/javascript" src="js/services.js?12"></script>
|
||||||
<script type="text/javascript" src="js/controllers.js?16"></script>
|
<script type="text/javascript" src="js/controllers.js?16"></script>
|
||||||
<script type="text/javascript" src="js/filters.js?3"></script>
|
<script type="text/javascript" src="js/filters.js?3"></script>
|
||||||
<script type="text/javascript" src="js/directives.js?10"></script>
|
<script type="text/javascript" src="js/directives.js?10"></script>
|
||||||
|
@ -1926,10 +1926,10 @@ angular.module('myApp.services', [])
|
|||||||
var notificationIndex = 0;
|
var notificationIndex = 0;
|
||||||
var notificationsCount = 0;
|
var notificationsCount = 0;
|
||||||
var peerSettings = {};
|
var peerSettings = {};
|
||||||
var faviconEl = $('link[rel="icon"]');
|
var faviconBackupEl = $('link[rel="icon"]'),
|
||||||
|
faviconNewEl = $('<link rel="icon" href="favicon_unread.ico" type="image/x-icon" />');
|
||||||
|
|
||||||
var titleBackup = document.title,
|
var titleBackup = document.title,
|
||||||
faviconBackup = faviconEl.attr('href'),
|
|
||||||
titlePromise;
|
titlePromise;
|
||||||
|
|
||||||
$rootScope.$watch('idle.isIDLE', function (newVal) {
|
$rootScope.$watch('idle.isIDLE', function (newVal) {
|
||||||
@ -1939,20 +1939,22 @@ angular.module('myApp.services', [])
|
|||||||
if (!newVal) {
|
if (!newVal) {
|
||||||
notificationsCount = 0;
|
notificationsCount = 0;
|
||||||
document.title = titleBackup;
|
document.title = titleBackup;
|
||||||
faviconEl.attr('href', faviconBackup);
|
$('link[rel="icon"]').replaceWith(faviconBackupEl);
|
||||||
notificationsClear();
|
notificationsClear();
|
||||||
} else {
|
} else {
|
||||||
titleBackup = document.title;
|
titleBackup = document.title;
|
||||||
|
|
||||||
titlePromise = $interval(function () {
|
titlePromise = $interval(function () {
|
||||||
var time = +new Date();
|
var time = +new Date();
|
||||||
// console.log('check title', notificationsCount, time % 2000 > 1000);
|
|
||||||
if (!notificationsCount || time % 2000 > 1000) {
|
if (!notificationsCount || time % 2000 > 1000) {
|
||||||
document.title = titleBackup;
|
document.title = titleBackup;
|
||||||
faviconEl.attr('href', faviconBackup);
|
$('link[rel="icon"]').replaceWith(faviconBackupEl);
|
||||||
} else {
|
} else {
|
||||||
document.title = notificationsCount + ' notifications';
|
document.title = notificationsCount > 1
|
||||||
faviconEl.attr('href', 'favicon_unread.ico');
|
? (notificationsCount + ' notifications')
|
||||||
|
: '1 notification';
|
||||||
|
|
||||||
|
$('link[rel="icon"]').replaceWith(faviconNewEl);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user