diff --git a/trakt.pick-show.user.js b/trakt.pick-show.user.js index 28005b6..b425424 100644 --- a/trakt.pick-show.user.js +++ b/trakt.pick-show.user.js @@ -16,6 +16,8 @@ (function() { 'use strict'; + let watched_shows; + $(window).konami({ code: [80, 73, 67, 75], cheat: pickShow @@ -32,14 +34,17 @@ $leftNav.append('') .find('.pick-episode').on('click', pickShow); } - - $('div[data-type="show"]').on('click', unghost); } - addPickButton(); - const observer = new MutationObserver(addPickButton); - observer.observe(document.head.parentElement, {childList: true}); - let watched_shows; + function refreshPage() { + addPickButton(); + $('div[data-type="show"]') + .on('click', unghost); + } + + refreshPage(); + const observer = new MutationObserver(refreshPage); + observer.observe(document.head.parentElement, {childList: true}); function getWeightedIndex(total) { const opts = [];