     (reduce + numbers)))
 
 (defn- update-overall! []
-  (let [gitique-enabled (js/document.querySelector ".gitique-enabled")
+  (let [gitique-enabled (.contains (.-classList pjax-wrapper) "gitique-enabled")
         selector (str "#files .file" (when gitique-enabled ":not(.gitique-hidden)"))
         file-count (count (js/document.querySelectorAll selector))
         added (diffstat-count gitique-enabled "added")

  (let [enabled? (= state "new")
        other-state (if enabled? "all" "new")
        to-enable (dom/getElement (str "gitique-show-" state))
        to-disable (dom/getElement (str "gitique-show-" other-state))
        wrapper (dom/getElement "js-repo-pjax-container")]
    (.add (.-classList to-enable) "selected")
    (.remove (.-classList to-disable) "selected")
    (if (= state "new")
      (.add (.-classList wrapper) "gitique-enabled")
      (.remove (.-classList wrapper) "gitique-enabled"))
    (update-overall!)))

(defn- add-button! []

    (swap! state assoc :current-pr current-pr)))

(defn ^:export watch []
  (let [is-valid-mutation? #(and (= (.-type %) "childList") (not-empty (.-addedNodes %)))
        observer (js/MutationObserver. #(when (some is-valid-mutation? %) (main)))]
    (.observe observer pjax-wrapper #js{:childList true :attributes false :characterData false})
    (main)))
