https://github.com/mimoklef/Search-Google-Maps-Back
Bring back the "Maps" button and make some map tiles clickable again.
- Install a userscript addon like Violentmonkey
- Click HERE to install the user script
https://github.com/mimoklef/Search-Google-Maps-Back
Bring back the "Maps" button and make some map tiles clickable again.
// ==UserScript== | |
// @name Google Search Maps Fix | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-06-05 | |
// @description Bring Google maps button back (originally based off of Daan Grashoff's script) | |
// @author Delivator | |
// @match https://www.google.com/search* | |
// @include https://www.google.tld/search* | |
// @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function addMapsLink() { | |
// Get the search query from the URL | |
const searchQuery = new URLSearchParams(window.location.search).get('q'); | |
// Construct the Maps link with the query | |
const mapsLink = `${window.location.origin}/maps?q=${searchQuery}`; | |
// Select the menu container and map | |
const menuContainer = document.querySelector('.crJ18e > div[role="list"]'); | |
const mapImage = document.querySelector('#lu_map, #dimg_95'); | |
if (menuContainer) { | |
// Create a new list item div | |
const listItem = document.createElement('div'); | |
listItem.setAttribute('role', 'listitem'); | |
// Create the link element | |
const link = document.createElement('a'); | |
link.href = mapsLink; | |
link.className = 'nPDzT T3FoJb'; | |
link.setAttribute('jsname', 'VIftV'); | |
link.setAttribute('role', 'link'); | |
// Create the inner text div | |
const innerTextDiv = document.createElement('div'); | |
innerTextDiv.setAttribute('jsname', 'bVqjv'); | |
innerTextDiv.className = 'YmvwI'; | |
innerTextDiv.textContent = 'Maps'; | |
// Append the inner text div to the link | |
link.appendChild(innerTextDiv); | |
// Append the link to the list item | |
listItem.appendChild(link); | |
// Insert the new list item as the second-to-last element | |
if (menuContainer.children.length > 1) { | |
menuContainer.insertBefore(listItem, menuContainer.children[menuContainer.children.length - 1]); | |
} else { | |
menuContainer.appendChild(listItem); | |
} | |
} | |
if (mapImage) { | |
// Create a new anchor element for map element | |
const anchorElement = document.createElement('a'); | |
anchorElement.href = mapsLink; | |
mapImage.parentNode.insertBefore(anchorElement, mapImage); | |
anchorElement.appendChild(mapImage); | |
} | |
} | |
// Run the function to add the Maps link when the page loads | |
window.addEventListener('load', addMapsLink); | |
})(); |
Anyone finding this, check out this script: https://github.com/mimoklef/Search-Google-Maps-Back