diff --git a/install/data/categories.json b/install/data/categories.json index 43d394ab19..73c422f1e9 100644 --- a/install/data/categories.json +++ b/install/data/categories.json @@ -2,84 +2,96 @@ { "name": "Announcements", "description": "Announcements regarding our community", - "blockclass": "category-blue", + "bgColor": "#0059B2", + "color": "#fff", "icon" : "fa-bullhorn", "order": 1 }, { "name": "General Discussion", "description": "A place to talk about whateeeever you want", - "blockclass": "category-blue", + "bgColor": "#0059B2", + "color": "#fff", "icon" : "fa-comment", "order": 2 }, { "name": "NodeBB Development", "description": "NodeBB development news and announcements", - "blockclass": "category-blue", + "bgColor": "#0059B2", + "color": "#fff", "icon" : "fa-github", "order": 3 }, { "name": "Blogs", "description": "Blog posts from individual members", - "blockclass": "category-blue", + "bgColor": "#0059B2", + "color": "#fff", "icon" : "fa-pencil", "order": 4 }, { "name": "Feature Requests", "description": "Got a feature request you'd like to see? Give us a shout here.", - "blockclass": "category-purple", + "bgColor": "#ab1290", + "color": "#fff", "icon" : "fa-lightbulb-o", "order": 5 }, { "name": "Bug Reports", "description": "Having trouble with NodeBB? Let us know...", - "blockclass": "category-purple", + "bgColor": "#ab1290", + "color": "#fff", "icon" : "fa-cogs", "order": 6 }, { "name": "NodeBB Plugins", "description": "Enhance your NodeBB with plugins!", - "blockclass": "category-purple", + "bgColor": "#ab1290", + "color": "#fff", "icon" : "fa-plus-square", "order": 7 }, { "name": "NodeBB Link Exchange", "description": "Link exchange", - "blockclass": "category-purple", + "bgColor": "#ab1290", + "color": "#fff", "icon" : "fa-exchange", "order": 8 }, { "name": "News", "description": "News from around the world", - "blockclass": "category-darkblue", + "bgColor": "#004C66", + "color": "#fff", "icon" : "fa-globe", "order": 9 }, { "name": "Movies", "description": "Discuss the latest movies here", - "blockclass": "category-darkblue", + "bgColor": "#004C66", + "color": "#fff", "icon" : "fa-film", "order": 10 }, { "name": "Games", "description": "Discuss the latest games here", - "blockclass": "category-darkblue", + "bgColor": "#004C66", + "color": "#fff", "icon" : "fa-crosshairs", "order": 11 }, { "name": "Random", "description": "Anything and (almost) everything welcome!", - "blockclass": "category-darkblue", + "bgColor": "#004C66", + "color": "#fff", "icon" : "fa-beer", "order": 12 } diff --git a/public/src/forum/account.js b/public/src/forum/account.js index 375ac4b9f1..8354461fe4 100644 --- a/public/src/forum/account.js +++ b/public/src/forum/account.js @@ -39,7 +39,7 @@ define(['forum/accountheader'], function(header) { uid: theirid }, function(success) { if (success) { - followBtn.addClasss('hide'); + followBtn.addClass('hide'); unfollowBtn.removeClass('hide'); app.alertSuccess('You are now following ' + username + '!'); } else { @@ -98,4 +98,4 @@ define(['forum/accountheader'], function(header) { }; return Account; -}); \ No newline at end of file +}); diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index 22aaf69768..1fe343d929 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -66,7 +66,7 @@ var notifContainer = document.getElementsByClassName('notifications')[0], notifTrigger = notifContainer.querySelector('a'), notifList = document.getElementById('notif-list'), - notifIcon = document.querySelector('.notifications a i'); + notifIcon = $('.notifications a'); notifTrigger.addEventListener('click', function(e) { e.preventDefault(); if (notifContainer.className.indexOf('open') === -1) { @@ -77,7 +77,6 @@ numUnread = data.unread.length, x; notifList.innerHTML = ''; - console.log(data); if ((data.read.length + data.unread.length) > 0) { for (x = 0; x < numUnread; x++) { notifEl.setAttribute('data-nid', data.unread[x].nid); @@ -106,14 +105,18 @@ notifList.appendChild(notifFrag); if (data.unread.length > 0) { - notifIcon.className = 'fa fa-circle active'; + notifIcon.toggleClass('active', true); } else { - notifIcon.className = 'fa fa-circle-o'; + notifIcon.toggleClass('active', false); } socket.emit('api:notifications.mark_all_read', null, function() { - notifIcon.className = 'fa fa-circle-o'; + notifIcon.toggleClass('active', false); utils.refreshTitle(); + + // Update favicon + local count + Tinycon.setBubble(0); + localStorage.setItem('notifications:count', 0); }); }); } @@ -138,8 +141,25 @@ } }); + socket.emit('api:notifications.getCount', function(err, count) { + // Update notification icon, if necessary + if (count > 0) { + notifIcon.toggleClass('active', true); + } else { + notifIcon.toggleClass('active', false); + } + + // Update the favicon + saved local count + Tinycon.setBubble(count); + localStorage.setItem('notifications:count', count); + }); + + if (localStorage.getItem('notifications:count') !== null) { + Tinycon.setBubble(parseInt(localStorage.getItem('notifications:count'), 10)); + } + socket.on('event:new_notification', function() { - document.querySelector('.notifications a i').className = 'fa fa-circle active'; + notifIcon.toggleClass('active', true); app.alert({ alert_id: 'new_notif', title: 'New notification', @@ -148,6 +168,11 @@ timeout: 2000 }); utils.refreshTitle(); + + // Update the favicon + local storage + var savedCount = parseInt(localStorage.getItem('notifications:count'),10) || 0; + localStorage.setItem('notifications:count', savedCount+1); + Tinycon.setBubble(savedCount+1); }); @@ -158,15 +183,20 @@ if (chat.modalExists(data.fromuid)) { modal = chat.getModal(data.fromuid); chat.appendChatMessage(modal, data.message, data.timestamp); + + if (modal.is(":visible")) { + chat.load(modal.attr('UUID')); + } else { + chat.toggleNew(modal.attr('UUID'), true); + } } else { modal = chat.createModal(data.username, data.fromuid); + chat.toggleNew(modal.attr('UUID'), true); } - - chat.load(modal.attr('UUID')); }); }); require(['mobileMenu'], function(mobileMenu) { mobileMenu.init(); }); -}()); \ No newline at end of file +}()); diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 7239b20db7..8afcd129ad 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -67,7 +67,8 @@ define(['taskbar'], function(taskbar) { chatModal.find('.close').on('click', function(e) { clearInterval(chatModal.intervalId); chatModal.intervalId = 0; - chatModal.hide(); + chatModal.remove(); + chatModal.data('modal', null); taskbar.discard('chat', uuid); }); @@ -81,7 +82,11 @@ define(['taskbar'], function(taskbar) { checkOnlineStatus(chatModal); }); - taskbar.push('chat', chatModal.attr('UUID'), {title:'chat with ' + username}); + taskbar.push('chat', chatModal.attr('UUID'), { + title:' ' + username, + state: '' + }); + return chatModal; } @@ -149,7 +154,11 @@ define(['taskbar'], function(taskbar) { chatContent.scrollTop( chatContent[0].scrollHeight - chatContent.height() ); - } + }; + + module.toggleNew = function(uuid, state) { + taskbar.toggleNew(uuid, state); + }; return module; }); \ No newline at end of file diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js index 0fbdd76da9..131e52ada1 100644 --- a/public/src/modules/taskbar.js +++ b/public/src/modules/taskbar.js @@ -25,6 +25,7 @@ define(function() { if (_btn.className.indexOf('active') === -1) { taskbar.minimizeAll(); module.load(uuid); + taskbar.toggleNew(uuid, false); // Highlight the button $(taskbar.tasklist).removeClass('active'); @@ -69,7 +70,7 @@ define(function() { ''; btnEl.setAttribute('data-module', module); btnEl.setAttribute('data-uuid', uuid); - btnEl.className = options.state || 'active'; + btnEl.className = options.state !== undefined ? options.state : 'active'; if (!options.state || options.state === 'active') taskbar.minimizeAll(); taskbar.tasklist.appendChild(btnEl); @@ -82,14 +83,21 @@ define(function() { }, minimizeAll: function() { $(taskbar.tasklist.querySelectorAll('.active')).removeClass('active'); + }, + toggleNew: function(uuid, state) { + var btnEl = $(taskbar.tasklist.querySelector('[data-uuid="' + uuid + '"]')); + btnEl.toggleClass('new', state); } } - if (!taskbar.initialized) taskbar.init(); + if (!taskbar.initialized) { + taskbar.init(); + } return { push: taskbar.push, discard: taskbar.discard, - minimize: taskbar.minimize + minimize: taskbar.minimize, + toggleNew: taskbar.toggleNew } }); \ No newline at end of file diff --git a/public/templates/header.tpl b/public/templates/header.tpl index bb49273b2f..73dd44e334 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -90,7 +90,7 @@