Add Google Images Link to Mullvad Search

4/24/2025, 2:53:21 PM

// ==UserScript==
// @name        Add Google Images Link to Mullvad Search
// @namespace   Violentmonkey Scripts
// @match       https://leta.mullvad.net/search*
// @grant       none
// @version     1.0
// @author      -
// @description 4/24/2025, 2:53:21 PM
// @license unlicense
// ==/UserScript==

function ready(fn) {
    if (document.readyState !== 'loading') {
        fn();
    } else {
        document.addEventListener('DOMContentLoaded', fn);
    }
}

ready(function() {
  setTimeout(function() {
    const searchText = document.getElementById('search').value;

    const parent = document.getElementsByClassName('radio-group')[0];
    const link = document.createElement('label');
    link.className = 'svelte-535pip';
    link.href = 'https://images.google.com';
    link.innerText = 'Google Images';
    link.onclick = function() {
      location.href = 'https://www.google.com/search?udm=2&q='+encodeURIComponent(searchText);
    }
    parent.appendChild(link);
  }, 200);
});