Last active
April 22, 2019 14:49
-
-
Save cuylerstuwe/8d8b4c54b9b1f4a499b0247c1d83c9b5 to your computer and use it in GitHub Desktop.
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 Victoria "Good Substitute" Pix Clix | |
| // @namespace salembeats | |
| // @version 1 | |
| // @description . | |
| // @author Cuyler Stuwe (salembeats) | |
| // @include https://wml1.crowdcomputingsystems.com/workfusion/public/HTMLRenderer?submissionUUID=* | |
| // @grant none | |
| // ==/UserScript== | |
| function determineCheckboxFromLetter(letter) { | |
| return ( | |
| [...document.querySelectorAll(".cc-label")] | |
| .find(el => el.innerText.includes(letter)) | |
| ); | |
| } | |
| function determineLetterFromImageElement(imageElement) { | |
| return imageElement.previousElementSibling.innerText.replace(".", "").trim(); | |
| } | |
| async function main() { | |
| const isNotCorrectGid = () => !document.referrer.includes("35QUA2ABY65K0NINO7YKO7STUKPGE0"); | |
| if(isNotCorrectGid()) { return; } | |
| const isElementAnImage = element => element.nodeName === "IMG"; | |
| document.body.addEventListener("click", e => { | |
| if(isElementAnImage(e.target)) { | |
| const letterToClick = determineLetterFromImageElement(e.target); | |
| const checkboxToClick = determineCheckboxFromLetter(letterToClick); | |
| checkboxToClick.click(); | |
| } | |
| }, true); | |
| } | |
| main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment