raingart / Add "YouTube" link to Google search

// ==UserScript==
// @name         Add "YouTube" link to Google search
// @namespace    google-search-yt-tab
// @version      0.2
// @description  On left corner
// @author       raingart
// @include      http*://www.google.*/search?*
// @run-at       document-start
// @license      MIT
// ==/UserScript==
/*jshint esversion: 6 */

window.addEventListener('DOMContentLoaded', () => {
    const
      getQueryURL = query => new URLSearchParams(location.search).get(query),
      query = document.querySelector('input[name="q"]')?.value, // Google search input textbox
      q = query ? encodeURIComponent(query) : getQueryURL('q'),
      a = document.createElement('a');

      a.href = 'https://www.youtube.com/results?search_query=' + q;
      a.textContent = 'YT';
      a.title = 'Youtube';
      Object.assign(a.style, {
         position: 'fixed',
         top: '90px',
         left: '10px',
         'z-index': 9999,
         'margin-right': '5px',
      });
      document.body.append(a);
});