Fextralife Searchbox Focus

Target the searchbox on Fextralife wikis with a hotkey

// ==UserScript==
// @name Fextralife Searchbox Focus
// @version 1.0
// @author Tsusho
// @description Target the searchbox on Fextralife wikis with a hotkey
// @match https://*.wiki.fextralife.com/*
// @license MIT
// @grant none
// @namespace https://greasyfork.org/users/886069
// ==/UserScript==

let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let listener;
let observer = new MutationObserver(observer => {
    let searchbox = document.querySelector('#spf.form-control');
      console.log(searchbox);
      if (!listener) {
      listener = (function(){
        document.addEventListener('keydown', function(e) {
          // pressed alt+shift+f
          if (e.keyCode == 70 && e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) {
            e.preventDefault();
            searchbox.focus();
          }
        }, false);
      })();
    }

});
observer.observe(document.body, {childList: true, subtree: true});