// ==UserScript== // @name IIITN Hostel Auto-Submit // @namespace http://tampermonkey.net/ // @version 1.0 // @match http://localhost:8000/* // @match https://iiitn.samarth.edu.in/* // @match file:///* // @description Hostel form // @grant unsafeWindow // ==/UserScript==
(function () { 'use strict';
if (!window.location.href.includes('accomodation')) return;
unsafeWindow.confirm = () => true;
unsafeWindow.alert = () => {};
const PREF_HOSTEL = 2000008;
// ENter YOur details here
const PREF_ROOM = 2-Seater;
const EMERGENCY_NAME = Avinash Chandane;
const EMERGENCY_EMAIL = [REDACTED EMAIL];
const EMERGENCY_MOBILE = 7972546356;
function attemptFillAndSubmit() {
const form = document.getElementById('accomodation-form');
const btn = document.getElementById('final-submit-btn');
const pref1 = document.getElementById('pref_1');
const roomType = document.getElementById('hostelapplication-room_type_preference');
const emName = document.getElementById('emergency_contact_detail');
const emEmail = document.getElementById('emergency_contact_email');
const emMobile = document.getElementById('emergency_contact_mobile');
const cb = document.getElementById('terms_checkbox');
if (!form || !btn || !pref1 || !roomType || !emName || !emEmail || !emMobile || !cb) {
return false;
}
pref1.value = PREF_HOSTEL;
roomType.value = PREF_ROOM;
emName.value = EMERGENCY_NAME;
emEmail.value = EMERGENCY_EMAIL;
emMobile.value = EMERGENCY_MOBILE;
cb.checked = true;
alert(Form submitted.);
return true;
}
// Execute Script
if (!attemptFillAndSubmit()) {
const interval = setInterval(() => {
alert(Refreshing);
if (attemptFillAndSubmit()) {
clearInterval(interval);
}
}, 100);
}
})();