Skip to content

Instantly share code, notes, and snippets.

@JoseAlavez
Last active February 25, 2023 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoseAlavez/fd80819f3d217fd100a866d0c8b94fc1 to your computer and use it in GitHub Desktop.
Save JoseAlavez/fd80819f3d217fd100a866d0c8b94fc1 to your computer and use it in GitHub Desktop.
Berlin Appointments
var jq
function loadScript(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = () => {
jq = jQuery.noConflict();
callback()
}
script.onload = () => {
jq = jQuery.noConflict();
callback()
}
head.appendChild(script);
}
function initAppointment(config) {
const appointmentLinks = jq(".link a")
appointmentLinks.each(function each() {
const link = jq(this)
if (link.text().includes("Termin buchen")) {
window.open(link.prop("href"), "_blank")
}
})
}
function acceptTerms(config) {
const acceptTerms = jq("#xi-cb-1")
const furtherButton = jq("[name='applicationForm:managedForm:proceed']")
acceptTerms.click()
furtherButton.click()
}
function selectParameters(config) {
setTimeout(() => {
const nationality = jq("#xi-sel-400")
const nationality_hidden = jq("#xi-tf-991")
const people = jq("#xi-sel-422")
const family = jq("#xi-sel-427")
const service = jq("#SERVICEWAHL_DE3334-0-3")
const furtherButton = jq("[name='applicationForm:managedForm:proceed']")
nationality.val("334")
nationality_hidden.val("334")
people.val("1")
people.parent().css("display", "initial")
people.parent().parent().css("display", "initial")
people.parent().parent().parent().css("display", "initial")
family.val("2")
family.parent().css("display", "initial")
family.parent().parent().css("display", "initial")
service.click()
//furtherButton.click()
}, config.waitSlowSite)
}
let config = {
waitSlowSite: 2000
}
if (window.location.href.includes("wizardng")) {
loadScript("https://code.jquery.com/jquery-3.6.3.min.js", () => {
acceptTerms(config)
selectParameters(config)
});
} else {
loadScript("https://code.jquery.com/jquery-3.6.3.min.js", () => {
initAppointment(config)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment