Created
January 10, 2019 15:43
-
-
Save slowkow/e0570d878e89732b8a166d79e1847bcc to your computer and use it in GitHub Desktop.
Chrome extension to automatically click the "Send SMS" button on okta.com
This file contains 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
/* | |
* The purpose of this script is to automatically click the "Send SMS" | |
* button as soon as the page is loaded, instead of clicking on it manually. | |
* | |
* This is the page with the button: | |
* | |
* https://partnershealthcare.okta.com/signin/verify/okta/sms | |
* | |
*/ | |
// Run main() after the page is loaded | |
window.addEventListener('load', main, false); | |
function main(event) { | |
// Every 1000 ms, run try_click() | |
var timer = setInterval(try_click, 1000); | |
// Stop trying after 10 attempts. | |
var max_attempts = 10; | |
function try_click() { | |
max_attempts -= 1; | |
if (max_attempts > 0) { | |
clearInterval(timer); | |
console.log("Attempts left: " + max_attempts); | |
// Find the button. | |
var b = document.querySelector(".sms-request-button"); | |
// If we found the button, click on it. | |
if (b) { | |
max_attempts = 0; | |
console.log("Clicking on sms button"); | |
b.click(); | |
} | |
} | |
} | |
} |
This file contains 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
{ | |
"name": "autoclick", | |
"version": "1.0", | |
"manifest_version": 2, | |
"permissions": [ | |
"activeTab" | |
], | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"https://partnershealthcare.okta.com/*" | |
], | |
"js": ["contentScript.js"], | |
"css": ["mycss.css"] | |
} | |
] | |
} |
This file contains 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
body { | |
background: linear-gradient(#9198e51c, #e6646538) !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment