1(function( $ ) { 2 'use strict'; 3 4 let app = { 5 ajax_url: '/wp-admin/admin-ajax.php', 6 preloader: { 7 light: "/wp-content/plugins/qcgov-file-reporter/public/images/loader-light.svg" 8 }, 9 ajax_cont: { 10 main_content: ".content-ajax-cont" 11 }, 12 in_progress: false, 13 onReady: function () { 14 app.accounts.init(); 15 app.wpcf7.init(); 16 }, 17 onLoad: function () { 18 19 }, 20 helpers: { 21 scrollToTop: function () { 22 $("html,body").animate({ scrollTop: 0 }, 500); 23 } 24 }, 25 accounts: { 26 init: function () { 27 app.accounts.login(); 28 }, 29 login: function () { 30 let form = $(".qcgov-fr-login-form-wrapper form"); 31 32 form.submit(function (e) { 33 e.preventDefault(); 34 35 let formBtn = form.find('input[type=submit]'); 36 37 $(formBtn).val('Processing...'); 38 $(formBtn).prop("disabled", true); 39 40 $.ajax({ 41 url: app.ajax_url, 42 type: "post", 43 cache: false, 44 data: { 45 action: "qcgov_fr_login_ajax", 46 ecs_email: $(form).find("input[name='ecs_email']").val(), 47 ecs_password: $(form).find("input[name='ecs_password']").val(), 48 }, 49 success: function (res) { 50 let response = $.parseJSON(res); 51 52 if (response.status === 'true' && response.status_code === 200) { 53 document.cookie = "ecs_at="+ response.token +"; expires=''; path=/"; 54 55 window.location.reload(); 56 } else { 57 form.find('div.notification').html('<p class="error">Invalid Credentials</p>'); 58 } 59 60 $(formBtn).val('Login'); 61 $(formBtn).prop("disabled", false); 62 }, 63 error: function(xhr, textStatus, error) { 64 console.log(xhr.responseText); 65 console.log(xhr.statusText); 66 console.log(textStatus); 67 console.log(error); 68 69 $(formBtn).val('Login'); 70 $(formBtn).prop("disabled", false); 71 } 72 }); 73 }); 74 }, 75 }, 76 wpcf7: { 77 init: function() { 78 let wpcf7Elm = document.querySelector('.wpcf7'); 79 80 wpcf7Elm.addEventListener( 'wpcf7submit', function( event ) { 81 document.cookie = 'ecs_at= ; expires = Thu, 01 Jan 1970 00:00:00 GMT' 82 }, false ); 83 } 84 } 85 } 86 87 document.addEventListener('DOMContentLoaded', app.onReady); 88 window.addEventListener('load', app.onLoad); 89 90})( jQuery );
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.