Skip to content

Instantly share code, notes, and snippets.

@Loskir
Forked from radiantly/noMangleGoogle.user.js
Last active December 23, 2021 10:08
Show Gist options
  • Save Loskir/12a70bd0143bd51d2c64245b3e859a73 to your computer and use it in GitHub Desktop.
Save Loskir/12a70bd0143bd51d2c64245b3e859a73 to your computer and use it in GitHub Desktop.
Prevent Google from mangling links on the search results when clicking or copying on Firefox
// ==UserScript==
// @name Prevent link mangling on Google and Yandex
// @namespace LordBusiness.LMG
// @match https://www.google.com/search
// @match https://yandex.ru/search*
// @version 1.2
// @author radiantly
// @description Prevent Google and Yandex from mangling the link when copying or clicking the link
// ==/UserScript==
/*
* To install this script, you'll need a user script manager like ViolentMonkey, after which you
* can click the Raw button (gist.github.com) to install.
*/
(function() {
/*
* The following 3 lines simply prevent the mousedown event from propagating to the respective
* event listeners attached to the various link elements.
*
* On testing, this does not seem to break any actual functionality on the site.
*/
window.addEventListener("mousedown", (event) => {
event.stopImmediatePropagation();
}, true);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment