1/** 2 * ====================================================================== 3 * LICENSE: This file is subject to the terms and conditions defined in * 4 * file 'license.txt', which is part of this source code package. * 5 * ====================================================================== 6 */ 7 8if (typeof jQuery !== 'undefined') { 9 (function ($) { 10 $('document').ready(function () { 11 $('.login-input').bind('keyup', function(event) { 12 if (event.which === 13) { 13 $('.aam-login-submit').trigger('click'); 14 } 15 }); 16 17 $('.aam-login-submit').each(function () { 18 $(this).bind('click', function () { 19 var button = $(this); 20 var prefix = $(this).data('prefix'); 21 22 var log = $.trim($('#' + prefix + 'log').val()); 23 var pwd = $('#' + prefix + 'pwd').val(); 24 25 if (log && pwd) { 26 $('#' + prefix + 'error').css('display', 'none'); 27 28 $.ajax(aamLocal.ajaxurl, { 29 data: { 30 log: log, 31 pwd: pwd, 32 action: 'aamlogin', 33 redirect: $('#' + prefix + 'redirect').val(), 34 rememberme: ($('#' + prefix + 'rememberme').prop('checked') ? 1 : 0) 35 }, 36 dataType: 'json', 37 type: 'POST', 38 beforeSend: function() { 39 button.attr({ 40 disabled: 'disabled', 41 'data-original-label': button.val() 42 }).val('Wait...'); 43 }, 44 success: function(response) { 45 if (response.status === "success") { 46 if (response.redirect) { 47 location.href = response.redirect; 48 } 49 } else { 50 $('#' + prefix + 'error').html( 51 response.reason 52 ).css('display', 'block'); 53 } 54 }, 55 error: function() { 56 $('#' + prefix + 'error').html( 57 '<strong>ERROR:</strong> Unexpected error.' 58 ).css('display', 'block'); 59 }, 60 complete: function() { 61 button.attr({ 62 disabled: null 63 }).val(button.attr('data-original-label')); 64 } 65 }); 66 67 } else { 68 $('#' + prefix + 'error').html( 69 '<strong>ERROR:</strong> Username and password are required.' 70 ).css('display', 'block'); 71 } 72 }); 73 }); 74 }); 75 })(jQuery); 76} else { 77 console.log( 78 'AAM requires jQuery library in order for login widget to work' 79 ); 80}
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.