Skip to content

Commit

Permalink
Added check to keep badge from stuttering.
Browse files Browse the repository at this point in the history
  • Loading branch information
ctag committed Aug 29, 2018
1 parent 6664792 commit 7f12217
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(function() {
require(['/plugins.local/favicon_badge/favico.min.js'], function(Favico) {
let favicon = new Favico();
let badgeText = '';

var init = function() {
let target = document.querySelector('title');
Expand All @@ -16,12 +17,13 @@
}

var checkTitle = function() {
let count = document.title.match(/^\((\d+)\)/);
if (count) {
let match = document.title.match(/^\((\d+)\)/);
if (match && match[1] !== badgeText) {
// console.log("Favicon count: ", count);
favicon.badge(count[1]);
badgeText = match[1];
favicon.badge(badgeText);
}
else {
else if (match === null) {
// console.log("Favicon: No unread articles");
favicon.reset();
}
Expand Down

0 comments on commit 7f12217

Please sign in to comment.