Last active
April 11, 2016 06:52
ETS: 8 Hrs to Item 2 & submit
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
// javascript:if(!location.href.match(%2Fetswsso.web.(.*%3F).com.etsp.ets%2F))void(location.href%3D'https%3A%2F%2Fetswsso.web.PLACEHOLDER.com%2Fetsp%2Fetslg9pm')%3Bvar%20d%3Ddocument.getElementsByName('contents')%5B0%5D.contentDocument,h%3Dd.getElementsByName('hours001')%5B0%5D,t%3Dd.getElementsByName('ccnsel001')%5B0%5D,e%3Dd.createEvent('HTMLEvents')%3Bh.value%3D8%3Bt.selectedIndex%3D2%3Be.initEvent('change',false,true)%3Bt.dispatchEvent(e)%3Bvoid(d.getElementsByName('lmform')%5B0%5D.submit()) | |
//verify on correct page | |
if (!location.href.match(/etswsso.web.(.*?).com.etsp.ets/)) void (location.href = 'DESIRED_URL'); | |
// enter 8 hours for activity #2 on ETS | |
// setup vars for DOM elements and event | |
var d = document.getElementsByName('contents')[0].contentDocument, | |
h = d.getElementsByName('hours001')[0], | |
t = d.getElementsByName('ccnsel001')[0], | |
e = d.createEvent('HTMLEvents'); | |
// set hours | |
h.value = 8; | |
// set actvity type & trigger update via DOM event | |
t.selectedIndex = 2; | |
e.initEvent('change', false, true); | |
t.dispatchEvent(e); | |
// submit form, returning void so it works as bookmarklet | |
void(d.getElementsByName('lmform')[0].submit()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment