Skip to content

Commit

Permalink
Merge pull request #4 from puroong/master
Browse files Browse the repository at this point in the history
Call applyOptions on DOM modification
  • Loading branch information
williambelle authored Nov 6, 2017
2 parents 81361f2 + 7b3abbf commit 574e506
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/js/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,24 @@ function applyOptions() {
});
}

applyOptions();
(function() {
// Call applyOptions after document load
applyOptions();

// Observe DOM modifications
var container = document.getElementById('js-pjax-container');

if (container) {
var observer = new MutationObserver(function(mutations) {
var graph = document.getElementsByClassName('js-contribution-graph')[0];

if (graph) {
applyOptions();
}
});

var config = { subtree: true, childList: true };

observer.observe(container, config);
}
})();

0 comments on commit 574e506

Please sign in to comment.