NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name UK Settlement login automation
// @namespace http://tamper monkey.net/
// @version 0.1
// @description -
// @licence MIT
// @author El Tom
// @include *gov.uk*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function send()
{
if (document.forms &&
document.forms.length > 0 &&
document.forms[0].submit)
{
document.getElementById("submit").click();
}
}
function setS0()
{
var pn = document.getElementById("documentNumber");
if (pn.value) {
window.localStorage.setItem("s0", pn.value)
}
}
var datum = [0,0,0];
function setS11()
{
debugger;
var dd = document.forms[0]["dob-day"];
datum[0] = dd.value;
if (datum[0] && datum[1] && datum[2])
window.localStorage.setItem("s1", datum.join('/'))
}
function setS12()
{
debugger;
var dd = document.forms[0]["dob-month"];
datum[1] = dd.value;
if (datum[0] && datum[1] && datum[2])
window.localStorage.setItem("s1", datum.join('/'))
}
function setS13()
{
debugger;
var dd = document.forms[0]["dob-year"];
datum[2] = dd.value;
if (datum[0] && datum[1] && datum[2])
window.localStorage.setItem("s1", datum.join('/'))
}
if (location.pathname == '/view-prove-immigration-status')
{
document.querySelectorAll('[role="button"]')[0].click();
}
if(location.pathname == "/auth/realms/AUK/protocol/openid-connect/auth")
{
var pp = document.getElementById("passport");
if (pp)
{
pp.checked = true;
send();
}
}
if(location.pathname == "/auth/realms/AUK/login-actions/authenticate")
{
var pn = document.getElementById("documentNumber");
var dd = document.forms[0]["dob-day"];
var sms = document.getElementById("sms");
if (pn)
{
var n = window.localStorage.getItem("s0");
if (n)
{
pn.value = n
send();
} else {
pn.onchange = setS0;
}
}
else if(dd)
{
var d = window.localStorage.getItem("s1");
if (d)
{
d = d.split("/");
dd.value = d[0];
document.forms[0]["dob-month"].value = d[1];
document.forms[0]["dob-year"].value = d[2];
send();
} else {
dd.onchange = setS11;
document.forms[0]["dob-month"].onchange = setS12;
document.forms[0]["dob-year"].onchange = setS13;
}
}
else if (sms)
{
sms.checked = true;
}
}
})();