Skip to content

Instantly share code, notes, and snippets.

@dlgombert
Created April 7, 2022 15:13
Show Gist options
  • Select an option

  • Save dlgombert/6309172a0b72dd6a5dfd1948a5172c0a to your computer and use it in GitHub Desktop.

Select an option

Save dlgombert/6309172a0b72dd6a5dfd1948a5172c0a to your computer and use it in GitHub Desktop.
[truancy-tracker-new-referral] New Referral Bookmarklet for Truancy #bookmarklet
function populate() {
let y=Math.round(Math.random()*15)+2000;
let m=String(Math.round(Math.random()*11)+1).padStart(2, '0')
let d=String(Math.round(Math.random()*28)+1).padStart(2, '0')
$('#firstname').val(chance.first());
$('#lastname').val(chance.last());
$('#birthdate').val(`${y}-${m}-${d}`);
$fa('newReferral_submit').trigger('click');
}
$fa = (function (n) {
return $(`[name="${n}"]`);
});
function init() {
$(document).on('shown.bs.modal', populate);
$('[data-target="#newReferral"]').trigger('click');
}
if (typeof chance === "undefined") {
$.getScript('//cdnjs.cloudflare.com/ajax/libs/chance/1.1.8/chance.min.js').then(init);
} else {
init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment