Last active
July 8, 2022 13:54
-
-
Save andfinally/18a6d45b973cf74a0f7ae8b8831a8b14 to your computer and use it in GitHub Desktop.
Greasemonkey script – adds $ and $$ aliases for querySelector and querySelectorAll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Make $ and $$ aliases for document.querySelector and document.querySelectorAll | |
// @version 1 | |
// @description Creates aliases for document.querySelector and document.querySelectorAll | |
// @author andfinally | |
// @match https://github.com/* | |
// @match https://woocommerce.test/* | |
// @match https://*.woocommerce.com/* | |
// @grant none | |
// ==/UserScript== | |
function $( selector ) { | |
return document.querySelector( selector ); | |
} | |
function $$( selector ) { | |
return document.querySelectorAll( selector ); | |
} | |
unsafeWindow.$ = exportFunction( $, unsafeWindow ); | |
unsafeWindow.$$ = exportFunction( $$, unsafeWindow ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment