Skip to content

Instantly share code, notes, and snippets.

@simanacci
Created October 9, 2020 20:21
Show Gist options
  • Save simanacci/e890a58c88ad61c8dcc675dcbc8a990e to your computer and use it in GitHub Desktop.
Save simanacci/e890a58c88ad61c8dcc675dcbc8a990e to your computer and use it in GitHub Desktop.
socket.on('notification-message', function(msg) {
var targetContainer = document.getElementById('notification-count');
console.log(targetContainer);
{% if request.endpoint == 'dash.notification' %}
var nextNotificationButton = document.getElementById('next-unread-notification');
var nextNotificationFooter = document.getElementById('notification-footer');
{% endif %}
if (msg.count != 0) {
targetContainer.classList.add("notification-count");
targetContainer.innerHTML = msg.count;
{% if request.endpoint == 'dash.notification' %}
nextNotificationButton.setAttribute('style', 'opacity: 1');
nextNotificationButton.href = msg.most_recent_notification_link;
nextNotificationFooter.setAttribute('style', 'flex-direction: row');
{% endif %}
}
else {
targetContainer.removeAttribute("class");
targetContainer.innerHTML = '';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment