Skip to content

Instantly share code, notes, and snippets.

@thefloodshark
Last active October 20, 2021 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thefloodshark/269989d2ed48f1a3d35619ce2c13447b to your computer and use it in GitHub Desktop.
Save thefloodshark/269989d2ed48f1a3d35619ce2c13447b to your computer and use it in GitHub Desktop.
Case Insensitive Radio Button Autofiller
// ==UserScript==
// @name Case Insensitive Label-based Radio Button Autofill ("Xabc Yhjk")
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.qualtrics.com/*
// @match https://*.surveymonkey.com/*
// @match https://*.surveygizmo.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
const findAndClickParent = text => {
const lowerText = text.toLowerCase();
[...document.querySelectorAll('label > span')]
.forEach((e) => {
if (e.textContent.toLowerCase() === lowerText) {
e.parentElement.click();
}
});
}
waitForKeyElements(
"label",
() => {
findAndClickParent("Xabc Yhjk");
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment