1/*! 2 * Start Bootstrap - Agency Bootstrap Theme (http://startbootstrap.com) 3 * Code licensed under the Apache License v2.0. 4 * For details, see http://www.apache.org/licenses/LICENSE-2.0. 5 */ 6 7// jQuery for page scrolling feature - requires jQuery Easing plugin 8$(function() { 9 $('a.page-scroll').bind('click', function(event) { 10 var $anchor = $(this); 11 $('html, body').stop().animate({ 12 scrollTop: $($anchor.attr('href')).offset().top 13 }, 1500, 'easeOutExpo'); 14 event.preventDefault(); 15 }); 16}); 17 18// Highlight the top nav as scrolling occurs 19$('body').scrollspy({ 20 target: '.navbar-fixed-top' 21}) 22 23// Closes the Responsive Menu on Menu Item Click 24$('.navbar-collapse ul li a').click(function() { 25 $('.navbar-toggle:visible').click(); 26}); 27 28$(document).ready(function () { 29 30 $('#submit').on('click',function(e){ 31 32 var formData = { 33 site: "SP Site", 34 name: $("#name").val(), 35 email: $("#email").val(), 36 to: $("#subject").val() || "[email protected]", 37 body: $("#message").val(), 38 webform_id: "scholars_portal_contact", 39 }; 40 41 var baseurl = $("#baseurl").val(); 42 var lang = $("#lang").val(); 43 44 if ($("#name").val() && $("#email").val() && $("#message").val()) { 45 firstAjaxCall(); 46 } else { 47 $("#formID")[0].reportValidity(); 48 } 49 50 function firstAjaxCall() { 51 $.ajax({ 52 //url: 'https://forms.scholarsportal.info/session/token', 53 url: 'https://forms.scholarsportal.info/session/token', 54 type: 'GET', 55 success: function(response) { 56 captcha(response); 57 //secondAjaxCall(response); 58 } 59 }); 60 } 61 62 function captcha(csrf_token) { 63 grecaptcha.ready(function() { 64 grecaptcha.execute('6Ler7JwUAAAAAEnsplyrO_beY_dn5ONZcRreFy3b', {action: 'submit'}).then(function(token) { 65 var string = encodeURIComponent(token); 66 $.get( "https://forms.scholarsportal.info/validator.php", { response: string } ) 67 .done(function( data ) { 68 if (data === true) { 69 secondAjaxCall(csrf_token); 70 } else { 71 if (lang === "fr") { 72 window.location.href = "/fr/failure/"; 73 } else { 74 window.location.href = "/failure/"; 75 } 76 } 77 }); 78 }).catch(function(error) { 79 if (lang === "fr") { 80 window.location.href = "/fr/failure/"; 81 } else { 82 window.location.href = "/failure/"; 83 } 84 }); 85 }); 86 } 87 88 function secondAjaxCall(csrf_token) { 89 $.ajax({ 90 type: "POST", 91 beforeSend: function(request) { 92 request.setRequestHeader("X-Csrf-Token", csrf_token); 93 request.setRequestHeader("Content-Type", "application/json"); 94 }, 95 url: "https://forms.scholarsportal.info/webform_rest/submit", 96 data: JSON.stringify(formData), 97 success: function(response) { 98 if (lang === "fr") { 99 window.location.href = "/fr/submit/"; 100 } else { 101 window.location.href = "/submit/"; 102 } 103 } 104 }); 105 } 106 e.preventDefault(); 107 }); 108});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.