Skip to content

Instantly share code, notes, and snippets.

@neoOpus
Forked from thefloodshark/Caseautofill.js
Created October 20, 2021 09:05
Show Gist options
  • Save neoOpus/e444668a204dffafe534b568923cabff to your computer and use it in GitHub Desktop.
Save neoOpus/e444668a204dffafe534b568923cabff 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