display total number of unread messages in favicon

close #131
Esse commit está contido em:
sualko
2015-06-27 15:01:37 +02:00
commit 7c3e4119dd
8 arquivos alterados com 80 adições e 4 exclusões
+4
Ver Arquivo
@@ -0,0 +1,4 @@
{
"directory": "lib/",
"analytics": false
}
+2 -1
Ver Arquivo
@@ -7,4 +7,5 @@ archives/
dev/
.wti
*~
/tmp/
/tmp/
lib/favico.js/
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@ module.exports = function(grunt) {
main: {
files: [{
expand: true,
src: ['lib/i18next/release/i18next-latest.min.js', 'lib/magnific-popup/dist/*.js', 'lib/strophe.jinglejs/*-bundle.js', 'lib/otr/build/**', 'lib/otr/lib/dsa-webworker.js', 'lib/otr/lib/sm-webworker.js', 'lib/otr/lib/const.js', 'lib/otr/lib/helpers.js', 'lib/otr/lib/dsa.js', 'lib/otr/vendor/*.js', 'lib/*.js', 'LICENSE', 'img/**', 'sound/**'],
src: ['lib/i18next/release/i18next-latest.min.js', 'lib/magnific-popup/dist/*.js', 'lib/favico.js/favico.js', 'lib/strophe.jinglejs/*-bundle.js', 'lib/otr/build/**', 'lib/otr/lib/dsa-webworker.js', 'lib/otr/lib/sm-webworker.js', 'lib/otr/lib/const.js', 'lib/otr/lib/helpers.js', 'lib/otr/lib/dsa.js', 'lib/otr/vendor/*.js', 'lib/*.js', 'LICENSE', 'img/**', 'sound/**'],
dest: '<%= target %>/'
}, {
expand: true,
+30
Ver Arquivo
@@ -0,0 +1,30 @@
{
"name": "jsxc",
"version": "2.0.1",
"homepage": "https://www.jsxc.org",
"authors": [
"sualko <klaus@jsxc.org>"
],
"description": "Real-time chat app",
"keywords": [
"javascript",
"xmpp",
"webrtc",
"otr",
"chat",
"realtime"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"lib/",
"test",
"tests"
],
"private": true,
"dependencies": {
"favico.js": "~0.3.7"
}
}
+6
Ver Arquivo
@@ -82,5 +82,11 @@
"file": "lib/translation.js",
"license": "MIT",
"url": "https://webtranslateit.com/en/projects/10365-JSXC"
},
{
"name": "favico.js",
"file": "lib/favico.js/favico.js",
"license": "MIT",
"url": "https://github.com/ejci/favico.js"
}
]
+1
Ver Arquivo
@@ -12,6 +12,7 @@
},
"devDependencies": {
"autoprefixer-core": "^4.0.2",
"bower": "^1.4.1",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^2.1.0",
"grunt-banner": "~0.2.2",
+24 -1
Ver Arquivo
@@ -1,3 +1,4 @@
/* global Favico*/
/**
* Handle functions for chat window's and buddylist
*
@@ -30,6 +31,8 @@ jsxc.gui = {
[':zzz:', 'tired']
],
favicon: null,
/**
* Different uri query actions as defined in XEP-0147.
*
@@ -95,6 +98,17 @@ jsxc.gui = {
jsxc.gui.tooltip('#jsxc_windowList');
var fo = jsxc.options.get('favicon');
if (fo && fo.enable) {
jsxc.gui.favicon = new Favico({
animation: 'pop',
bgColor: fo.bgColor,
textColor: fo.textColor
});
jsxc.gui.favicon.badge(jsxc.storage.getUserItem('unreadMsg') || 0);
}
if (!jsxc.el_exists('#jsxc_roster')) {
jsxc.gui.roster.init();
}
@@ -1128,7 +1142,12 @@ jsxc.gui = {
// update counter of total unread messages
var total = jsxc.storage.getUserItem('unreadMsg') || 0;
jsxc.storage.setUserItem('unreadMsg', total + 1);
total++;
jsxc.storage.setUserItem('unreadMsg', total);
if (jsxc.gui.favicon) {
jsxc.gui.favicon.badge(total);
}
jsxc.gui._unreadMsg(bid, count);
},
@@ -1177,6 +1196,10 @@ jsxc.gui = {
total -= count;
jsxc.storage.setUserItem('unreadMsg', total);
if (jsxc.gui.favicon) {
jsxc.gui.favicon.badge(total);
}
el.find('.jsxc_unread').text(0);
jsxc.storage.updateUserItem('window', bid, 'unread', 0);
}
+12 -1
Ver Arquivo
@@ -191,5 +191,16 @@ jsxc.options = {
* @param {string} search Search token (start with)
* @param {getUsers-cb} cb Called with list of users
*/
getUsers: null
getUsers: null,
/** Options for info in favicon */
favicon: {
enable: true,
/** Favicon info background color */
bgColor: '#E59400',
/** Favicon info text color */
textColor: '#fff'
}
};