Skip to content

Latest commit

 

History

History
109 lines (99 loc) · 3.28 KB

certificates.md

File metadata and controls

109 lines (99 loc) · 3.28 KB
title date layout bodyClass
Attendance Certificates
2018-02-22 17:01:34 +0700
page
page-about

Use the email address you used to register to IIR 2021 to download your attendance certificate!

<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>
<script> function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { // XHR for Chrome/Firefox/Opera/Safari. xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { // XDomainRequest for IE. xhr = new XDomainRequest(); xhr.open(method, url); } else { // CORS not supported. xhr = null; } return xhr; } function UrlExists(url) { try { var xhr = createCORSRequest('HEAD', url); if (!xhr) { console.log('CORS not supported'); } xhr.onreadystatechange = function() { if (this.readyState !== 4) { return; }; if (this.status !== 200) { $('#message').html('warning Certificate not found'); } else { $('#message').html('check_circle Download your attendance certificate'); } }; xhr.onerror = function() { $('#message').html('warning Certificate not found'); }; } catch (error) {} try { xhr.send(); } catch (error) {} console.clear() } //setup before functions var typingTimer; //timer identifier var doneTypingInterval = 1000; //time in ms, 5 second for example var $input = $('#email'); //on keyup, start the countdown $input.on('keyup', function() { clearTimeout(typingTimer); typingTimer = setTimeout(doneTyping, doneTypingInterval); }); //on keydown, clear the countdown var manageTyping = function() { $input.one('input', function() { // $('#message').html(''); $('#message').html(''); clearTimeout(typingTimer); }) }; //opening the page, we start the typing managament $(function() { manageTyping(); }); //user is "finished typing," do something function doneTyping() { if ($('#email').val() == '') { $('#message').html(''); manageTyping(); } else { var url = 'https://sisinflab.poliba.it/certificates_iir/iir2021_certificate_' + $('#email').val() + '.pdf' UrlExists(url); console.clear() manageTyping(); } } </script>